14.03.2012, 03:05
Hi, as I said in another recent thread of mine, I'm a novice at scripting.
The thing is that I'm trying to make a script by which Rustlers can kill players with just one single shot, like this:
[ame]http://www.youtube.com/watch?v=_MMi6ka2bNs[/ame]
However, I don't want it to affect everyone, but instead only pilots to kill each other. So I have a global boolean array that determines that a player is a pilot when he is in a plane or helicopter, and is not when he is killed by another player. I haven't pasted here the part of the script that sets that boolean as true or false, I don't think you will need it, so I'm just pasting the array declaration and the OnPlayerTakeDamage part:
But it doesn't work, and pilots keep taking normal damage from Rustlers, so what's the problem with this? Could it be that I'm declaring the armour and health variables as floats?
The thing is that I'm trying to make a script by which Rustlers can kill players with just one single shot, like this:
[ame]http://www.youtube.com/watch?v=_MMi6ka2bNs[/ame]
However, I don't want it to affect everyone, but instead only pilots to kill each other. So I have a global boolean array that determines that a player is a pilot when he is in a plane or helicopter, and is not when he is killed by another player. I haven't pasted here the part of the script that sets that boolean as true or false, I don't think you will need it, so I'm just pasting the array declaration and the OnPlayerTakeDamage part:
pawn Код:
new bool:pilot[500];
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if( (GetPlayerVehicleID(issuerid) == 476) && (pilot[playerid] == true) )
{
new Float:health, Float:armour;
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armour);
SetPlayerArmour(playerid, 0);
SetPlayerHealth( playerid, (health + armour - 100) );
// This all means that if you are a pilot and you get hit by another
// player flying a Rustler, you will be greatly damaged: if you have
// no armour you will die instantly, and if you do have armour you will
// have it removed, and your health may be reduced depending on your
// previous armour value.
}
return 1;
}