/stats help
#1

Hello guys, i few help with my stats i made my own and its so glitchy when i make a new acc it gives me 1 kill and no cash showing in dialog while i have it on my green bar here is the SS of /stats and gonna post a code. Please help ASAP!



CMDtats(playerid, params[])
{
new string[128];
new vip = PlayerInfo[playerid][pVip];
new cash = PlayerInfo[playerid][pCash];
new kills = PlayerInfo[playerid][pKills];
new deaths = PlayerInfo[playerid][pDeaths];
format(string,sizeof(string),"{FFFF00}Vip: {66FF00}%i\n{FFFF00}Cash: {66FF00}%i\n{FFFF00}Kills: {66FF00}%i\n{FFFF00}Deaths: {66FF00}%i",vip,cash,kills,deaths);
ShowPlayerDialog(playerid,DIALOG_OK,DIALOG_STYLE_M SGBOX,"Satistics",string,"Ok","");
return 1;
}

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Vip",PlayerInfo[playerid][pVip]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}

enum pInfo
{
pPass,
pCash,
pVip,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}

f(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
Reply
#2

pawn Код:
new cash = GetPlayerMoney(playerid);
Not:
pawn Код:
new cash = PlayerInfo[playerid][pCash];
That will get the player's money.
For the kills thing, make sure you set the value to 0 when the player connects.
Reply
#3

Thanks for the cash thing and when i wanted to set the cash to 5 thousand it spawn with 10000 thousand for some reason

If you could help me more, could you please add me on Skype

Adam_Hawk1

And also Rep+ for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)