SA-MP Forums Archive
Score Save. - 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: Score Save. (/showthread.php?tid=260021)



Score Save. - iGetty - 07.06.2011

So I have this

pawn Код:
dini_Set(archivo, "Password", inputtext);
Could I make a thing to save the score on here? That is all I need, then my register/login is complete!


Re: Score Save. - Tee - 07.06.2011

Make a function that will get the player's stats every maybe 5 seconds. Then save it like:

pawn Код:
dini_Int(archivo, "Score", GetPlayerScore(playerid));
Here is an example:

Make 3 new variables at the top of your script: new SaveStats[32],file[32],Name[32];

pawn Код:
forward Save(playerid)
public Save(playerid)
{
    if(PlayerData[playerid][Logged] == 1 && Spawned[playerid] == 1 && IsSpecing[playerid] == 0 && !IsPlayerNPC(playerid) && IsPlayerConnected(playerid))//Nevermind these, you will see the relevance of it when you make your admin script.
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(file, sizeof(file), "Accounts/%s.ini", Name);
        if(dini_Exists(file))
        {
            dini_IntSet(file, "Cash", GetPlayerCash(playerid));
            dini_IntSet(file, "Score", GetPlayerScore(playerid));
            dini_IntSet(file, "AdminLevel", PlayerData[playerid][AdminLevel]);
        }
    }
}
Just do this when the player logs in:

pawn Код:
SaveStats[playerid] = SetTimerEx("Save",5000,true,"i",playerid);
When they disconnect:

pawn Код:
KillTimer(SaveStats[playerid]);



Re: Score Save. - iGetty - 07.06.2011

Could ye' help me a little please? :3


Re: Score Save. - Snipa - 07.06.2011

pawn Код:
dini_Set(archivo,"Score",GetPlayerScore(playerid));
EDIT: Damn Tee, same time..


Re: Score Save. - iGetty - 07.06.2011

Код:
C:\Documents and Settings\d\Desktop\new.pwn(514) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 514 :

pawn Код:
dini_Set(archivo,"Score",GetPlayerScore(playerid));



Re: Score Save. - Tee - 07.06.2011

-_-

Snipa, dini_Set() is for Strings, score is an integer.

Use this:

pawn Код:
dini_IntSet(archivo,"Score",GetPlayerScore(playerid));
NOTE: Look at my first post.


Re: Score Save. - iGetty - 07.06.2011

Quote:
Originally Posted by Tee
Посмотреть сообщение
-_-

pawn Код:
dini_IntSet(archivo,"Score",GetPlayerScore(playerid));
dini_Set() is for Strings, score is an integer.

Look at my first post.
Okay, so I have the

pawn Код:
dini_IntSet(archivo,"Score",GetPlayerScore(playerid));
thing, what next? :3


Re: Score Save. - Tee - 07.06.2011

Compile it, and look at the first post, it should help even more.


Re: Score Save. - iGetty - 07.06.2011

Thank you mate, appreciate it!


Re: Score Save. - Tee - 07.06.2011

No problem .