Jail system bug
#1

Heya there guys, I have some minor and weird bug, this is it:
This is my Jail CMD:
PHP Code:
CMD:jail(playeridparams[])
{
    if(!
IsAllowed(playerid2)) return NoAuth(playerid);
    new 
playerbtime;
    if(
sscanf(params"uds[128]"playerbtimeparams)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /jail [playerid] [minutes] [reason]");
    if(!
PlayerInfo[playerb][pLoggedIn]) return SendClientMessage(playeridCOLOR_WHITE"Invalid ID.");
    if(
IsImmune(playeridplayerb)) return NotImmune(playerid);
    if(!
time) return SendClientMessage(playeridCOLOR_WHITE"Time should be higher than 0.");
    new 
string[248], rc random(1);
    
format(stringsizeof(string), "%s %s has jailed %s for %d minutes, Reason: %s"RPARN(playerid), RPN(playerid), RPN(playerb), timeparams);
    
SendClientMessageToAll(COLOR_REDstring);
    
ResetNexWeapons(playerb);
    
SetPlayerInterior(playerb6);
    switch(
rc)
    {
        case 
0SetPlayerPos(playerb264.317281.97941001.0391);
        case 
1SetPlayerPos(playerb264.536786.50321001.0391);
    }
    
SetPlayerVirtualWorld(playerbplayerb++);
    
Jailed[playerb] = time 60;
    
Log("logs/jails.log"string);
    return 
1;

OnPlayerText & Command Received
PHP Code:
    if(Jailed[playerid])
    {
        
format(stringsizeof(string), "You cannot send messages when you are jailed, you have %d minutes left."Jailed[playerid] / 60);
        
SendClientMessage(playeridCOLOR_REDstring);
        return 
0;
    } 
PHP Code:
        if(Jailed[playerid])
        {
            
format(stringsizeof(string), "You cannot perform commands when you are jailed, you have %d minutes left."Jailed[playerid] / 60);
            
SendClientMessage(playeridCOLOR_REDstring);
            return 
0;
        } 
This is my mute CMD:
PHP Code:
CMD:mute(playeridparams[])
{
    if(!
Iter_Contains(Adminsplayerid)) return NoAuth(playerid);
    new 
playerbtime;
    if(
sscanf(params"uds[128]"playerbtimeparams)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /mute [playerid] [minutes] [reason]");
    if(!
PlayerInfo[playerb][pLoggedIn]) return SendClientMessage(playeridCOLOR_WHITE"Invalid ID.");
    if(
IsImmune(playeridplayerb)) return NotImmune(playerid);
    if(
Muted[playerb]) return SendClientMessage(playeridCOLOR_GREY"This player is already muted.");
    if(!
time) return SendClientMessage(playeridCOLOR_WHITE"Time should be higher than 0.");
    
Muted[playerb] = time 60;
    new 
string[128];
    
format(stringsizeof(string), "AdmCmd: %s %s has muted %s for %d minutes, Reason: %s"RPARN(playerid), RPN(playerid), RPN(playerb), timeparams);
    
SendClientMessageToAll(COLOR_REDstring);
    
Log("logs/mute.log"string);
    return 
1;

Time reducement:
PHP Code:
forward Punishment();
public 
Punishment()
{
    foreach(new 
Player)
    {
        if(
Muted[i])
        {
            
Muted[i]--;
            if(!
Muted[i]) SendClientMessage(iCOLOR_RED"You have been automatically unmuted.");
        }
        if(
RMute[i])
        {
            
RMute[i]--;
            if(!
RMute[i]) SendClientMessage(iCOLOR_RED"You have been automatically report-unmuted.");
        }
        if(
Jailed[i])
        {
            
Jailed[i]--;
            if(!
Jailed[i]) SendClientMessage(iCOLOR_RED"You have been automatically released from prison."); SpawnPlayer(i);
        }
    }
    return 
1;

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

Anyone?
Reply
#3

Try using OnPlayerCommandPerformed...

As the name of the callback states, OnPlayerCommandReceived is called when the command is 'received'..
Reply
#4

Quote:
Originally Posted by Threshold
View Post
Try using OnPlayerCommandPerformed...

As the name of the callback states, OnPlayerCommandReceived is called when the command is 'received'..
It works just fine when I'm muting
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)