SA-MP Forums Archive
Auto Jail - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Auto Jail (/showthread.php?tid=508192)



Auto Jail - ChuckyBabe - 20.04.2014

How to make an auto jail if,,,,, he kills a player in a defined place

and this message will come up

AdmCmd: %s has been jailed by AdminBot reason: Deathmatching


Re: Auto Jail - Ada32 - 20.04.2014

Quote:
Originally Posted by ChuckyBabe
he kills a player in a defined place
Quote:
Originally Posted by ChuckyBabe
and this message will come up
there. oh you mean code? you first


Re: Auto Jail - ChuckyBabe - 20.04.2014

Here is the sample of /jail command

pawn Код:
CMD:jail(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new
            iTargetID,
            szReason[64];

        if(sscanf(params, "us[64]", iTargetID, szReason)) {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /jail [playerid/partofname] [reason]");
        }
        else if(IsPlayerConnected(iTargetID)) {
            if(AdminDuty[iTargetID] == 1) {
                return SendClientMessage(playerid, COLOR_WHITE, "You can't perform this action on on-duty admins.");
            }
            if(PlayerInfo[iTargetID][pAdmin] >= PlayerInfo[playerid][pAdmin]) {
                return SendClientMessage(playerid, COLOR_WHITE, "You can't perform this action on equal or higher admins.");
            }

            //if(GetPVarInt(iTargetID, "PBM") > 0) LeavePaintballArena(iTargetID, GetPVarInt(iTargetID, "IsInArena"));

            new
                szMessage[128];

            ResetPlayerWeaponsEx(iTargetID);

            PlayerInfo[iTargetID][pJailed] = 3;
            PhoneOnline[iTargetID] = 1;
            PlayerInfo[iTargetID][pJailTime] = 20*60;

            TogglePlayerControllable(iTargetID, 0);
            for(new o = 0; o < 6; o++)
            {
                TextDrawShowForPlayer(iTargetID, ObjectsLoadingTD[o]);
            }
            SetPVarInt(iTargetID, "LoadingObjects", 1);
            SetTimerEx("SafeLoadObjects", 3000, 0, "d", iTargetID);

            SetPlayerInterior(iTargetID, 69);
            PlayerInfo[iTargetID][pVW] = 696969;
            PlayerInfo[iTargetID][pInt] = 69;
            SetPlayerVirtualWorld(iTargetID, 696969);
            new rand = random(sizeof(AdminPrisonFloat));
            SetPlayerPos(iTargetID, AdminPrisonFloat[rand][0], AdminPrisonFloat[rand][1], AdminPrisonFloat[rand][2]);

            format(szMessage, sizeof(szMessage), "AdmCmd: %s has been jailed by %s, reason: %s", GetPlayerNameEx(iTargetID), GetPlayerNameEx(playerid), szReason);
            SendClientMessageToAllEx(COLOR_LIGHTRED, szMessage);

            format(szMessage, sizeof(szMessage), "AdmCmd: %s has been jailed by %s, reason: %s", GetPlayerNameEx(iTargetID), GetPlayerNameEx(playerid), szReason);
            Log("logs/admin.log", szMessage);

            format(szMessage, sizeof(szMessage), "You have been jailed by Admin %s for 20 minutes, reason: %s.", GetPlayerNameEx(playerid), szReason);
            SendClientMessage(iTargetID, COLOR_LIGHTBLUE, szMessage);

            format(szMessage, sizeof(szMessage), "%s", szReason);
            SendClientMessage(iTargetID, COLOR_LIGHTBLUE, szMessage);

            strcpy(PlayerInfo[iTargetID][pPrisonedBy], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
            strcpy(PlayerInfo[iTargetID][pPrisonReason], szReason, 128);
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
        }
    }
    return 1;
}
If he kills in a defined place then he will be jailed


Re: Auto Jail - anou1 - 20.04.2014

Maybe with OnPlayerDeath and the killerid, you get his pos then do what you want