cage, uncage...
#1

So i got this:
pawn Код:
stock CagePlayer(playerid)
{
      if(IsPlayerConnected(playerid))
      {
      new Float:X, Float:Y, Float:Z;
      GetPlayerPos(playerid, X, Y, Z);
      cage[playerid] = CreateObject(985, X, Y+4, Z, 0.0, 0.0, 0.0);
      cage2[playerid] = CreateObject(985, X+4, Y, Z, 0.0, 0.0, 90.0);
      cage3[playerid] = CreateObject(985, X-4, Y, Z, 0.0, 0.0, 270.0);
      cage4[playerid] = CreateObject(985, X, Y-4, Z, 0.0, 0.0, 180.0);
      caged[playerid] = 1; // Use this in a /cage command to prevent being caged twice and causing the cage to be unremovable.
      PlayerPlaySound(playerid, 1137, X, Y, Z);
      }
}

stock UnCagePlayer(playerid)
{
      cage[playerid] = DestroyObject(cage[playerid]);
      cage2[playerid] = DestroyObject(cage2[playerid]);
      cage3[playerid] = DestroyObject(cage3[playerid]);
      cage4[playerid] = DestroyObject(cage4[playerid]);
      caged[playerid] = 0;
}
pawn Код:
CMD:cage(playerid, params[])
{
    new string[256], id, reason, PlayerName[MAX_PLAYER_NAME];
    if(PVar[playerid][pLevel] < 3) return
                                            SendClientMessage(playerid, COLOR_RED, "ERROR : You need to be administrator level 3 to use this command!");
                                            format(string, sizeof(string), "%s has used the command '/cage'");
                                            SendAdminMessage(COLOR_YELLOW, string);
    if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
    CagePlayer(id);
    CageTimer = SetTimer("UnCagePlayer",60000,false);
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %d", pName(playerid), PlayerName, reason);
    SCMTA(COLOR_YELLOW, string);
    return true;
}

CMD:uncage(playerid, params[])
{
    new string[256], id, reason, PlayerName[MAX_PLAYER_NAME];
    if(PVar[playerid][pLevel] < 3) return
                                            SendClientMessage(playerid, COLOR_RED, "ERROR : You need to be administrator level 3 to use this command!");
                                            format(string, sizeof(string), "%s has used the command '/uncage'");
                                            SendAdminMessage(COLOR_YELLOW, string);
    if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /uncage [PlayerID/Name] [Reason]");
    KillTimer(CageTimer);
    UnCagePlayer(id);
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "*** Administrator %s has UnCaged %s | Reason : %d", pName(playerid), PlayerName, reason);
    SCMTA(COLOR_YELLOW, string);
    return true;
}
I defined SCM (SendClientMessage)
And SCMTA(SendClientMessageToall)

Problems:

The reason isnt working, and the player caged name too, btw i got pName(playerid) stock.
And its not caging the player at all...
HELP!
Reply
#2

At
Код:
if(sscanf(params, "uz", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
Use "s" not "z" for string
Код:
if(sscanf(params, "us", id, reason)) return SCM(playerid, COLOR_RED, "* Usage : /cage [PlayerID/Name] [Reason]");
and at
Код:
format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %d", pName(playerid), PlayerName, reason);
Change that %d with %s because it's a string
Just like that
Код:
format(string, sizeof(string), "*** Administrator %s have caged %s for 1 minute | Reason : %s", pName(playerid), PlayerName, reason);
for other problems i don't know wait to reply from good scripters , i am just a begginer.
Reply
#3

us[256]

4char
Reply
#4

Thanks, and why isnt it Caging the player=
Reply
#5

Not sure why it's not cagin the player, but the code above is true.

Also for a cage, theirs a 0.3C Object, that is a small cage. has a little black sign that says Bullet proof. Noob safe. or somthing. the object ID: 19075. Just create this object on them.
Reply
#6

Quote:
Originally Posted by -Rebel Son-
Посмотреть сообщение
Not sure why it's not cagin the player, but the code above is true.

Also for a cage, theirs a 0.3C Object, that is a small cage. has a little black sign that says Bullet proof. Noob safe. or somthing. the object ID: 19075. Just create this object on them.
Like on top, new cage;
then cage = CreateObject(blabla);
And then DestroyObject(cage);

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)