save score
#1

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]);
Reply
#2

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

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

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

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)