All pastes #451212 Raw Edit

/jail

public text v1 · immutable
·published 2007-04-21 09:56 UTC
rendered paste body
There have been some people confused as to how to make a jail / unjail script recently and i used to be one of them
I prepared one which is ready to use (just paste it into your script) simple and easy to use. have fun :D



if(strcmp(cmd, "/jail", true) == 0) {
             new tmp[256];
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) {
                        SendClientMessage(playerid, COLOR_ORANGE, "Usage: /jail [Player ID]");
                        return 1;
                }
        giveplayerid = strval(tmp);

        if (gTeam[playerid] == TEAM_COP) {                    // this can be changed to admin if you wish
            if (IsPlayerConnected(giveplayerid)) {
                      GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "You have jailed %s (ID:%d)", giveplayer, giveplayerid);
                                SendClientMessage(playerid, COLOR_GREEN, string);
                                format(string, sizeof(string), "You have been jailed by Admin %s (ID:%d)!", sendername, playerid);
                                SendClientMessage(giveplayerid, COLOR_RED, string);
                                format(string, sizeof(string), "%s (ID:%d) has been jailed by Admin %s (ID:%d)", giveplayer, giveplayerid, sendername, playerid);
                                SendClientMessageToAll(COLOR_LIGHTBLUE, string);
                                printf(string);
                                SetPlayerInterior(giveplayerid,3);
                                SetPlayerPos(giveplayerid,198.3797,160.8905,1003.0300);
                                SetPlayerFacingAngle(giveplayerid,177.0350);
                                SetCameraBehindPlayer(giveplayerid);
                                PlayerPlaySound(giveplayerid,1082,198.3797,160.8905,1003.0300);
                                TogglePlayerControllable(giveplayerid,0);   // sp that can't /kill
                                DisablePlayerCheckpoint(giveplayerid);
                                return 1;
                                        }else{
        format(string, sizeof(string), "id %d is not an active player.", giveplayerid);
                                SendClientMessage(playerid, COLOR_YELLOW, string);
}
                }else{
        format(string, sizeof(string), "SERVER: Cops only.", giveplayerid);
                                SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}