Login system
#1

Hi I have a login system in my server.It works I can register and login etc
I have a stats command but it doesn't show me the stats.It just shows 0 in score,money,kills etc.

What to do?
Reply
#2

look in scriptfiles folder
Reply
#3

K thanks! Didn't see that :/
What about the /stats command problem?Can you help?
Reply
#4

Show your /stats command.
Reply
#5

Код:
CMD:stats(playerid,params[])
{
	new Score = PlayerInfo[playerid][pScore];
    new Cash = PlayerInfo[playerid][pCash];
    new Deaths = PlayerInfo[playerid][pDeaths];
    new Kills = PlayerInfo[playerid][pKills];
    new string[500];
    format(string,sizeof(string),"Score: %i | Cash: %d | Deaths: %d | Kills: %d |",Score,Cash,Deaths,Kills,GetPlayerScore(playerid));
    SendClientMessage(playerid,-1,string);
    return 1;
}
Reply
#6

show the code you saving the cash deaths...
cuz it fine
Reply
#7

Код:
enum pInfo
{
	pName2,
	pScore,
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Name",PlayerInfo[playerid][pName2]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
stock UserPath(playerid)
{
    new string[500],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Note:-I didn't make this login system,took it from a tutorial,I am not at all familiar with enums etc.
And stats cmd was made for me by a friend.
Reply
#8

did u add OnPlayerDisconnect This:
pawn Код:
new INI:YourFile = Open(yourstock(playerid));
dini_WriteInt(yourfile, "cash", GetPlayerMoney(playerid));
//and more stuff like that???
did u add this
Reply
#9

wow sorry my bad
pawn Код:
INI_WriteInt(YourFile, "Cash", GetPlayerMoney(playerid));
Fixed!
Reply
#10

Yea some what
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Name",PlayerInfo[playerid][pName2]);
    INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
    INI_Close(File);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)