SA-MP Forums Archive
Load a level with a command? - 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: Load a level with a command? (/showthread.php?tid=85234)



Load a level with a command? - anumaz - 06.07.2009

I just started this script:

Код:
	if(strcmp(cmd, "/loadmylevel", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
         PlayerInfo[playerid][pLevel] = I DON'T KNOW HERE;
      }
    }


public OnPlayerDisconnect(playerid, reason)
{
   [SOMETHING HERE]
}
What I mean, is that, when he disconnects from the server, it saves his level (pLevel) in a .txt with his name (like, Test_Test.txt contains the number 3 in the file), and when he reconnects, he types /loadmylevel and then the number that is written in the file will be his level, and the file will be erased too.

ty


Re: Load a level with a command? - GTA_Rules - 06.07.2009

Show me the code of OnPlayerDisconnect


Re: Load a level with a command? - anumaz - 06.07.2009

Okay, here is the public OnPlayerDisconnect:

http://pastebin.ca/1485726


Re: Load a level with a command? - GTA_Rules - 06.07.2009

So where does it save it in the file?


Re: Load a level with a command? - anumaz - 06.07.2009

Well, when the player disconnects, it saves in a file named Player_Name.txt a number, which is his level.

It's saved in Scriptfiles directory


Re: Load a level with a command? - GTA_Rules - 06.07.2009

I don't see any function in your OnPlayerDisconnect, that saves the level into a file.


Re: Load a level with a command? - anumaz - 06.07.2009

Quote:
Originally Posted by Matthias_
I don't see any function in your OnPlayerDisconnect, that saves the level into a file.
I know.. that's what I'm asking... read my first post


Re: Load a level with a command? - anumaz - 06.07.2009

What I need to know is how to load a .txt file and how to write something in it...


Re: Load a level with a command? - ByFukara - 06.07.2009

dUserSetInit("level"5);


Re: Load a level with a command? - anumaz - 06.07.2009

Quote:
Originally Posted by ByFukara
dUserSetInit("level"5);
uhh, where do I place that? In the /loadmylevel thing?