[DUV]Save the wanted levels
#1

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

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

/Cake
Reply
#3

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.
Reply
#4

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

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.


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


Forum Jump:


Users browsing this thread: 2 Guest(s)