26.08.2011, 12:42
Add this at OnPlayerEnterVehicle [until someone knows how to define 'vehicleid' at OnPlayerKeyStateChange
If you are wondering why I am using 2 "if"s. The hydra has a flare and a shoot system. Flare is not a dm thing, and
because Flare = KEY_FIRE, you have to add a new "if" to check if he only pressed KEY_SECONDARY_ATTACK
pawn Код:
SetPVarInt(playerid, "vehicleID", vehicleid);
because Flare = KEY_FIRE, you have to add a new "if" to check if he only pressed KEY_SECONDARY_ATTACK
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if((newkeys & KEY_FIRE || newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_FIRE || oldkeys & KEY_SECONDARY_ATTACK))
{
switch(GetPVarInt(playerid, "vehicleID"))
{
case 425, 432, 464, 476:
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, -1, "You have been killed because you dmed");
}
}
}
else if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
{
switch(GetPVarInt(playerid, "vehicleID"))
{
case 520:
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, -1, "You have been killed because you dmed");
}
}
}
}
return 1;
}