Load a level with a command?
#1

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

Show me the code of OnPlayerDisconnect
Reply
#3

Okay, here is the public OnPlayerDisconnect:

http://pastebin.ca/1485726
Reply
#4

So where does it save it in the file?
Reply
#5

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

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

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

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

dUserSetInit("level"5);
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)