SA-MP Forums Archive
Saveing Variables? - 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)
+--- Thread: Saveing Variables? (/showthread.php?tid=351031)



Saveing Variables? - Mike97300 - 14.06.2012

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?


Re: Saveing Variables? - mincer1667 - 14.06.2012

save it when gamemode exits


Re: Saveing Variables? - Mike97300 - 14.06.2012

Yes, but how do you do that?


Re: Saveing Variables? - mincer1667 - 14.06.2012

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



Re: Saveing Variables? - Mike97300 - 14.06.2012

Should I put something in the comment area?


Re: Saveing Variables? - mincer1667 - 14.06.2012

yes the saving variable like you have when player leave server


Re: Saveing Variables? - Mike97300 - 14.06.2012

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;
}



Re: Saveing Variables? - WillyP - 14.06.2012

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!


Re: Saveing Variables? - Mike97300 - 14.06.2012

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


Re: Saveing Variables? - zombieking - 14.06.2012

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;
}