22.10.2016, 23:02
Heya there guys, I have some minor and weird bug, this is it:
This is my Jail CMD:
OnPlayerText & Command Received
This is my mute CMD:
Time reducement:
The Mute system works JUST fine but the Jail system is bugged, I am sent to the cell but I can still perform commands and send messages, anyone ?
This is my Jail CMD:
PHP Code:
CMD:jail(playerid, params[])
{
if(!IsAllowed(playerid, 2)) return NoAuth(playerid);
new playerb, time;
if(sscanf(params, "uds[128]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid] [minutes] [reason]");
if(!PlayerInfo[playerb][pLoggedIn]) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID.");
if(IsImmune(playerid, playerb)) return NotImmune(playerid);
if(!time) return SendClientMessage(playerid, COLOR_WHITE, "Time should be higher than 0.");
new string[248], rc = random(1);
format(string, sizeof(string), "%s %s has jailed %s for %d minutes, Reason: %s", RPARN(playerid), RPN(playerid), RPN(playerb), time, params);
SendClientMessageToAll(COLOR_RED, string);
ResetNexWeapons(playerb);
SetPlayerInterior(playerb, 6);
switch(rc)
{
case 0: SetPlayerPos(playerb, 264.3172, 81.9794, 1001.0391);
case 1: SetPlayerPos(playerb, 264.5367, 86.5032, 1001.0391);
}
SetPlayerVirtualWorld(playerb, playerb++);
Jailed[playerb] = time * 60;
Log("logs/jails.log", string);
return 1;
}
PHP Code:
if(Jailed[playerid])
{
format(string, sizeof(string), "You cannot send messages when you are jailed, you have %d minutes left.", Jailed[playerid] / 60);
SendClientMessage(playerid, COLOR_RED, string);
return 0;
}
PHP Code:
if(Jailed[playerid])
{
format(string, sizeof(string), "You cannot perform commands when you are jailed, you have %d minutes left.", Jailed[playerid] / 60);
SendClientMessage(playerid, COLOR_RED, string);
return 0;
}
PHP Code:
CMD:mute(playerid, params[])
{
if(!Iter_Contains(Admins, playerid)) return NoAuth(playerid);
new playerb, time;
if(sscanf(params, "uds[128]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mute [playerid] [minutes] [reason]");
if(!PlayerInfo[playerb][pLoggedIn]) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID.");
if(IsImmune(playerid, playerb)) return NotImmune(playerid);
if(Muted[playerb]) return SendClientMessage(playerid, COLOR_GREY, "This player is already muted.");
if(!time) return SendClientMessage(playerid, COLOR_WHITE, "Time should be higher than 0.");
Muted[playerb] = time * 60;
new string[128];
format(string, sizeof(string), "AdmCmd: %s %s has muted %s for %d minutes, Reason: %s", RPARN(playerid), RPN(playerid), RPN(playerb), time, params);
SendClientMessageToAll(COLOR_RED, string);
Log("logs/mute.log", string);
return 1;
}
PHP Code:
forward Punishment();
public Punishment()
{
foreach(new i : Player)
{
if(Muted[i])
{
Muted[i]--;
if(!Muted[i]) SendClientMessage(i, COLOR_RED, "You have been automatically unmuted.");
}
if(RMute[i])
{
RMute[i]--;
if(!RMute[i]) SendClientMessage(i, COLOR_RED, "You have been automatically report-unmuted.");
}
if(Jailed[i])
{
Jailed[i]--;
if(!Jailed[i]) SendClientMessage(i, COLOR_RED, "You have been automatically released from prison."); SpawnPlayer(i);
}
}
return 1;
}