Help With Cage!?
#1

What I want to as you here is how do I make so:

1. When the player is caged he can't use commands.

2. When the player is caged and he leaves the server, he comes back in the cage .

Here Are The Cage Commands:
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

forward UnCage(playerid);

new Cage[MAX_PLAYERS][6];
new Caged[MAX_PLAYERS];

public UnCage(playerid) {
    new ReturnName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, ReturnName, sizeof(ReturnName));
    format(szString, sizeof(szString), "*** SERVER UNCAGE: %s (%i) Has Been Automatically UnCaged - Cage Time Ended!", ReturnName, playerid);
    SendClientMessageToAll(COLOR_RED, szString);
    Caged[playerid] = 0;
    Cage[playerid][0] = DestroyObject(Cage[playerid][0]);
    Cage[playerid][1] = DestroyObject(Cage[playerid][1]);
    Cage[playerid][2] = DestroyObject(Cage[playerid][2]);
    Cage[playerid][3] = DestroyObject(Cage[playerid][3]);
    Cage[playerid][4] = DestroyObject(Cage[playerid][4]);
    Cage[playerid][5] = DestroyObject(Cage[playerid][5]);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    SpawnPlayer(playerid);
    SetPlayerHealth(playerid, 100);
    KillTimer(CageTimer[playerid]);
    return 1;
}

CMD:cage(playerid, params[])
{
    new str[128], id, reason[128], time, Float:x, Float:y, Float:z;
    if(pInfo[playerid][pAdmin] >= 2)
    {
        if(sscanf(params, "uds[128]", id,time,reason)) return SendClientMessage(playerid, COLOR_RED, "* USAGE: /cage (PlayerID) (Time) (Reason)");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* You Have Entered An Invaid Player ID! Try Again...");
        if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You Can't Use This Command On Yourself!");
        if(pInfo[playerid][pAdmin] < pInfo[id][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "* You Can't Use This Command On A Higher Level Admin!");
        if(pInfo[playerid][pCaged] == 1) return SendClientMessage(playerid, COLOR_RED, "* ERROR: Player Already Caged!");
        GetPlayerPos(id, x, y, z);
        format(str, sizeof(str), "*** ADMIN CAGE: %s (%d) Has Been Caged For %d Minute/s - Reason: %s!", GetName(id), id, time, reason);
        SendClientMessageToAll(COLOR_RED, str);
        format(str, sizeof(str), "You Caged %s (%d) For %d Minute/s - Reason: %s!", GetName(id), id, time, reason);
        SendClientMessage(playerid, COLOR_RED, str);
        pInfo[playerid][pCaged] = 1;
        ResetPlayerWeapons(id);
        SetPlayerHealth(id, 9999999999.0);
        GetPlayerPos(playerid, x, y, z);
        SetPlayerPos(playerid, x, y, z+5);
        Cage[id][0]  = CreateObject(985, x, y+4, z+5, 0.0, 0.0, 0.0);
        Cage[id][1] = CreateObject(985, x+4, y, z+5, 0.0, 0.0, 90.0);
        Cage[id][2] = CreateObject(985, x-4, y, z+5, 0.0, 0.0, 270.0);
        Cage[id][3] = CreateObject(985, x, y-4, z+5, 0.0, 0.0, 180.0);
        Cage[id][4] = CreateObject(985, x, y+1.8, z+3.5, 90.0, 0.0, 0);
        Cage[id][5]= CreateObject(985, x, y+1.8, z+10, 90.0, 0.0, 0);
        CageTimer[id] = SetTimerEx("UnCage",time*60000, false, "i", id);
    }
    return 1;
}

CMD:uncage(playerid, params[])
{
    new str[128], id;
    if(pInfo[playerid][pAdmin] >= 2)
    {
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "* USAGE: /uncage (id)");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "* You Have Entered An Invaid Player ID! Try Again...");
        if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "* You Can't Use This Command On Yourself!");
        if(pInfo[playerid][pCaged] == 0) return SendClientMessage(playerid, COLOR_RED, "* ERROR: Player Not Caged!");
        format(str, sizeof(str), "*** ADMIN UNCAGE: %s (%d) Has Been UnCaged!", GetName(playerid), playerid, GetName(id), id);
        SendClientMessageToAll(COLOR_YELLOW, str);
        format(str, sizeof(str), "You UnCaged %s (%d)", GetName(id), id);
        SendClientMessage(playerid, COLOR_RED, str);
        pInfo[id][pCaged] = 0;
        Cage[playerid][0] = DestroyObject(Cage[playerid][0]);
        Cage[playerid][1] = DestroyObject(Cage[playerid][1]);
        Cage[playerid][2] = DestroyObject(Cage[playerid][2]);
        Cage[playerid][3] = DestroyObject(Cage[playerid][3]);
        Cage[playerid][4] = DestroyObject(Cage[playerid][4]);
        Cage[playerid][5] = DestroyObject(Cage[playerid][5]);
        SetPlayerInterior(id, 0);
        SetPlayerVirtualWorld(id, 0);
        SpawnPlayer(id);
        SetPlayerHealth(id, 100);
        KillTimer(CageTimer[id]);
    }
    return 1;
}
!!!!!THANKS IN ADVANCE!!!!!
Reply
#2

The commamds are working, I just need some one to help me add this things.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)