Saving my variable?
#1

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

@[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.
Reply
#3

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

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

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 4 Guest(s)