SA-MP Forums Archive
[Help]/drag command Hotkey - 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: [Help]/drag command Hotkey (/showthread.php?tid=462937)



[Help]/drag command Hotkey - Drago987 - 09.09.2013

Hey guys ,i`m making a new server and i have a problem with /drag command ,i cant add the Fire Hotkey to stop dragging the suspect if anyone knows how to do it ,Post it please
PHP код:
CMD:drag(playeridparams[])
{
if(
IsACop(playerid))
{
new 
string[128], giveplayerid;
if(
sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /drag [playerid]");
if(
IsPlayerConnected(giveplayerid))
{
if(
GetPVarInt(giveplayerid"PlayerCuffed") == 2)
{
if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playeridCOLOR_WHITE" You must be out of the vehicle to use this command.");
if(
GetPVarInt(giveplayerid"BeingDragged") == 1)
{
SendClientMessageEx(playeridCOLOR_WHITE" That player is already being dragged. ");
return 
1;
}
new 
Float:dXFloat:dYFloat:dZ;
GetPlayerPos(giveplayeriddXdYdZ);
if(!
IsPlayerInRangeOfPoint(playerid5.0dXdYdZ))
{
SendClientMessageEx(playeridCOLOR_GRAD2" That suspect is not near you.");
return 
1;
}
format(stringsizeof(string), "* %s has is now dragging you."GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
format(stringsizeof(string), "* You are now dragging %s, you may move them now."GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playeridCOLOR_WHITEstring);
format(stringsizeof(string), "* %s grabs ahold of %s and begins to move them."GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessageEx(playeridCOLOR_WHITE"You are now dragging the suspect, press the '{AA3333}FIRE{FFFFFF}' button to stop.");
SetPVarInt(giveplayerid"BeingDragged"1);
SetPVarInt(playerid"DraggingPlayer"giveplayerid);
}
else
{
SendClientMessageEx(playeridCOLOR_WHITE" The specified player is not cuffed !");
}
}
}
else
{
SendClientMessageEx(playeridCOLOR_GREY" You are not a LEO ! ");
return 
1;
}
return 
0;




Re: [Help]/drag command Hotkey - Mattakil - 09.09.2013

Use the variable under OnPlayerKeyStateChange, for example

pawn Код:
if(GetPVarInt(giveplayerid, "BeingDragged") == 1)
  {
   //set the variable to 0
  }
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: [Help]/drag command Hotkey - Drago987 - 09.09.2013

Actually i`m not a Good Scripter So,Make it for me if you can please (i`m still learning the basics of Scripting)


Re: [Help]/drag command Hotkey - Drago987 - 10.09.2013

can anyone make the command for me please ?