/stats ?
#1

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;
}
Reply
#2

Don't you mean pAdmin[playerid] ?
Reply
#3

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.
Reply
#4

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.
Reply
#5

Код:
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
Reply
#6

Post line 1006, 1007 and 1008 please.
Reply
#7

Код:
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;
}
Reply
#8

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.
Reply
#9

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")
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)