keystatechange - 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: keystatechange (
/showthread.php?tid=264795)
keystatechange -
Hobod - 27.06.2011
I've tried all sorts to get this to work.
All i need it to do is explode a vehicle that the player puts a bomb in, the vehicle id is stored in BombVehicle.
I need to do this only if they're holding a detonator weapon as well, i'm just wondering if the check for the weapon i did was right or not.
When i put the exact same code into a command it works fine, but it only shows the message at the end that says "this works".
pawn Код:
if (PRESSED( KEY_FIRE ))
{
if(GetPlayerWeapon(playerid) == 40)
{
if(BombVehicle[playerid] == -1) return SendClientMessage(playerid, red, "Error: You don't have a bomb planted!");
new Float:x, Float:y, Float:z;
GetVehiclePos(BombVehicle[playerid], x, y, z);
CreateExplosion(x, y, z, 6, 40.0);
SetVehicleToRespawn(BombVehicle[playerid]);
BombVehicle[playerid] = -1;
SendFMessage(playerid, orange, "Car bomb detonated. You now have %d bombs left.", GetPVarInt(playerid, "bombs"));
}
SendClientMessage(playerid, red, "this works");
}