13.10.2011, 18:14
Hey, I want to know how to make a /stats command to show the players state Like Name, Kills, deaths Kill/death ratio etc.
Im using Y_INI.
Im using Y_INI.
if (strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new admin = PlayerInfo[playerid][pAdminLevel];
new vip = PlayerInfo[playerid][pVIP];
new money = PlayerInfo[playerid][pCash];
new level = PlayerInfo[playerid][pScore];
new vw = PlayerInfo[playerid][pVw];
new interior = PlayerInfo[playerid][pInt];
new string1[128],stats[1024];
format(string1, sizeof string1, "{44A1D0}Level: {FFFFFF}[%d] {44A1D0}Money: {FFFFFF}[$%d] {44A1D0}AdminLevel: {FFFFFF}[$%d] {44A1D0}VIP: {FFFFFF}[$%d] {44A1D0}VW: {FFFFFF}[$%d] {44A1D0}Int: {FFFFFF}[$%d]", level,money,admin,vip,vw,interior);
format(stats, sizeof stats, "%s", string1);
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Your account:",stats,"Ok","");
}
return 1;
}
enum pInfo
{
pPass,
pAdminLevel,
pVIP,
pCash,
pScore,
pVw,
pInt
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Code:
|
format(string,sizeof(string),"[Adminlevel: %d || Kills: %d ]",Player[playerid][Adminlevel],Player[playerid][Kills]);
CMD:stats(playerid,params[]){
{
if(IsPlayerConnected(playerid))
{
new password = PlayerInfo[playerid][pPass];
new money = PlayerInfo[playerid][pCash];
new deaths = PlayerInfo[playerid][pDeaths];
new kills = PlayerInfo[playerid][pKills];
new score = PlayerInfo[playerid][pScore];
new admin = PlayerInfo[playerid][pAdmin];
new vip = PlayerInfo[playerid][pVIP];
new killpoints = PlayerInfo[playerid][pKillPoints];
new string[500];
format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d | VIP: %d | Killpoints: %d",password,money,deaths,kills,score,admin,vip,killpoints);
SendClientMessage(playerid,COLOR_WHITE,string);
}
return 1;
}
C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(192) : error 017: undefined symbol "UserPath" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(194) : error 017: undefined symbol "UserPath" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(205) : error 017: undefined symbol "GetName" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(217) : error 017: undefined symbol "UserPath" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(228) : error 017: undefined symbol "GetName" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(590) : error 017: undefined symbol "UserPath" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(592) : error 017: undefined symbol "udb_hash" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(613) : error 017: undefined symbol "udb_hash" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(615) : error 017: undefined symbol "UserPath" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(650) : error 079: inconsistent return types (array & non-array) C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(652) : warning 225: unreachable code C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(652) : error 029: invalid expression, assumed zero C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(652) : error 017: undefined symbol "cmd_msg" C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(652) : error 029: invalid expression, assumed zero C:\Documents and Settings\Customer\Desktop\GameMode\gamemodes\gangwar.pwn(652) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
CMD:stats(playerid,params[])
{
new password = PlayerInfo[playerid][pPass];
new money = PlayerInfo[playerid][pCash];
new deaths = PlayerInfo[playerid][pDeaths];
new kills = PlayerInfo[playerid][pKills];
new score = PlayerInfo[playerid][pScore];
new admin = PlayerInfo[playerid][pAdmin];
new vip = PlayerInfo[playerid][pVIP];
new killpoints = PlayerInfo[playerid][pKillPoints];
new string[500];
format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d | VIP: %d | Killpoints: %d",password,money,deaths,kills,score,admin,vip,killpoints);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
format(string,sizeof(string),"Password: %s",PlayerInfo[playerid][pPass]);
YCMD:stats(playerid,params[]) { new password = PlayerInfo[playerid][pPass]; new money = PlayerInfo[playerid][pCash]; new deaths = PlayerInfo[playerid][pDeaths]; new kills = PlayerInfo[playerid][pKills]; new score = PlayerInfo[playerid][pScore]; new admin = PlayerInfo[playerid][pAdmin]; new vip = PlayerInfo[playerid][pVIP]; new killpoints = PlayerInfo[playerid][pKillPoints]; new string[500]; format(string,sizeof(string),"Password: %s | Money: %d | Deaths: %d | Kills: %d | Score: %d | Admin: %d | VIP: %d | Killpoints: %d",password,money,deaths,kills,score,admin,vip,killpoints); SendClientMessage(playerid,COLOR_WHITE,string); return 1; }
C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(297) : warning 217: loose indentation C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(300) : warning 202: number of arguments does not match definition C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(306) : error 017: undefined symbol "pScore" C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(308) : error 017: undefined symbol "pVIP" C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(309) : error 017: undefined symbol "pKillPoints" C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(300) : warning 203: symbol is never used: "params" C:\Users\user\Desktop\Folder\gamemodes\test2.pwn(497) : warning 204: symbol is assigned a value that is never used: "randMSG1" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors.
CMD: myadminlevel(playerid, params[]) { new string[95]; // slightly increse value of this if some of the stats don't show up format(string,sizeof(string),"My Admin Level is: %i",PlayerInfo[playerid][pAdmin]); SendClientMessage(playerid, -1, string); return 1; }
enum pInfo { pAdmin, }