Saveing Variables?
#1

Okay, well, I'm even sure if that's what they're called, but something like these

Код:
LSPDLeader[playerid] = 0;
    	 LSPDMember[playerid] = 0;
I understand that it saves when you logg off, but whenever the server restarts they reset? How do I save them?
Reply
#2

save it when gamemode exits
Reply
#3

Yes, but how do you do that?
Reply
#4

pawn Код:
public OnGameModeExit()
{
       for(new i = 0; i < MAX_PLAYERS; i++)
       {
             if(IsPlayerConnected(i)
             {
                  // save it here like on disconnect
             }
       }
       return 1;
}
Reply
#5

Should I put something in the comment area?
Reply
#6

yes the saving variable like you have when player leave server
Reply
#7

I get the following errors

Код:
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(187) : error 001: expected token: ")", but found "{"
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(188) : error 017: undefined symbol "playerid"
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(189) : error 017: undefined symbol "playerid"
My code

Код:
public OnGameModeExit()
{
	IRC_Quit(gBotID[0], "SA-MP bot exiting");
	IRC_DestroyGroup(gGroupID);
 	for(new i = 0; i < MAX_PLAYERS; i++)
       {
             if(IsPlayerConnected(i)
			 {
              LSPDLeader[playerid]
		      LSPDMember[playerid]
			 }
       }
	
	return 1;
}
Reply
#8

Come on man.. Read the errors? I understand you're learning but they're easy to fix if you read what the errors are saying!
Reply
#9

Okay, I did, I replace the curly braces with normal brackets and I get 100 errors, I tried to fix it.
Reply
#10

pawn Код:
public OnGameModeExit()
{
    IRC_Quit(gBotID[0], "SA-MP bot exiting");
    IRC_DestroyGroup(gGroupID);
    for(new i = 0; i < MAX_PLAYERS; i++)
       {
             if(IsPlayerConnected(i))
             {                      // You shouldn't save them like this , you should save them with SII ,Y_INI,dini)
              LSPDLeader[i]                // Because OnGameModeExit() - and not OnGameModeExit(playerid)
              LSPDMember[i]      // LSPDMember should have a value set, like LSPDMember[i] = 1; and same for lspdleader
             }
       }
   
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)