[Ajuda] Cуdigo da crash, pq?
#1

Cуdigo:

pawn Код:
new iString[200];
    format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%00.1f~ ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pDeaths]);
    PlayerTextDrawSetString(playerid, PlayerText:Textdraw3, iString);
ele da crash qdo e usado pq?
Reply
#2

Tenta
pawn Код:
new iString[200];
    format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%00.1f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pDeaths]);
    PlayerTextDrawSetString(playerid, PlayerText:Textdraw3, iString);
Reply
#3

Resultou e agr como fasso para ele atualizar automaticamente, eu tenho assim:

pawn Код:
forward OnScriptUpdate();
public OnScriptUpdate()
{
    new iString[200];
    format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%00.1f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pDeaths]);
    PlayerTextDrawSetString(playerid, PlayerText:Textdraw3, iString);
}
OnGamemodeInit
pawn Код:
SetTimer("OnScriptUpdate", 1000, true);
erros:
Код:
error 017: undefined symbol "playerid"
error 017: undefined symbol "playerid"
Linhas:
Код:
	format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%00.1f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pDeaths]);
    PlayerTextDrawSetString(playerid, PlayerText:Textdraw3, iString);
Reply
#4

pawn Код:
forward OnScriptUpdate(playerid);
public OnScriptUpdate(playerid)
{
    new iString[200];
    format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%00.1f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], Float:PlayerInfo[playerid][pKills]/Float:PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pDeaths]);
    PlayerTextDrawSetString(playerid, PlayerText:Textdraw3, iString);
}
Reply
#5

Sabe fazer isso com fps ping e packetloss?

@edit:
Com as Kills se tiver o valor 0 a parece um numero negativo.. tipo -45774
Reply
#6

pawn Код:
forward OnScriptUpdate();
public OnScriptUpdate()
{
    new iString[200], Float: ratio;
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        ratio = floatdiv(PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
        format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%.2f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[playerid][pKills], ratio, PlayerInfo[playerid][pDeaths]);
        PlayerTextDrawSetString(playerid, Textdraw3, iString);
    }
}
Reply
#7

pode-me ajudar com o fps packetloss e ping?
Reply
#8

pawn Код:
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
Код:
warning 219: local variable "playerid" shadows a variable at a preceding level
Da para tirar o warning?

ps. sry 2є post
Reply
#9

hmm
pawn Код:
forward OnScriptUpdate();
public OnScriptUpdate()
{
    new iString[200], Float: ratio;
    for(new id = 0; id < MAX_PLAYERS; id++)
    {
        ratio = floatdiv(PlayerInfo[id][pKills], PlayerInfo[id][pDeaths]);
        format(iString, sizeof(iString), "~r~~h~~h~Kills:~y~~h~%d ~r~~h~~h~K/D:~y~~h~%.2f ~r~~h~~h~Kills:~y~~h~%d", PlayerInfo[id][pKills], ratio, PlayerInfo[id][pDeaths]);
        PlayerTextDrawSetString(id, Textdraw3, iString);
    }
}
Reply
#10

pawn Код:
for(new pid= 0; pid< MAX_PLAYERS; pid++)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)