SA-MP Forums Archive
/stats command not working! - 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 command not working! (/showthread.php?tid=536999)



/stats command not working! - MrCallum - 13.09.2014

I have an error with my /stats command, can someone help me!

Код:
C:\Users\Callum.Acer\Desktop\Scripting extra\gamemodes\Gamemode.pwn(431) : error 028: invalid subscript (not an array or too many subscripts): "PlayerInfo"
C:\Users\Callum.Acer\Desktop\Scripting extra\gamemodes\Gamemode.pwn(431) : warning 215: expression has no effect
C:\Users\Callum.Acer\Desktop\Scripting extra\gamemodes\Gamemode.pwn(431) : error 001: expected token: ";", but found "]"
C:\Users\Callum.Acer\Desktop\Scripting extra\gamemodes\Gamemode.pwn(431) : error 029: invalid expression, assumed zero
C:\Users\Callum.Acer\Desktop\Scripting extra\gamemodes\Gamemode.pwn(431) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Command :

Quote:

CMDtats(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new money = PlayerInfo[playerid][pMoney]; // Line 431!
new levels = PlayerInfo[playerid][pLevels];
new admin = PlayerInfo[playerid][pAdmin];
new string[500];
format(string,sizeof(string),"Money: %d | Levels: %d | Admin: %d | ",money,levels,admin,);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}

Enums:

Код:
enum PlayerInfo
{
    Pass[129],
    pAdmin,
    pMod,
    pMoney,
    pLevels
}



Re: /stats command not working! - Thogy - 13.09.2014

pawn Код:
CMD:stats(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new string[500];
format(string,sizeof(string),"Money: %d | Levels: %d | Admin: %d | ",PlayerInfo[playerid][pMoney],PlayerInfo[playerid][pLevels],PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid,COLOR_WHITE,string);
}
return 1;
}



Re: /stats command not working! - TheNerka - 13.09.2014

Код:
CMD:stats(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
 new money  = GetPlayerMoney(playerid);
 new levels = GetPlayerScore(playerid);
 new admin = PlayerInfo[playerid][pAdmin];
 new string[500];
 format(string,sizeof(string),"Money: %d | Levels: %d | Admin: %d | ",money,levels,admin,);
 SendClientMessage(playerid,COLOR_WHITE,string);
}
return 1;
}
try this


Re: /stats command not working! - ReD_HunTeR - 13.09.2014

try this?:

pawn Код:
CMD:stats(playerid, params[])
{
    new string[500];
    format(string, sizeof(string), " | Money: %d | Levels: %d | Admin: %d | ", PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pLevels], PlayerInfo[playerid][pAdmin]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    return 1;
}
pawn Код:
enum pInfo
{
    Pass[129],
    pAdmin,
    pMod,
    pMoney,
    pLevels
}
new PlayerInfo[MAX_PLAYERS][pInfo];