SA-MP Forums Archive
Saving my variable? - 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: Saving my variable? (/showthread.php?tid=267621)



Saving my variable? - lawonama - 09.07.2011

I have this:

pawn Код:
new admin[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
admin[playerid] = 0;
}
pawn Код:
if (strcmp("/makemeadmin", cmdtext, true) == 0)
{
    if (IsPlayerAdmin(playerid))
    {
        if (admin[playerid] == 1)
        {
            SendClientMessage(playerid,COLOR_RED,"You are already an admin!");
        }
        else
        {
            admin[playerid] = 1;
            SendClientMessage(playerid,COLOR_GREEN,"You became an admin!");
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You must be logged on in RCON!");
    }
}
But how to: When he quits the variable saves. I searched but couldn't find anything good.


Re: Saving my variable? - lawonama - 09.07.2011

@[HLF]Southclaw ; Dont post to get +1 post!. If you won't help dont post anything. Everyone knows i need to save it to a file and i tried to search but nothing found. Go post your "Not Helping' messages somewhere else.


Re: Saving my variable? - lawonama - 09.07.2011

I'm using at the moment Dini. Still thanks for your helps


Re: Saving my variable? - Pghpunkid - 09.07.2011

Quote:
Originally Posted by lawonama
Посмотреть сообщение
@[HLF]Southclaw ; Dont post to get +1 post!. If you won't help dont post anything. Everyone knows i need to save it to a file and i tried to search but nothing found. Go post your "Not Helping' messages somewhere else.
Your asking for information that has been provided on the forums before, without a doubt. You asked how, you never said in your first post that you knew you had to write to file.. so if you want help, don't bite the hand that feeds.

Next time try searching so nobody needs to increase post counts.


Re: Saving my variable? - jameskmonger - 09.07.2011

@lawonama ; POSTING WHAT YOU ARE USING DOES NOT HELP, WHY POST TO GET +1 POST?!!?!??!?!?!?!?!


Re: Saving my variable? - lawonama - 09.07.2011

jameskmonger It does help. Else how can they know what i am doing. Now if you don't want to help exit my thread please.


Re: Saving my variable? - lawonama - 09.07.2011

Look, sorry that i snapped on you, but im using dini.
I've code like this:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
dini_IntSet(file, "admin", adminlevel[playerid]);
return 1;
}
But i get several errors:
Код:
C:\Documents and Settings\DELL\Desktop\Prisonbreak.pwn(291) : error 017: undefined symbol "adminlevel"
C:\Documents and Settings\DELL\Desktop\Prisonbreak.pwn(291) : warning 215: expression has no effect
C:\Documents and Settings\DELL\Desktop\Prisonbreak.pwn(291) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\DELL\Desktop\Prisonbreak.pwn(291) : error 029: invalid expression, assumed zero
C:\Documents and Settings\DELL\Desktop\Prisonbreak.pwn(291) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Line 291 = dini_IntSet(file, "admin", adminlevel[playerid]);


Re: Saving my variable? - lawonama - 09.07.2011

You mean this?
pawn Код:
new admin[MAX_PLAYERS];



Re: Saving my variable? - Pghpunkid - 09.07.2011

Quote:
Originally Posted by lawonama
Посмотреть сообщение
You mean this?
pawn Код:
new admin[MAX_PLAYERS];
change adminlevel to admin perhaps? seeing as your giving us 2 different variables....


Re: Saving my variable? - lawonama - 09.07.2011

Wow thanks man! I forgot that.
Changed it to : dini_IntSet(file, "admin", admin[playerid]); and it works!