/stats - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /stats (
/showthread.php?tid=658654)
/stats -
KinderClans - 09.09.2018
If i do only /stats, it shows correctly my stats, but if i do /stats name/id it shows only the message: "You can also use /stats id bla bla"
Why?
pawn Код:
CMD:stats(playerid, params[])
{
new id;
sscanf(params, "u", id);
SCM(playerid,-1, "* You can also do "ORANGE_RED"/stats [playername/id] "WHITE"to check other player's stats.");
if (isnull(params))
{
ShowStats(playerid);
}
else if(IsPlayerConnected(id))
{
ShowStats(id);
}
else SCM(playerid,COLOR_RED,"* Player is not connected or is invalid id/name.");
return 1;
}
Re: /stats -
Infin1ty - 09.09.2018
Your code is old and inefficient. This should work (mind you - it is untested).
This should fix the issue you're having at the moment.
Код:
CMD:stats(playerid, params[])
{
new targetid;
if(sscanf(params, "u", targetid))
{
SendClientMessage(playerid, -1, "* You can also do "ORANGE_RED"/stats [playername/id] "WHITE"to check other player's stats.");
targetid = playerid;
}
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, COLOR_RED, "* Player is not connected or is invalid id/name.");
ShowStats(targetid);
return 1;
}
Re: /stats -
KinderClans - 09.09.2018
Doesn't work. It i do only /stats i get "Player is not connected" message.
Re: /stats -
Shinja - 09.09.2018
PHP код:
CMD:stats(playerid, params[])
{
new id;
if(isnull(params)) format(params, 10, "%d", playerid);
if(sscanf(params, "i", id)) return SCM(playerid,-1, "* USAGE "ORANGE_RED"/stats [playername/id] "WHITE"to check other player's stats.");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected");
ShowStats(playerid, id);
return 1;
}
You must add a variable to ShowStats
ShowStats(the player who used cmd, the id to show stats);
If you dont know how to do this show your ShowStats function
Re: /stats -
UFF - 09.09.2018
Код:
CMD:stats(playerid, params[])
{
new otherid;
if(sscanf(params, "u", otherid))
{
ShowStats(playerid);
}
else
{
if(!IsPlayerConnected(otherid))
return SendClientMessage(playerid, COLOR_RED, "* Player is not connected or is invalid id/name.");
ShowStats(otherid);
}
return true;
}
try this
Re: /stats -
v1k1nG - 09.09.2018
Ehi! Prova con:
PHP код:
CMD:stats(playerid, params[]){
new id;
sscanf(params, "u", id);
if(isnull(params)){
ShowStats(playerid);
SCM(playerid,-1, "* You can also do "ORANGE_RED"/stats [playername/id] "WHITE"to check other player's stats.");
return 1;
}
if(IsPlayerConnected(id)){
ShowStats(id);
return 1;
}
else SCM(playerid,COLOR_RED,"* Player is not connected or is invalid id/name.");
return 1;
}