How to -
ViruZZzZ_ChiLLL - 27.10.2010
Okay, let's say I have this :
pawn Код:
new playerid2; // On top of my script
dcmd_stats(playerid, params[])
{
new string[156];
new name[MAX_PLAYER_NAME];
if(sscanf(params, "u", playerid2))
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid);
}
else if(playerid2 == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "[Server] : Invalid Player ID! Player not connected");
else if(playerid2 == playerid)
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid);
}
else
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid);
}
return 1;
}
So now I'm stuck on how to get the player's stats on the Timer I've setted.
How can I get the player's stats in the Timer I've setted.
Just give me an example.
Re: How to -
The_Moddler - 27.10.2010
pawn Код:
new playerid2; // On top of my script
dcmd_stats(playerid, params[])
{
new string[156];
new name[MAX_PLAYER_NAME];
if(sscanf(params, "u", playerid2))
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid);
}
else if(playerid2 == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "[Server] : Invalid Player ID! Player not connected");
else if(playerid2 == playerid)
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid);
}
else
{
stats = SetTimerEx("Stats", 1000, true, "i", playerid2);//just change this to playerid2
}
return 1;
}
Re: How to -
ViruZZzZ_ChiLLL - 27.10.2010
But wouldn't that give him the timer instead of me?
And the textdraw will show to him instead of me?
Re: How to -
The_Moddler - 27.10.2010
Well, you will have to show us your 'Stats' function.
Re: How to -
ViruZZzZ_ChiLLL - 27.10.2010
Basically it's like this :
pawn Код:
forward Stats(playerid);
public Stats(playerid)
{
new string[186];
new ip[56];
GetPlayerIp(playerid, ip, sizeof(ip));
TextDrawShowForPlayer(playerid, Stats0);
TextDrawShowForPlayer(playerid, Stats1);
format(string, sizeof(string), "~r~Your Statistics :~n~~n~~b~Money :~n~~w~($%d)~n~~b~Score :~n~~w~(%d)~n~~b~Ping :~n~~w~(%d)~n~~b~Kills :~n~~w~(%d)~n~~b~Deaths :~n~~w~(%d)~n~~b~IP Address :~n~~w~(%s)", GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPlayerPing(playerid), KillVar[playerid], DeathVar[playerid], ip);
TextDrawSetString(Stats1, string);
return 1;
}
Re: How to -
The_Moddler - 27.10.2010
pawn Код:
forward StatsPlayer(playerid, playersid);
public StatsPlayer(playerid, playersid)
{
new string[186];
new ip[16];
GetPlayerIp(playersid, ip, sizeof(ip));
TextDrawShowForPlayer(playerid, Stats0);
TextDrawShowForPlayer(playerid, Stats1);
format(string, 186, "~r~Hes Statistics :~n~~n~~b~Money :~n~~w~($%d)~n~~b~Score :~n~~w~(%d)~n~~b~Ping :~n~~w~(%d)~n~~b~Kills :~n~~w~(%d)~n~~b~Deaths :~n~~w~(%d)~n~~b~IP Address :~n~~w~(%s)", GetPlayerMoney(playersid), GetPlayerScore(playersid), GetPlayerPing(playersid), KillVar[playersid], DeathVar[playersid], ip);
TextDrawSetString(Stats1, string);
return 1;
}
stats = SetTimerEx("StatsPlayer", 1000, true, "ii", playerid, playerid2);
Should work
Re: How to -
ViruZZzZ_ChiLLL - 27.10.2010
Still won't work.
Re: How to -
The_Moddler - 27.10.2010
What error do you get?
EDIT:
pawn Код:
dcmd_stats(playerid, params[])
{
new id;
if(sscanf(params, "u", id)) return stats = SetTimerEx("Stats", 1000, true, "ii", playerid, playerid);
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "[Server] : Invalid Player ID! Player not connected");
else if(id == playerid)
{
stats = SetTimerEx("Stats", 1000, true, "ii", playerid, playerid);
}
else
{
stats = SetTimerEx("Stats", 1000, true, "ii", playerid, id);
}
return 1;
}
Try this command...
Re: How to -
iggy1 - 28.10.2010
I'd think about making "stats" an array too because if two players use the stats command within a second of each other it might mess your timer ids up.
Re: How to -
ViruZZzZ_ChiLLL - 28.10.2010
I don't get any errors.
I just want the other player stats to show up to on the timer. (Playerid2)
@iggy1 Oh, okay. :3