[Tutorial] /cuff and /uncuff Tutorial (sscanf)+(ZCMD)
#12

see here
https://sampforum.blast.hk/showthread.php?tid=618127
and add it in gm
Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
Код:
CMD:cuff(playerid, params[])
{
      if(gTeam[playerid] == LSPD)
      {
            new targetid;
            if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFF00FF, "USAGE: /cuff (PlayerID)");
             if(IsPlayerConnected(targetid))
            {
                   new Float:x, Float:y, Float:z;
                   GetPlayerPos(targetid, x, y, z);
                   if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                   {
                          if(gTeam[playerid] != LSPD)
                          {
                                 if(IsCuffed[targetid] == false)
                                 {
                                        new string[64+MAX_PLAYER_NAME]
                                        new targetname[MAX_PLAYER_NAME]
                                        new playername[MAX_PLAYER_NAME]
                                        GetPlayerName(playerid, playername, sizeof(playername)
                                        format(string, sizeof(string), "You have been cuffed by officer %s",playername));
                                        SendClientMessage(targetid, 0x0000FF, string);
                                        GetPlayerName(targetid, targetname, sizeof(targetname))
                                        format(string, sizeof(string), "You have cuffed %s ", targetname))
                                        SendClientMessage(playerid, 0xCCFF00, string));                                      SetPlayerAttachedObject(targetid,8,19418,6,-0.031999,0.024000,-0.024000,-7.900000,-32.000011,-72.299987,1.115998,1.322000,1.406000);
    	 				SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
                                        IsCuffed = true;
                                        return 1;
                                 }
                                 else if(IsCuffed == true)
                                 {
                                        SendClientMessage(playerid, 0xFF0000, "[ERROR]: This player is already cuffed!");
                                        return 1;
                                 }                            
                                 return 1;
                          }
                          else if(gTeam[playerid] == LSPD)
                          {
                                  SendClientMessage(playerid, 0xFF0000, "[ERROR]: you can't cuff a law enforcer!");
                                  return 1;
                          {
                          return 1;
                   }
                   else if(!IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                   {
                          SendClientMessage(playerid, 0xFF0000, "[ERROR]: That player is too far away from you!");
                          return 1;
                   }
                   return 1;
            }
            else if(!IsPlayerConnected(targetid))
           {
                   SendClientMessage(playerid, 0xFF0000, "[ERROR]: Invalid ID!");
                   return 1!
           }
            return 1;
      }
      else if(gTeam[playerid] != LSPD)
      {
            SendClientMessage(playerid, 0xFF0000, "[ERROR]: Only cops and use this command!");
            return 1;
      }
      return 1;
}
Код:
CMD:uncuff(playerid, params[])
{
      if(gTeam[playerid] == LSPD)
      {
            new targetid;
            if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFF00FF, "USAGE: /uncuff (PlayerID)");
             if(IsPlayerConnected(targetid))
            {
                   new Float:x, Float:y, Float:z;
                   GetPlayerPos(targetid, x, y, z);
                   if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                   {
                          if(gTeam[playerid] != LSPD)
                          {
                                 if(IsCuffed[targetid] == true)
                                 {
                                        new string[64+MAX_PLAYER_NAME]
                                        new targetname[MAX_PLAYER_NAME]
                                        new playername[MAX_PLAYER_NAME]
                                        GetPlayerName(playerid, playername, sizeof(playername)
                                        format(string, sizeof(string), "You have been uncuffed by officer %s",playername));
                                        SendClientMessage(targetid, 0x0000FF, string);
                                        GetPlayerName(targetid, targetname, sizeof(targetname))
                                        format(string, sizeof(string), "You have uncuffed %s ", targetname))
                                        SendClientMessage(playerid, 0xCCFF00, string));
                                        if(IsPlayerAttachedObjectSlotUsed(targetid, 8)) 
                                        {
				                 RemovePlayerAttachedObject(targetid, 8);
                                                 return 1;
					}
			         	SetPlayerSpecialAction(targetid, SPECIAL_ACTION_NONE);
                                        IsCuffed = false;
                                        return 1;
                                 }
                                 else if(IsCuffed == true)
                                 {
                                        SendClientMessage(playerid, 0xFF0000, "[ERROR]: This player is not cuffed!");
                                        return 1;
                                 }                            
                                 return 1;
                          }
                          else if(gTeam[playerid] == LSPD)
                          {
                                  SendClientMessage(playerid, 0xFF0000, "[ERROR]: you can't use this on a law enforcer!");
                                  return 1;
                          {
                          return 1;
                   }
                   else if(!IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                   {
                          SendClientMessage(playerid, 0xFF0000, "[ERROR]: That player is too far away from you!");
                          return 1;
                   }
                   return 1;
            }
            else if(!IsPlayerConnected(targetid))
           {
                   SendClientMessage(playerid, 0xFF0000, "[ERROR]: Invalid ID!");
                   return 1!
           }
            return 1;
      }
      else if(gTeam[playerid] != LSPD)
      {
            SendClientMessage(playerid, 0xFF0000, "[ERROR]: Only cops and use this command!");
            return 1;
      }
      return 1;
}
Reply


Messages In This Thread
/cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Eoussama - 01.10.2016, 14:58
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Kruno88 - 01.10.2016, 15:11
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by SyS - 01.10.2016, 15:14
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by AndySedeyn - 01.10.2016, 15:53
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Eoussama - 01.10.2016, 16:11
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Eoussama - 08.12.2016, 10:24
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Dayrion - 09.12.2016, 00:12
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by XxFiGhteRXx - 31.12.2016, 10:36
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Stinged - 31.12.2016, 10:51
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Triggerz - 22.01.2017, 18:57
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by RyderX - 22.01.2017, 19:29
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by PaRking - 22.01.2017, 19:35
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by RyderX - 22.01.2017, 19:36
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by PaRking - 22.01.2017, 19:38
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by RyderX - 22.01.2017, 19:39
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Eoussama - 22.01.2017, 19:40
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Triggerz - 22.01.2017, 19:43
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Triggerz - 22.01.2017, 19:45
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by RyderX - 22.01.2017, 19:49
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Eoussama - 22.01.2017, 19:50
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by Triggerz - 22.01.2017, 19:54
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by JohnFlores - 24.07.2017, 14:22
Re: /cuff and /uncuff Tutorial (sscanf)+(ZCMD) - by coool - 24.07.2017, 15:16

Forum Jump:


Users browsing this thread: 6 Guest(s)