JAIL system
#1

Hey guys! I've made my own Jailsystem here, but I've obviously done something wrong! When a player kills another player, the 'killerid' gets jailed. But they never get unjailed! Only ID 0! no matter if id 0 did the kill or not. How can I fix this?

heres a bit of the code; ofc with forward...

Code:
 public UnJail(playerid, killerid)
{
    isJailed[playerid] = 0;
    isJailed[killerid] = 0;
	SetPlayerPos(killerid,-1898.6420,243.1353,41.0469);
	SendClientMessage(killerid, COLOR_LIGHTRED, ".: You have been released! :.");
    return 1;
}
Reply
#2

you use a timer?
Reply
#3

yes, 1 minute

EDIT;

Additional information, if it helps;

Code:
public OnPlayerDeath(playerid, killerid, reason)
{
		isJailed[killerid] = 1;
    	SetTimer("UnJail", 100000, false); //False because we wont repeat timer...True if repeat.
        SetPlayerPos(killerid,1760.0499,-1538.4115,9.3113);
        SendClientMessage(killerid, COLOR_LIGHTRED,".: It's NOT tolerated to kill anyone here! Therefore, You've been put to jail!");
        SendDeathMessage(killerid, playerid, reason);
        GivePlayerMoney(killerid, -10000);
        return 1;
Reply
#4

Yeah, show us where you SET, USE and CALL the function Unjail.
Reply
#5

I edited above;
+++
[on top of script];
Code:
new isJailed[MAX_PLAYERS];
forward UnJail(playerid, killerid);
Reply
#6

use
PHP Code:
SetTimerEx("UnJail"100000false"ii"killeridplayerid ); 
Reply
#7

Will that help against the problem i have? i mean, when players kill eachother, its all on id 0..
Reply
#8

As Mr_Zlodei said its SetTimerEx that works in this case.
Reply
#9

This happens because you haven't given a value to 'killerid' or 'playerid', which is why you use SetTimerEx, to give a value to the parameters of a function. In this case, killerid and playerid. As shown in Mr_Zlodei's post. https://sampwiki.blast.hk/wiki/SetTimerEx

EDIT: Why are you using a playerid parameter in the function anyway?

EDIT2: Below Post said it
Reply
#10

I really, really do not know much English and I can not really make out your text. But I understood the code exactly what you need and I will write the sample code to your function.
sorry for my bad english, I hope to understand everything
PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    if ( 
killerid != 0xFFFF )
    {
        
isJailed[killerid] = 1;
        
SetTimerEx("UnJail"100000false"i"killerid );
        
SetPlayerPos(killerid,1760.0499,-1538.4115,9.3113);
        
SendClientMessage(killeridCOLOR_LIGHTRED,".: It's NOT tolerated to kill anyone here! Therefore, You've been put to jail!");
        
SendDeathMessage(killeridplayeridreason);
        
GivePlayerMoney(killerid, -10000);
    }
    return 
1;
}
public 
UnJail(killerid)
{
    
isJailed[killerid] = 0;
    
SetPlayerPos(killerid,-1898.6420,243.1353,41.0469);
    
SendClientMessage(killeridCOLOR_LIGHTRED".: You have been released! :.");
    return 
1;

EDIT: 1 minute = 60,000 milliseconds, in your case (10000 milliseconds) = 1.6 minutes ....
I'm sure this is not so important
Reply
#11

Thanks guys! +REP to you both!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)