SA-MP Forums Archive
cage, uncage... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: cage, uncage... (/showthread.php?tid=246938)



cage, uncage... - Markx - 06.04.2011

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!


Re: cage, uncage... - Rock_Ro - 06.04.2011

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.


Re: cage, uncage... - maramizo - 06.04.2011

us[256]

4char


Re: cage, uncage... - Markx - 06.04.2011

Thanks, and why isnt it Caging the player=


Re: cage, uncage... - -Rebel Son- - 06.04.2011

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.


Re: cage, uncage... - Markx - 07.04.2011

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!