SA-MP Forums Archive
Anyone make /jail cmd for admins [ with my script enum] please +rep - 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: Anyone make /jail cmd for admins [ with my script enum] please +rep (/showthread.php?tid=529835)



Anyone make /jail cmd for admins [ with my script enum] please +rep - SpikY_ - 04.08.2014

i need Jail command with my script enum.

Jail CMD:
when we type /jail id reason..Then show client msg to all and player teleported to this co-ordinates [ 940.4175,2480.6018,605.7997 ]

And when he try to teleport while in jail Then show him "You cannot use this command in jail."

Unjail CMD:
When we unjail someone /unjail id.. Then show client msg to all.
and setplayerpos to this co-ordinates [392.8895,2444.1650,16.5000]

ENUM:
Код:
enum pInfo
{
    Password[129],
//  RegID,
    Admin,
    VIP,
    AltName[26],
    RegOn[20],
    Cash,
    Score,
    Spawned,
    LoginFail,
    LoggedIn,
    Goto,
    isAFK,
    inDM,
    inMini,
    inDMZone,
    Float:POS_X,
    Float:POS_Y,
    Float:POS_Z,
    Skin,
    Color,
    WeaponSet,
    DisablePMs,
    Muted,
    Kills,
    Deaths,
    Hours,
    Minutes,
    BanExpire,
    GodEnabled,
    Helmet,
    pSpawnVehicle,
    BanReason[32],
    BanPerm,
    BanAdmin[26]
}

new PlayerInfo[MAX_PLAYERS][pInfo];
Thanks for helping in Advance.

+rep for replying


Re: Anyone make /jail cmd for admins [ with my script enum] please +rep - GeekSiMo - 04.08.2014

First Add Jailed:
pawn Код:
enum pInfo
{
    Password[129],
//  RegID,
    Admin,
    Jailed,
    VIP,
    AltName[26],
    RegOn[20],
    Cash,
    Score,
    Spawned,
    LoginFail,
    LoggedIn,
    Goto,
    isAFK,
    inDM,
    inMini,
    inDMZone,
    Float:POS_X,
    Float:POS_Y,
    Float:POS_Z,
    Skin,
    Color,
    WeaponSet,
    DisablePMs,
    Muted,
    Kills,
    Deaths,
    Hours,
    Minutes,
    BanExpire,
    GodEnabled,
    Helmet,
    pSpawnVehicle,
    BanReason[32],
    BanPerm,
    BanAdmin[26]
}
pawn Код:
CMD:unjail(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        new targetid, name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], string[128];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /unjail [playerid]");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: invalid playerid");
        PlayerInfo[targetid][Jailed] = false;
        SpawnPlayer(targetid);
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string, sizeof(string), "ADMIN-UNJAIL: %s has been Unjailed by Administrator %s", tname, name);
        SendClientMessageToAll(BANNEDMESSAGE, string);
        KillTimer(UnjailTimer[targetid]);
        SendCommandToAdmins(playerid,"/unjail");
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 1 to use this command");
    return 1;
}
CMD:jail(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        new targetid, name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], reason[128], time, string[128];
        if(sscanf(params, "uds[128]", targetid, time, reason)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /jail [playerid] [jailtime in minutes] [reason]");
        if(time >= 10 || time < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: minimum amount of time is 1 minute, maximum amount of time is 10 minutes");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: invalid playerid");
        SetPlayerPos(targetid, 197.6661,173.8179,1003.0234);
        PlayerInfo[targetid][Jailed] = true;
        SetPlayerInterior(targetid, 3);
        GetPlayerName(playerid, name, sizeof(name));
        SendCommandToAdmins(playerid,"/jail");
        new Minutes = time*1000*60;
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string, sizeof(string), "ADMIN-JAIL: %s has been jailed by %s for %d Minutes(Reason: %s)", tname, name, time, reason);
        SendClientMessageToAll(BANNEDMESSAGE, string);
        UnjailTimer[targetid] = SetTimerEx("UnjailPlayer",Minutes,0,"d",targetid);
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be atleast Admin Level 1 to use this command");
    return 1;
}
forward UnjailPlayer(targetid);
public UnjailPlayer(targetid)
{
    if(PlayerInfo[targetid][Jailed] == false) return 1;
    if(PlayerInfo[targetid][Jailed] == true)
    {
        SpawnPlayer(targetid);
        new tname[MAX_PLAYER_NAME], string[128];
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string, sizeof(string), "SERVER-UNJAIL: %s has been automatically unjailed", tname);
        SendClientMessageToAll(BANNEDMESSAGE, string);
        KillTimer(UnjailTimer[targetid]);
        PlayerInfo[targetid][Jailed] = false;
    }
    return 1;
}



Re: Anyone make /jail cmd for admins [ with my script enum] please +rep - SpikY_ - 04.08.2014

first let me check


Re: Anyone make /jail cmd for admins [ with my script enum] please +rep - SpikY_ - 04.08.2014

when i copy paste tht codes .. so its show me codes like this

Код:
CMD:unjail(playerid, params[]){ if(PlayerInfo[playerid][AdminLevel] >= 1) { new targetid, name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], string[128]; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /unjail [playerid]"); if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: invalid playerid"); PlayerInfo[targetid][Jailed] = false; SpawnPlayer(targetid); GetPlayerNam



Re: Anyone make /jail cmd for admins [ with my script enum] please +rep - PrivatioBoni - 04.08.2014

Copy it into Microsoft Word or Wordpad and then into your script.