Help -
JakeHunter1 - 30.05.2014
How can i make a command that jails players and they can't get out with relog they will get out when the time is gone .. If somone have the command please give me it and instructions ..
Re : Help -
S4t3K - 30.05.2014
Create a boolean variable that you set to true when you jail a player.
Save the var in the player stats, load it when the player connects, and when he connects, if it's "true", re-jail him.
Set the var to "false" when you unjail the player.
Re: Re : Help -
JFF - 30.05.2014
Quote:
Originally Posted by S4t3K
Create a boolean variable that you set to true when you jail a player.
Save the var in the player stats, load it when the player connects, and when he connects, if it's "true", re-jail him.
Set the var to "false" when you unjail the player.
|
It shouldnt be a boolean var
it should be a normal var that saves the time for example
pawn Код:
new jailtime[MAX_PLAYERS];
when u jail him set the jail time with this var like if u wanna jail him for 30 seconds do
create a timer that repeat every second
if the jailtime > 0 then do jailtime --; to decrease the jail time
and when jailtime = 0 release him
when the player disconnect save the jailtime var
and when he connects load the jailtime var.
now when he spawns check if the jailtime var of the player is higher than 0 if yes set him in jail.
Re : Help -
S4t3K - 30.05.2014
In my mind, it would be
PHP код:
new bool:jailed;
if(jailed) // Save the var to 1 in the player stats
else // Save the var to 0 in the player stats
Another method working, which reffer to yours but which wastes less performances : (I consider that the "time" var already contains the jailtime in minutes)
PHP код:
new jailtime[MAX_PLAYERS] = 0;
// In the jail command
jailtime[targetid] = gettime() + time*60; // If time is already in seconds, don't multiply per 60
// Save the jailtime var in the targetid stats, and when he connects, after data loading
if(jailtime[playerid] > gettime()) Jail(playerid);
I guess you know the gettime() function, so of course it's better performances than setting a timer whichs repeats every seconds.
Re: Help -
JakeHunter1 - 30.05.2014
i didn't understand nothing im a begginer :S Can somone meke it for me i now to set cordinates .. and with instructions ..
Re : Help -
S4t3K - 30.05.2014
I won't make a ready-made code, and I hope nobody will.
Instead, try to make it by yourself :
gettime +
SetPlayerPos + eventually
SetPlayerVirtualWorld will do the job.
For the saving system, I recommend you either y_ini or djson for ini systems, or BlueG's mysql plugin (now developped by Pain123/Maddinat0r) for the mysql.
Re: Help -
JakeHunter1 - 30.05.2014
Okey , i make it and now how to make when he will get out from jail to spawn ?
Re : Help -
S4t3K - 30.05.2014
Then use a timer.
When you jail him, use
SetTimerEx to call a function which will unjail the player.
Re: Re : Help -
JakeHunter1 - 30.05.2014
Quote:
Originally Posted by S4t3K
Then use a timer.
When you jail him, use SetTimerEx to call a function which will unjail the player.
|
Spawn location not that ..
Re : Help -
S4t3K - 30.05.2014
Oh, if you want to set him to his pre-jail position, simply get and store the position of the player before jailing him, in a global var or a static one.