Jail cmd
#1

Is there any jail cmd i tryed searching alround for one cant seem to find any i just want a simple cmd no like filter script or such any help?
here is one of the admin cmds i use
pawn Код:
if(strcmp(cmd, "/ban", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /ban (id/name) (reason)");
                return 1;
            }
            new giveplayerid;
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerNPC(giveplayerid)) return 1;
            if(PInfo[playerid][AdminLevel] >= 1)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[156];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_SECURITY, "Syntax: /ban (id/name) (reason)");
                            return 1;
                        }
                        PlaySound(0);
                        PlayerPlaySound(giveplayerid, 1190, 0, 0, 0); //Send a slap sound to the victim for lulz.
                        new date,month,year;
                        getdate(date,month,year);
                        new hour,minute,second;
                        gettime(hour,minute,second);
                        format(string, sizeof(string), "{FFFFFF}Administrator {FF9900}%s(%d){FFFFFF} has banned {FF9900}%s(%d){FFFFFF} • {FF9900}[Reason: %s]", PlayerName(playerid), playerid, PlayerName(giveplayerid), giveplayerid, (result));
                        SendClientMessageToAll(COLOR_BLUE, string);
                        PInfo[giveplayerid][Banned] = 1;
                        GettingBanned[giveplayerid] = 1;
                        new Name[MAX_PLAYER_NAME];
                        new plrIP[25];
                        new query[256];
                        //new date2[128];
                        //format(date2, sizeof(date2), "%d/%d/%d", year,month,date);
                        GetPlayerName(giveplayerid,Name,sizeof(Name));
                        GetPlayerName(playerid,sendername,sizeof(sendername));
                        GetPlayerIp(giveplayerid, plrIP, sizeof(plrIP));
                        mysql_real_escape_string(Name,Name);
                        mysql_real_escape_string((result),(result));
                        mysql_real_escape_string(sendername,sendername);
                        mysql_real_escape_string(plrIP,plrIP);
                        format(query,sizeof(query),"INSERT INTO `bans` (Username, Reason, Administrator, IP, Date, Time) VALUES ('%s','%s','%s','%s','%d/%d/%d','%d:%d:%d')",Name,(result),sendername,plrIP,year,month,date,hour,minute,second);
                        mysql_reconnect();
                        mysql_query(query);
                        AdminLog(playerid, "/ban", (result), Name);
                        Kick(giveplayerid);
                        return 1;
                    }
                }
                else
                {
                    format(string, sizeof(string), "Could not find player (%d)", giveplayerid);
                    SendClientMessage(playerid, COLOR_ERROR, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
            }
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_ERROR, "Unknown command, please type /help for a list of available commands to use.");
}
Reply
#2

pawn Код:
if(strcmp(cmd, "/jail", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [minutes] [reason]");
                return 1;
            }
            new playa;
            new time;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            time = strvalEx(tmp);
            if(PlayerInfo[playerid][pAdmin] >= 2)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [minutes] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s has been jailed by an Admin, reason: %s", giveplayer, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        ClearGuns(playa);
                        ResetPlayerWeapons(playa);
                        PlayerInfo[playa][pWantedLevel] = 0;
                        SetPlayerWantedLevel(playa, 0);
                        SetPlayerToTeamColor(playa);
                        PlayerInfo[playa][pJailed] = 1;
                        PlayerInfo[playa][pJailTime] = time*60;
                        SetPlayerInterior(playa, 6);
                        SetPlayerVirtualWorld(playerid, 0);
                        PlayerInfo[giveplayerid][pVirtualWorld] = 0;
                        SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
                        SetPlayerFacingAngle(playa, -90);
                        format(string, sizeof(string), "You are jailed for %d minutes.   Bail: Unable", time);
                        SendClientMessage(playa, COLOR_LIGHTBLUE, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
            }
        }
        return 1;
    }
pawn Код:
//JAIL
        if(PlayerInfo[playerid][pJailed] == 1)
        {
            HideArea(playerid);
            SetPlayerInterior(playerid, 6);
            SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
            SetCameraBehindPlayer(playerid);
            SetPlayerFacingAngle( playerid, -90);
            SetPlayerToTeamColor(playerid);
            CanTalk[playerid] = 1;
            return 1;
        }
Might have to rewrite it a bit to fit into your gamemode.
Reply
#3

You can remove this....

if(IsPlayerConnected(playerid)) completely useless check obviously the player is connected if they are typing the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)