/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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /stats ? (
/showthread.php?tid=275115)
/stats ? -
Chrillzen - 08.08.2011
I tried to make a very very simple thing so you can check your stats, it only shows random numbers.
Код:
CMD:stats(playerid,params[])
{
SendClientMessage(playerid,COLOR_YELLOW, "-Dina Stats-");
format(GlobalMessageString, sizeof(GlobalMessageString), "Stats: Admin level: %d Kills: %d Deaths: %d Killingsprees: %d Cookies: %d.", pAdmin, pKills, pDeaths, pSpree, pCookies);
SendClientMessage(playerid, COLOR_WHITE, GlobalMessageString);
return 1;
}
Re: /stats ? -
FireCat - 08.08.2011
Don't you mean pAdmin[playerid] ?
Re: /stats ? -
Chrillzen - 08.08.2011
Quote:
Originally Posted by FireCat
Don't you mean pAdmin[playerid] ?
|
Код:
format(GlobalMessageString, sizeof(GlobalMessageString), "Stats: Admin level: %d Kills: %d Deaths: %d Killingsprees: %d Cookies: %d.", pAdmin, pKills, pDeaths, pSpree, pCookies);
That should be correct, the %d are the strings that should show the number of my kills etc, but it shows an random number instead.
Re: /stats ? -
Kayaque - 08.08.2011
pawn Код:
format(GlobalMessageString, sizeof(GlobalMessageString), "Stats: Admin level: %d Kills: %d Deaths: %d Killingsprees: %d Cookies: %d.", pAdmin[playerid], pKills[playerid], pDeaths[playerid], pSpree[playerid], pCookies[playerid]);
Try that.
Re: /stats ? -
Chrillzen - 08.08.2011
Код:
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(1007) : error 028: invalid subscript (not an array or too many subscripts): "pAdmin"
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(1007) : warning 215: expression has no effect
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(1007) : error 001: expected token: ";", but found "]"
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(1007) : error 029: invalid expression, assumed zero
Re: /stats ? -
Kayaque - 08.08.2011
Post line 1006, 1007 and 1008 please.
Re: /stats ? -
Chrillzen - 08.08.2011
Код:
CMD:stats(playerid,params[])
{
SendClientMessage(playerid,COLOR_YELLOW, "-Dina Stats-");
format(GlobalMessageString, sizeof(GlobalMessageString), "Stats: Admin level: %d Kills: %d Deaths: %d Killingsprees: %d Cookies: %d.", pAdmin[playerid], pKills[playerid], pDeaths[playerid], pSpree[playerid], pCookies[playerid]);
SendClientMessage(playerid, COLOR_WHITE, GlobalMessageString);
return 1;
}
Re: /stats ? -
Kayaque - 08.08.2011
Have you made pAdmin an array like pAdmin[MAX_PLAYERS]; ? Or just simply pAdmin; at the top of your script? To store a playerid in an array it needs slots to do such. Writing pAdmin; only won't give you slots to save the playerid, and therefor it wont recognize it as an array at all.
Re: /stats ? -
Chrillzen - 08.08.2011
This is what i get when i add Arrays for them.
Код:
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(149) : error 033: array must be indexed (variable "pCookies")
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(150) : error 033: array must be indexed (variable "pSpree")
D:\Allt\Spel\SA-MP 0.3C\gamemodes\dm.pwn(151) : error 033: array must be indexed (variable "pDeaths")
Re: /stats ? -
Kayaque - 08.08.2011
You need to use pCookies[MAX_PLAYERS]; at the top of your script, and whenever you are using them to extract a value, you need pCookies[playerid].
It even says "array must be indexed". Which means you use only pCookies.