jail/unjail?!
#1

The problem is when i get jailed like for 1min (just an example) and use /unjail i get unjailed but when the 1min pass i get unjail again -.- any solution?! idk why it is bugged

Quote:

CMD:jail(playerid, params[])
{
new string[SOS], toplayerid, time, reason[SOS];
if(pInfo[playerid][Admin]<=0) return SendClientMessage(playerid, RED, "ERROR: You Aren't High Level Enough To Use This Command");
if(sscanf(params, "uis", toplayerid, time, reason)) return SendClientMessage(playerid, RED, "ERROR: /jail [ID] [Time] [Reason]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, RED, "The player is not connected");
SetPlayerInterior(toplayerid, 6);
SetPlayerPos(toplayerid, 264.6707,77.4835,1001.0391);
SetPlayerVirtualWorld(toplayerid, 97);
GameTextForPlayer(toplayerid, "~r~JAILED", 60000*time, 3);
format(string, SOS, "%s has been jailed for %i minute(s) by Administrator %s Reason: %s", pInfo[toplayerid][Name], time, pInfo[playerid][Name], reason);
SendClientMessageToAll(RED, string);
SetTimerEx("jail", 60000*time, false, "i", toplayerid);
pInfo[toplayerid][Jailed] = 1;
return 1;
}
forward jail(toplayerid);
public jail(toplayerid)
{
SpawnPlayer(toplayerid);
SetPlayerVirtualWorld(toplayerid, 0);
SetPlayerInterior(toplayerid, 0);
SendClientMessage(toplayerid, GREEN, "You have been unjailed!");
pInfo[toplayerid][Jailed] = 0;
return 1;
}

Quote:

CMD:unjail(playerid, params[])
{
new string[SOS], toplayerid;
if(pInfo[playerid][Admin]<=0) return SendClientMessage(playerid, RED, "ERROR: You Aren't High Level Enough To Use This Command");
if(sscanf(params, "u", toplayerid)) return SendClientMessage(playerid, RED, "ERROR: /unjail [ID]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, RED, "ERROR: The player isn't connected");
if(pInfo[toplayerid][Jailed] == 0) return SendClientMessage(playerid, RED, "ERROR: The Player isn't jailed");
if(pInfo[toplayerid][Jailed] == 1)
{
format(string, SOS, "You have unjailed %s", pInfo[toplayerid][Name]);
SendClientMessage(playerid, COLOR_WHITE, string);
GameTextForPlayer(toplayerid, "~r~UNJAILED", 3000, 3);
KillTimer(jail(toplayerid));
pInfo[toplayerid][Jailed]=0;
}
return 1;
}

these are the both cmds : http://pastebin.com/JXFzqScC too

another thing,i wanna make my /v cmd when someone doesn't type the color it spawns with random color
Quote:

CMD:vehicle(playerid, params[])
{
new Float, Float:y, Float:z, Float:a;
new vehicleid, color1, color2;
if(sscanf(params, "iii", vehicleid, color1, color2)) return SendClientMessage(playerid, RED, "ERROR: /v [Vehicle ID] [Color1] [Color2]");
if(vehicleid > 611 || vehicleid < 400) return SendClientMessage (playerid, RED, "ERROR: Vehcile ID Must Be Between 400 & 611");
GetPlayerPos(playerid, x, y ,z);
GetPlayerFacingAngle(playerid, a);
vehicleid = CreateVehicle(vehicleid, x, y, z, a, color1, color2, 60, 0);
PutPlayerInVehicle(playerid, vehicleid, 0);
return 1;
}

Reply
#2

I think /unjail its KillTimer isnt working properly because jail(topplayerid) isnt a correct definition for the timer.

SetTimerEx needs to have something like ;

jailtimer = SetTimerEx


then you could make KillTimer(jailtimer); wich should work
Reply
#3

Quote:
Originally Posted by AIped
Посмотреть сообщение
I think /unjail its KillTimer isnt working properly because jail(topplayerid) isnt a correct definition for the timer.

SetTimerEx needs to have something like ;

jailtimer = SetTimerEx


then you could make KillTimer(jailtimer); wich should work
can you show me an example or something like it ?! i think the killtimer isn't working fine.
Reply
#4

somewhere above your script do;

new jailtimer[MAX_PLAYERS];

then look into your jail command
there you see your SetTimerEx ..

make it jailtimer[playerid] = SetTimerEx("jail", 60000*time, false, "i", toplayerid);

then go to look into your unjail command

there is KillTimer

Make KillTimer(jailtimer[playerid] );

should work..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)