Score Save.
#1

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!
Reply
#2

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

Could ye' help me a little please? :3
Reply
#4

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

Код:
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));
Reply
#6

-_-

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

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

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

Thank you mate, appreciate it!
Reply
#10

No problem .
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)