How do I
#3

Variable.
pawn Код:
//Put it under the includes
Jailed[MAX_PLAYERS];
pawn Код:
CMD:jail(playerid, reason)
{
    if(pInfo[playerid][AdminLevel] < 2) return 0;
    {
    SendClientMessage(playerid, COLOR_RED, "-Warning- /Jail [Playername/id] [Reason]");
    return 1;
    }
    new id,pjailed;
    if(IsPlayerNPC(id))return SendClientMessage(playerid, COLOR_RED, "-Warning- This player is an Bot.");
    if(id == playerid)return SendClientMessage(playerid, COLOR_RED, "-Warning- You can't jail yourself.");
    if(Jailed[playerid] == 1)return SendClientMessage(playerid, COLOR_RED, "This player is already in jail.");
    new reason[128];
    reason = bigstrtok(cmdtext, idx);
    if(!strlen(reason)) return SendClientMessage(playerid, COLOR_RED, "-Warning- /Jail [playername/id] [Reason]",reason);
    JB_Playerinfo[targetid][JB_pJailed]=180;
    SetPlayerInterior(id, 6);
    SetPlayerPos(targetid, 264.3700,77.5700,1001.0391);
    SetPlayerFacingAngle(id, 272.6900);
    TogglePlayerControllable(id, false);
    ResetPlayerMoney(targetid);
    Jailed[playerid] = 1;
    new string[128];
    format(string,sizeof(string), "-AdminInfo- Admin %s has jailed %s [Reason: %d]",pName(playerid),GetName(targetid));
    SendClientMessageToAll(-1,string);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "-Warning- This player isn't online.");
    }
    }
    else SendClientMessage(id, COLOR_RED, "-Warning- You have to be level 2 for this command!");
    return 1;
}
Put this in Unjail cmd and under the callbacks OnPlayerSpawn,OnPlayerRequestClass and OnPlayerDeath to avoid bugs
pawn Код:
//Setting back the variable to 0
Jailed[playerid] = 0;
Reply


Messages In This Thread
How do I - by RieTzz - 11.02.2013, 16:52
Re: How do I - by Vexus - 11.02.2013, 16:55
Re: How do I - by DaRk_RaiN - 11.02.2013, 16:57
Re: How do I - by coakiddo - 11.02.2013, 16:57
Re: How do I - by RieTzz - 11.02.2013, 17:15
Re: How do I - by RieTzz - 11.02.2013, 18:16
Re: How do I - by MP2 - 11.02.2013, 18:41
Re: How do I - by RieTzz - 11.02.2013, 18:50

Forum Jump:


Users browsing this thread: 1 Guest(s)