[DUV]Save the wanted levels
#6

Try with this(you need dini include).
Код:
#define USER_WANTED_FOLDER "Users/Wanted/%s"

public OnPlayerDisconnect(playerid, reason){
	new WantedLevel = GetPlayerWantedLevel(playerid);
	new string[256];
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(string, sizeof(string), USER_WANTED_FOLDER, pName);
	if(!dini_Exists(string)){
		dini_Create(string);
		dini_Set(string, "WantedLevel", WantedLevel);
	}else{
		dini_Set(string, "WantedLevel", WantedLevel);
	}
	return 1;
}
If you want to read it and re-set it when the player connects, use this:
Код:
public OnPlayerConnect(playerid){
	new string[256];
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(string, sizeof(string), USER_WANTED_FOLDER, pName);
	if(dini_Exists(string)){
		new WantedLevel = dini_Set(string, "WantedLevel", WantedLevel);
		SetPlayerWantedLevel(playerid, WantedLevel);
	}
	return 1;
}
I no tested the code in pawno, but it will work...
Before test the gamemode go to scriptfiles and create a folder named Users and then another one named Wanted inside Users.
Reply


Messages In This Thread
[DUV]Save the wanted levels - by nlcrp - 01.12.2009, 00:29
Re: [DUV]Save the wanted levels - by Daniel_Truk - 01.12.2009, 12:39
Re: [DUV]Save the wanted levels - by miokie - 01.12.2009, 12:42
Re: [DUV]Save the wanted levels - by Daniel_Truk - 01.12.2009, 12:55
Re: [DUV]Save the wanted levels - by miokie - 01.12.2009, 13:16
Re: [DUV]Save the wanted levels - by Almamu - 01.12.2009, 15:07

Forum Jump:


Users browsing this thread: 1 Guest(s)