Help with 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)
+--- Thread: Help with stats (
/showthread.php?tid=542684)
Help with stats -
Glossy42O - 21.10.2014
Okay i got little prob with my stats, All is gewd but it won't save kills,deaths
PHP код:
CMD:stats(playerid,params[])
{
new string[128];
format(string,sizeof(string),"Password: %d | Money %d | Deaths %d | Kills %d | Score %d",PlayerInfo[playerid][pPass],GetPlayerMoney(playerid),PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pKills],GetPlayerScore(playerid));
SendClientMessage(playerid,-1,string);
return 1;
}
Re: Help with stats -
MasonSFW - 21.10.2014
Show me onplayerdisconnect
Re: Help with stats -
Glossy42O - 21.10.2014
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Score",GetPlayerScore(pScore));
INI_Close(File);
IsPlayerPolice[playerid] =0;
return 1;
}
Re: Help with stats -
Rudy_ - 21.10.2014
Add this aswell
pawn Код:
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
Re: Help with stats -
Glossy42O - 21.10.2014
PHP код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(283) : error 017: undefined symbol "File"
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(284) : error 017: undefined symbol "File"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Re: Help with stats -
TwinkiDaBoss - 21.10.2014
Add the code he gave you together with that code you had.
Re: Help with stats -
Glossy42O - 21.10.2014
Like that?
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Score",GetPlayerScore(pScore));
INI_Close(File);
IsPlayerPolice[playerid] =0;
return 1;
}
Re: Help with stats -
TwinkiDaBoss - 21.10.2014
No. Like this
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(pScore));
INI_Close(File);
IsPlayerPolice[playerid] =0;
return 1;
}
Re: Help with stats -
Glossy42O - 21.10.2014
No errors but same..
Re : Help with stats -
AmirRFCNR - 21.10.2014
With Using y_ini
enum :
Kills,
Deaths,
under public LoadUser_data(playerid,name[],value[])
pawn Код:
INI_Int("Kills",PlayerInfo[playerid][Kills]);
INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
under onplayerdisconnect:
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
INI_Close(File);
pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
kills[killerid]++;
deaths[playerid]++;
return 1;
}