SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 16/07/2017, 04:02 AM   #1
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 201
Reputation: 2
Default bug no alive time

Olá, eu estou usando esse sistema de marcar o tempo vivo para meu servidor dayz:
Quote:
//|||||||||||||||||||||||||||||||||||||||||||||||||| ||||||||||||||||||||||BY:IgorLuiz||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||| |||||||
#include <a_samp>
// Definir a Player TextDraw HUDS
new PlayerText:HUD7[MAX_PLAYERS],
PlayerText:HUD8[MAX_PLAYERS],
PlayerText:HUD9[MAX_PLAYERS]
;
new Tempo[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// Criar PlayerTextDraw
HUD7[playerid] = CreatePlayerTextDraw(playerid, 511.485900, 61.176670, "_");
PlayerTextDrawLetterSize(playerid, HUD7[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD7[playerid], 1);
PlayerTextDrawColor(playerid, HUD7[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD7[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD7[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD7[playerid], 255);
PlayerTextDrawFont(playerid, HUD7[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD7[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD7[playerid], 0);

HUD8[playerid] = CreatePlayerTextDraw(playerid, 527.853027, 73.310012, "_");
PlayerTextDrawLetterSize(playerid, HUD8[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD8[playerid], 1);
PlayerTextDrawColor(playerid, HUD8[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD8[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD8[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD8[playerid], 255);
PlayerTextDrawFont(playerid, HUD8[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD8[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD8[playerid], 0);

HUD9[playerid] = CreatePlayerTextDraw(playerid, 508.126434, 85.256683, "_");
PlayerTextDrawLetterSize(playerid, HUD9[playerid], 0.235199, 1.144533);
PlayerTextDrawAlignment(playerid, HUD9[playerid], 1);
PlayerTextDrawColor(playerid, HUD9[playerid], -1);
PlayerTextDrawSetShadow(playerid, HUD9[playerid], 0);
PlayerTextDrawSetOutline(playerid, HUD9[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, HUD9[playerid], 255);
PlayerTextDrawFont(playerid, HUD9[playerid], 2);
PlayerTextDrawSetProportional(playerid, HUD9[playerid], 1);
PlayerTextDrawSetShadow(playerid, HUD9[playerid], 0);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetTimer("Status", 1000, 1); // Chamar a public status
PlayerTextDrawShow(playerid, HUD7[playerid]); // Mostrar todos os HUDS quando da spawn
PlayerTextDrawShow(playerid, HUD8[playerid]); // Mostrar todos os HUDS quando da spawn
PlayerTextDrawShow(playerid, HUD9[playerid]); // Mostrar todos os HUDS quando da spawn
Tempo[playerid] = 0; // Setar o tempo para 0 novamente
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerTextDrawHide(playerid, HUD7[playerid]); // esconder os HUDS quando morrer
PlayerTextDrawHide(playerid, HUD8[playerid]); // esconder os HUDS quando morrer
PlayerTextDrawHide(playerid, HUD9[playerid]); // esconder os HUDS quando morrer
KillTimer(Status(playerid)); // Parar de chamar a public "Status"
Tempo[playerid] = 0; // setar o tempo para 0 novamente
return 1;
}
// public onde ira atualizar todos os status
forward Status(playerid);
public Status(playerid)
{
new String[128], Float:Health;
GetPlayerHealth(playerid, Health);
//
format(String, sizeof(String), "alive_time: ~w~%d", Tempo[playerid]);
PlayerTextDrawSetString(playerid, HUD7[playerid], String);
//
format(String, sizeof(String), "blood: ~w~%f",Health);
PlayerTextDrawSetString(playerid, HUD8[playerid], String);
//
format(String, sizeof(String), "name:_~w~%s",Tempo[playerid], Health, Nome(playerid));
PlayerTextDrawSetString(playerid, HUD9[playerid], String);
//
Tempo[playerid]++;
return 1;
}
// Stock para pegar o nome do jogador
stock Nome(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}
so que quando um player morre, apos a morte o tempo bug! o tempo fica passando mais rapido, tipo ele passa 2 numeros em menos de 1 segundos morrer dnv ele passa 3 numeros em 1 segundo e assim vai... ;s
PedroH is offline   Reply With Quote
Old 16/07/2017, 01:47 PM   #2
ThiagoMikael
Big Clucker
 
Join Date: Jul 2017
Posts: 64
Reputation: 0
Default Re: bug no alive time

E quando "um player" ou todos? tenta usar: SetTimerEx("Status", 1000, true, "i", playerid);
ThiagoMikael is offline   Reply With Quote
Old 16/07/2017, 01:58 PM   #3
GuilhermeNunes
Gangsta
 
Join Date: Feb 2017
Posts: 585
Reputation: 8
Default Re: bug no alive time

esse bug pq tu ta usando settimer use settimerex eu tavo com esse bug e troquei pra settimerex e resolveu

Code:
PHP Code:

SetTimerEx 
Possui Parametros e é um timer Player
SetTimer 
sem Parametro e é um timer Global 
se continuar verifique os True e False
GuilhermeNunes is offline   Reply With Quote
Old 16/07/2017, 02:12 PM   #4
Jonorusc
Big Clucker
 
Jonorusc's Avatar
 
Join Date: Jun 2017
Location: RN/Brasil
Posts: 146
Reputation: 7
Default Re: bug no alive time

Deixa true msm! Mas use SetTimerEx("Status", 1000, true, "i", playerid);
__________________
EverThings in life depends on the how much you wanna eat someone!
Jonorusc is offline   Reply With Quote
Old 16/07/2017, 04:18 PM   #5
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 201
Reputation: 2
Default Re: bug no alive time

deu nao ;c oque acontece e que quando um player morre, depois que spawna o tempo fica passando 2 vezes mais rapido!
PedroH is offline   Reply With Quote
Old 16/07/2017, 08:54 PM   #6
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 201
Reputation: 2
Default Re: bug no alive time

achei o problema! e pq o SetTimerEx("Status", 1000, true, "i", playerid); ele esta dando tipo +1 segundo de rapidez qnd ele e chamado! coloquei ele no onplayer connect e ele parou de ser chamado a cada spawn do player, mas.. toda vez q o player conecta ele adiciona +1 segundo mais rapida a contagem! dai eu nao sei em que callback eu coloque para que ela seja chamada apenas 1 vez.. alguem em alguma dica?
PedroH is offline   Reply With Quote
Old 16/07/2017, 09:56 PM   #7
Carlos001
Huge Clucker
 
Carlos001's Avatar
 
Join Date: Jan 2016
Location: Brasilia - DF
Posts: 483
Reputation: 35
Default Re: bug no alive time

Quote:
Originally Posted by PedroH View Post
achei o problema! e pq o SetTimerEx("Status", 1000, true, "i", playerid); ele esta dando tipo +1 segundo de rapidez qnd ele e chamado! coloquei ele no onplayer connect e ele parou de ser chamado a cada spawn do player, mas.. toda vez q o player conecta ele adiciona +1 segundo mais rapida a contagem! dai eu nao sei em que callback eu coloque para que ela seja chamada apenas 1 vez.. alguem em alguma dica?
Killtimer
Carlos001 is offline   Reply With Quote
Old 16/07/2017, 11:25 PM   #8
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 201
Reputation: 2
Default Re: bug no alive time

seria assim?
Quote:
OnPlayerDisconnect..
KillTimer(Status2);
Quote:
forward Status2(playerid);
public Status2(playerid)
{
new str[100];
new time = Player[playerid][pDTime];
Player[playerid][pDTime]++;
format(str, sizeof(str), "%02d:%02d:%02d", time/3600, (time % 3600)/60, time % 60);
PlayerTextDrawSetString(playerid, caixa10[playerid], str);
return 1;
}
Quote:
D:\samp037_svr_R2-1-1_win32\gamemodes\survive1.pwn(221) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
me corrije pfv
PedroH is offline   Reply With Quote
Old 17/07/2017, 09:13 PM   #9
PedroH
Huge Clucker
 
Join Date: Jul 2017
Posts: 201
Reputation: 2
Default Re: bug no alive time

alguem sabe oque ta causando esse bug?
PedroH is offline   Reply With Quote
Old 18/07/2017, 12:15 AM   #10
Carlos001
Huge Clucker
 
Carlos001's Avatar
 
Join Date: Jan 2016
Location: Brasilia - DF
Posts: 483
Reputation: 35
Default Re: bug no alive time

PHP Code:
New timerplayer[MAX_PLAYERS];
timerplayer[playerid] = SetTimerEx(...); // connect 
Killtimer(timerplayer[playerid]); //desconnect 
Não testei, fiz pelo celular caso tiver algo errado sorry..
Carlos001 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cj is alive ? :C cj bot Glossy42O Bug Reports 4 06/03/2015 09:54 PM
Is ICQ still alive? Bombo Everything and Nothing 9 15/12/2013 03:00 AM
player stats alive time not saving sscarface Scripting Help 4 18/02/2013 05:23 PM
Need something to keep the PC alive. Samp_India Everything and Nothing 2 15/04/2012 10:44 AM
[HELP]Last Man Alive Tigerbeast11 Help Archive 3 23/11/2009 06:50 AM


All times are GMT. The time now is 05:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.