SetPVarInt
#1

I'm having some problems with SetPVarInt on my gamemode.

This is the code:
pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 4)
            {
                for(new i = 0; i < MAX_PLAYERS; i ++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(PlayerInfo[i][pPbiskey] == biz)
                        {
                            PlayerInfo[i][pPbiskey] = 255;
                        }
                        else
                        {
                            format(string, sizeof(string),"accounts/%s.ini",BizzInfo[biz][bOwner]);
                            SetPVarInt(BizzInfo[biz][bOwner], "Bizz", 255);
                        }
                    }
                }
if(PlayerInfo[i][pPbiskey] == biz) works fine when the owner of the biz is online on the server, but I have problems to set up on his .ini file when the owner of the biz is offline. It doesn't set up the "Bizz" line on 255.
Is this possible with pVar, if it is - what do I have to do?
Reply
#2

PVars are only for currently connected players, which is why you have to specify a player ID in the function.

Also I don't really understand your code, are you trying to use SetPVarInt as a file writing function?
Reply
#3

I want it to edit the "Bizz" line in .ini file of the registered player while that player is offline. So it goes from "Bizz = 0" to "Bizz = 255".
Reply
#4

Quote:
Originally Posted by Haxby
Посмотреть сообщение
I want it to edit the "Bizz" line in .ini file of the registered player while that player is offline. So it goes from "Bizz = 0" to "Bizz = 255".
You should be using some sort of ini parsing API then, not SetPVarInt, that has nothing to do with ini files!

You should take a look at the Y_ini or dini libraries.
Reply
#5

Ok, I thought there is a way with pVar...
Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)