SA-MP Forums Archive
[DUV]Save the wanted levels - 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: [DUV]Save the wanted levels (/showthread.php?tid=111306)



[DUV]Save the wanted levels - nlcrp - 01.12.2009

Good night,
Could someone teach me
how can I save
the wanted levels
of peoples!
and when he relogin
return the wanted levels!
and wondered how he could make them appear as stars!


Re: [DUV]Save the wanted levels - Daniel_Truk - 01.12.2009

1 Learn scripting 2 make a login system with saving for wanted money etc.

/Cake


Re: [DUV]Save the wanted levels - miokie - 01.12.2009

Quote:
Originally Posted by Cake.
1 Learn scripting 2 make a login system with saving for wanted money etc.

/Cake
That was uphelpful...

But anyways, Look up Dini or Dudb, I find those most simplest when saving things.

use GetPlayerWantedLevel and SetPlayerWantedLevel aswell.


Re: [DUV]Save the wanted levels - Daniel_Truk - 01.12.2009

if he tries to search how to make Login system he will find it.


Re: [DUV]Save the wanted levels - miokie - 01.12.2009

Quote:
Originally Posted by Cake.
if he tries to search how to make Login system he will find it.
Yes, and that is what I said.

But you just said Learn to script... Pretty Nasty...
How would you like it if everybody Just said to you Learn to script when you have a problem?
It's quite obvious he is trying to learn.





Re: [DUV]Save the wanted levels - Almamu - 01.12.2009

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.