what to use to save my kills+deaths+score -
cubaton3 - 02.10.2009
hello, what can i use to save my kills+deaths+score ? i have my own /stats but i want to save my score but i dont need to save money only kills deaths and score
Re: what to use to save my kills+deaths+score -
CJ101 - 03.10.2009
an admin filterscript would work.
![Cool](images/smilies/cool.gif)
search.
Re: what to use to save my kills+deaths+score -
cubaton3 - 03.10.2009
Quote:
Originally Posted by CJ101
an admin filterscript would work. ![Cool](images/smilies/cool.gif) search.
|
i use LAdmin i aint changing
Re: what to use to save my kills+deaths+score -
Battleskull - 03.10.2009
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by CJ101
an admin filterscript would work. ![Cool](images/smilies/cool.gif) search.
|
i use LAdmin i aint changing
|
so you want you /stat to display kills deaths and score?
Re: what to use to save my kills+deaths+score -
cubaton3 - 03.10.2009
Quote:
Originally Posted by Battleskull
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by CJ101
an admin filterscript would work. ![Cool](images/smilies/cool.gif) search.
|
i use LAdmin i aint changing
|
so you want you /stat to display kills deaths and score?
|
im saying that i want to save my score+kills+deaths autosave those
Re: what to use to save my kills+deaths+score -
Battleskull - 03.10.2009
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by Battleskull
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by CJ101
an admin filterscript would work. ![Cool](images/smilies/cool.gif) search.
|
i use LAdmin i aint changing
|
so you want you /stat to display kills deaths and score?
|
im saying that i want to save my score+kills+deaths autosave those
|
save to what? a file when then log in? save to a command?
Re: what to use to save my kills+deaths+score -
cubaton3 - 03.10.2009
Quote:
Originally Posted by Battleskull
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by Battleskull
Quote:
Originally Posted by Jonny Calone
Quote:
Originally Posted by CJ101
an admin filterscript would work. ![Cool](images/smilies/cool.gif) search.
|
i use LAdmin i aint changing
|
so you want you /stat to display kills deaths and score?
|
im saying that i want to save my score+kills+deaths autosave those
|
save to what? a file when then log in? save to a command?
|
bro to save the stats man when a user login back again teh server he have the same stats as last time
Re: what to use to save my kills+deaths+score -
Battleskull - 03.10.2009
do you have a login system? You need a login system otherwise you will have people with same names take each others scores. If you have a login system I might need to see it to help.
Re: what to use to save my kills+deaths+score -
cubaton3 - 03.10.2009
Quote:
Originally Posted by Battleskull
do you have a login system? You need a login system otherwise you will have people with same names take each others scores. If you have a login system I might need to see it to help.
|
i have a login and register system but i only need to save my kills+death+score
Re: what to use to save my kills+deaths+score -
coole210 - 03.10.2009
Top of script:
[pawn]enum pInfo
{
pKills,
pDeaths,
};
new PlayerInfo[256][pInfo];
OnPlayerDisconnect:
pawn Код:
new string[128];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
format(string,sizeof(string),"Stats/%s.ini",Name);
new File: statsfile = fopen(string,io_read);
if(!statsfile)
{
fcreate(string);
}
format(string,sizeof(string),"Kills=%d\r\n",PlayerInfo[playerid][pKills]);fwrite(statsfile,string);
format(string,sizeof(string),"Deaths=%d\r\n",PlayerInfo[playerid][pDeaths]);fwrite(statsfile,string);
format(string,sizeof(string),"Score=%d\r\n",GetPlayerScore(playerid));fwrite(statsfile,string);
fclose(statsfile);
}
OnPlayerConnect [FUNCTION BELOW]:
FUNCTIONS:
pawn Код:
forward Login(playerid);
public Login(playerid)
{
new string[128];
format(string,sizeof(string),"Stats/%s.ini",PlayerName(playerid));
new File: statsfile = fopen(string,io_read);
new key[256],val[256];
new Data[256];
while(fread(file,Data,sizeof(Data)))
{
key = ini_GetKey(Data);
if(strcmp(key,"Kills",true) == 0){val = ini_GetValue(Data);PlayerInfo[playerid][pKills] = strval(val);}
if(strcmp(key,"Deaths",true) == 0){val = ini_GetValue(Data);PlayerInfo[playerid][pDeaths] = strval(val);}
if(strcmp(key,"Score",true) == 0){val = ini_GetValue(Data);SetPlayerScore(playerid,strval(val));}
}
return 1;
}
stock ini_GetKey(line[])
{
new keyRes[128];
keyRes[0] = 0;
if(strfind(line, "=", true) == -1) return keyRes;
strmid(keyRes, line, 0, strfind(line, "=", true), sizeof(keyRes));
return keyRes;
}
stock ini_GetValue(line[])
{
new valRes[128];
valRes[0] = 0;
if(strfind(line, "=", true) == -1) return valRes;
strmid(valRes, line, strfind(line, "=", true)+1, strlen(line), sizeof(valRes));
return valRes;
}
stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}
OnPlayerDeath:
pawn Код:
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
Sorry i did this in the forum so theres no identation.