Anti-Hydra fire - 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: Anti-Hydra fire (
/showthread.php?tid=229719)
Anti-Hydra fire -
Gotti_ - 22.02.2011
if it's possible..that player can drive hydra but if he fire, server set his HP to 0

tnx
Re: Anti-Hydra fire -
xRyder - 22.02.2011
Sure it is.
Use OnPlayerKeyStateChange() callback -> check if player is in hydra -> if key==key_fire -> Set his HP to 0.
Re: Anti-Hydra fire -
Gotti_ - 22.02.2011
can you make command here please ?
Re: Anti-Hydra fire -
xRyder - 22.02.2011
Quote:
Originally Posted by Gotti_
can you make command here please ?
|
That's not a command. -.-
I just gave you all you need. You just need to make 10 lines of code..
Use this:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
https://sampwiki.blast.hk/wiki/SetPlayerHealth
Re: Anti-Hydra fire -
Gotti_ - 22.02.2011
it makes errors -.-
Re: Anti-Hydra fire -
iggy1 - 22.02.2011
10 lines
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerInAnyVehicle(killerid))
{
new
vid = GetPlayerVehicleID(killerid);
if(GetVehicleModel(vid) == 522)
SetPlayerHealth(killerid, -999999);
}
return 1;
}
Theres no way to disable hydra rockets but you can kill the culprit. I'll post the above suggestion in a sec.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new
vid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vid) == 522 && newkeys & VEHICLE_FIREWEAPON)
SetPlayerHealth(playerid, -999999);
}
return 1;
}
You could also just remove them from vehicle instead of killing them, your choice.
Re: Anti-Hydra fire -
Gotti_ - 22.02.2011
its not working...
i can fire with hydra
Re: Anti-Hydra fire -
alpha500delta - 22.02.2011
SetPlayerHealth(playerid, -999999);
Why not just SetPlayerHealth(playerid, 0);
-_-
Re: Anti-Hydra fire -
Gotti_ - 22.02.2011
i want to kill player when he fire with hydra,
not when he kill someone...can someone make that please.
Re: Anti-Hydra fire -
iggy1 - 22.02.2011
Sometimes they don't die with '0' . It realy doesn't matter which number you use as long as its valid.
This will kill them when they use the vehicle fire button inside a hydra. (i hope not tested)
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
new
vid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vid) == 522 && newkeys & VEHICLE_FIREWEAPON)
SetPlayerHealth(playerid, -999999);
}
return 1;
}