Anti-Hydra fire
#1

if it's possible..that player can drive hydra but if he fire, server set his HP to 0

tnx
Reply
#2

Sure it is.

Use OnPlayerKeyStateChange() callback -> check if player is in hydra -> if key==key_fire -> Set his HP to 0.
Reply
#3

can you make command here please ?
Reply
#4

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
Reply
#5

it makes errors -.-
Reply
#6

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.
Reply
#7

its not working...

i can fire with hydra
Reply
#8

SetPlayerHealth(playerid, -999999);

Why not just SetPlayerHealth(playerid, 0);

-_-
Reply
#9

i want to kill player when he fire with hydra,

not when he kill someone...can someone make that please.
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)