SA-MP Forums Archive
[HELP] ID:0 problem... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] ID:0 problem... (/showthread.php?tid=165111)



[HELP] ID:0 problem... - LasTRace - 03.08.2010

hi,

I have a command which used for getting a player's stats. But, i have two commands:

"/my stats" and "/getstats [ID]".

If ID:0 types "/getstats 0" it shows an error like "use /my stats to see your own stats", and, if ID:0 types "/getstats 1" (or 2,3,4...), it still shows that error. This command works for other players, but doesn't work for id 0.

Here is the error code:

pawn Код:
if(ReturnPlayer == playerid) return SendClientMessage(playerid, mbrightred, "Use /my stats to see your own stats.");
Can anyone help?


Re: [HELP] ID:0 problem... - Finn - 03.08.2010

Can't help without the full code (whole cmd).


Re: [HELP] ID:0 problem... - LasTRace - 03.08.2010

pawn Код:
dcmd_getstats(playerid, params[])
{
    new ReturnPlayer, ReturnUserName[24], ReturnPlayerFile[50], str[256], pDeaths[50], pKills[50], pDuelDeaths[50], pDuelKills[50], pMadnesswin[50];

    if(sscanf(params, "d", ReturnPlayer)) return SendClientMessage(playerid, mwhite, "Usage: /getstats [playerid]");

    if(ReturnPlayer == playerid) return SendClientMessage(playerid, mbrightred, "Use /my stats to see your own stats.");

    GetPlayerName(ReturnPlayer, ReturnUserName, sizeof(ReturnUserName));
    format(ReturnPlayerFile, sizeof(ReturnPlayerFile), "/users/%s.ini", ReturnUserName);

    if(!IsPlayerConnected(ReturnPlayer)) return SendClientMessage(playerid, mbrightred, "Invalid player ID.");
    if(!dini_Exists(ReturnPlayerFile)) return SendClientMessage(playerid, mbrightred, "This player is an unregistered player.");

    if(dini_Exists(ReturnPlayerFile))
    {
.
.
.
        }
return 1;
}