SA-MP Forums Archive
save score - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: save score (/showthread.php?tid=246394)



save score - cruising - 04.04.2011

I got one question, how do you save score to userfile? i mean killing score?

i have tried with this with no success. I only put the score code here, not the whole creation of the userfile.
pawn Код:
new Score[MAX_PLAYERS];

public OnPlayerRegister(playerid, password[])
dini_IntSet(file, "Score", Score[playerid]);

public OnPlayerLogin(playerid,password[])
Score[playerid] = dini_Int(file,"Score");

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    return 1;
}

public OnPlayerDisconnect
dini_IntSet(file, "Score", Score[playerid]);



Re: save score - iMonk3y - 04.04.2011

There are plenty of scripts to look examples from... like this one


Re: save score - XFlawless - 04.04.2011

pawn Код:
OnPlayerDisconnect
dini_IntSet(file, "Score", GetPlayerScore(playerid));

OnPlayerLogin(playerid,password[])
SetPlayerScore(playerid, dini_Int(file,"Score"));



Re: save score - cruising - 04.04.2011

Quote:
Originally Posted by iMonk3y
Посмотреть сообщение
There are plenty of scripts to look examples from... like this one
thanks, but i was just typing the wrong word "Score" it should be GetPlayerScore and SetPlayerScore as XFlawless told


Re: save score - cruising - 04.04.2011

Quote:
Originally Posted by XFlawless
Посмотреть сообщение
pawn Код:
OnPlayerDisconnect
dini_IntSet(file, "Score", GetPlayerScore(playerid));

OnPlayerLogin(playerid,password[])
SetPlayerScore(playerid, dini_Int(file,"Score"));
Thank you! It works perfect! so much time wasted on just two faulty words, very good job Cruisng lol