Some one I need help thanks.
#1

pawn Код:
public OnPlayerUpdate(playerid)
{
    new file[128];
    new uCash = GetPlayerMoney(playerid);
    dini_IntSet(file,"AdminLevel", PlayerInfo[playerid][AdminLevel]);
    dini_IntSet(file,"Cash", uCash);
    dini_IntSet(file,"Kills", PlayerInfo[playerid][pKills]);
    dini_IntSet(file,"Deaths", PlayerInfo[playerid][pDeaths]);
    dini_IntSet(file,"Locked", PlayerInfo[playerid][pLocked]);
    dini_IntSet(file,"Local", PlayerInfo[playerid][pLocal]);
    dini_IntSet(file,"Int", PlayerInfo[playerid][pInt]);
}
using this to update the money/kills/deaths with this register/login system but the money/kills/deaths still don't save.
http://forum.sa-mp.com/index.php?topic=126584.0

Can anyone help please?
Reply
#2

You didn't open the file of the player.

Assuming you use the .ini extension, use this.
pawn Код:
new name[MAX_PLAYER_NAME];
format(file, sizeof(file), "%s.ini", name);
Reply
#3

Quote:
Originally Posted by WESTre
You didn't open the file of the player.

Assuming you use the .ini extension, use this.
pawn Код:
new name[MAX_PLAYER_NAME];
format(file, sizeof(file), "%s.ini", name);
Thanks for the help
Reply
#4

I don't recommend using OnPlayerUpdate for saving stuff in files, it will cause a lot of lag because OnPlayerUpdate is called about 20 times per second, I recommend using a timer instead...

Here is the code if you need it:

pawn Код:
public OnPlayerConnect(playerid)
{
    //Set a timer for the player that repeats every 2 seconds to update the player's stats...
    SetPVarInt(playerid, "UpdateTimer", SetTimerEx("UpdatePlayer", 2000, true, "i", playerid));
}

public OnPlayerDisconnect(playerid)
{
    //Kill the update timer for the player...
    KillTimer(GetPVarInt(playerid, "UpdateTimer"));
}

//Called every 2 seconds for a player
stock UpdatePlayer(playerid)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "%s.ini", name);
    new uCash = GetPlayerMoney(playerid);
    dini_IntSet(file,"AdminLevel", PlayerInfo[playerid][AdminLevel]);
    dini_IntSet(file,"Cash", uCash);
    dini_IntSet(file,"Kills", PlayerInfo[playerid][pKills]);
    dini_IntSet(file,"Deaths", PlayerInfo[playerid][pDeaths]);
    dini_IntSet(file,"Locked", PlayerInfo[playerid][pLocked]);
    dini_IntSet(file,"Local", PlayerInfo[playerid][pLocal]);
    dini_IntSet(file,"Int", PlayerInfo[playerid][pInt]);
    return 1;
}
Reply
#5

http://forum.sa-mp.com/index.php?topic=171553.0

Is that the problem then pot?

Код:
error 017: undefined symbol "SetPVarInt" error 017: undefined symbol "GetPVarInt"
Reply
#6

Quote:
Originally Posted by kujox32
http://forum.sa-mp.com/index.php?topic=171553.0

Is that the problem then pot?

Код:
error 017: undefined symbol "SetPVarInt" error 017: undefined symbol "GetPVarInt"
You need the latest SA-MP server package (R7) Link: http://forum.sa-mp.com/index.php?topic=161491.0
I don't really think that's the problem in the video though, but the onplayerupdate callback will cause a lot of lag when saving shit every time its called so you should use the timer instead.
Reply
#7

Quote:
Originally Posted by [___
PotH3Ad ]
Quote:
Originally Posted by kujox32
http://forum.sa-mp.com/index.php?topic=171553.0

Is that the problem then pot?

Код:
error 017: undefined symbol "SetPVarInt" error 017: undefined symbol "GetPVarInt"
You need the latest SA-MP server package (R7) Link: http://forum.sa-mp.com/index.php?topic=161491.0
I don't really think that's the problem in the video though, but the onplayerupdate callback will cause a lot of lag when saving shit every time its called so you should use the timer instead.
Turns out that update was the problem lol xD Its fixed now tho thanks ,
Reply
#8

No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)