01.02.2014, 19:05
Hey guys. I've been having trouble upgrading my drag command to actually stop dragging the player once you hit a key. In this one, I want it to use 'KEY_FIRE.' I'm not so sure how to do it, but when I tried using 'OnPlayerKeyPress' it wouldn't work. Read over these errors for me.
Then, the code for /cuff itself.
Rep to anyone that can help.
Код:
C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(70752) : error 017: undefined symbol "OnPlayerKeyPress" C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(70753) : warning 202: number of arguments does not match definition C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(70754) : warning 202: number of arguments does not match definition C:\Users\Randy\Desktop\Madson Roleplay (Official Server)\gamemodes\KG.pwn(87222) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.
pawn Код:
CMD:drag(playerid, params[])
{
if(IsACop(playerid))
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /drag [playerid]");
if(IsPlayerConnected(giveplayerid))
{
if(GetPVarInt(giveplayerid, "PlayerCuffed") == 2)
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, " You must be out of the vehicle to use this command.");
if(GetPVarInt(giveplayerid, "BeingDragged") == 1)
{
SendClientMessageEx(playerid, COLOR_WHITE, " That player is already being dragged. ");
return 1;
}
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(giveplayerid, dX, dY, dZ);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, dX, dY, dZ))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " That suspect is not near you.");
return 1;
}
format(string, sizeof(string), "* %s has is now dragging you.", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* You are now dragging %s, you may move them now.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s grabs ahold of %s and begins to move them.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessageEx(playerid, COLOR_WHITE, "You are now dragging the suspect, press the '{AA3333}FIRE{FFFFFF}' button to stop.");
SetPVarInt(giveplayerid, "BeingDragged", playerid);
SetPVarInt(playerid, "DraggingPlayer", 1);
OnPlayerKeyPress KEY_FIRE
DeletePVar(giveplayerid, "BeingDragged", playerid);
DeletePVar(playerid, "DraggingPlayer", 0);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, " The specified player is not cuffed !");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a LEO ! ");
return 1;
}
return 0;
}
Rep to anyone that can help.