Help with stats
#1

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;

Reply
#2

Show me onplayerdisconnect
Reply
#3

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    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;

Reply
#4

Add this aswell
pawn Код:
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
Reply
#5

PHP код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(283) : error 017undefined symbol "File"
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\LSCNR.pwn(284) : error 017undefined symbol "File"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

Reply
#6

Add the code he gave you together with that code you had.
Reply
#7

Like that?
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
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;

Reply
#8

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

No errors but same..
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)