01.08.2012, 22:38
if a player spams missiles (presses key_fire more than once per second), then freeze him for 2 seconds: this way players will get it smashed into their brain: spam==pain;
...quickly smashed this together, tested, and it kindof works:
i figured out a bug or glitch, where the key_action (rocket on hydra, shown as "key secondary fire" in options) gets recognized in a different way when a player got frozen inside a vehicle, its like on foot controls then. the thing you will need to add, is a check for the normal key_fire key (punch on foot) aswell, to unfreeze a player (togglecontrollable 1 then)...
@edited a bit, accidently swapped key_action with key_fire hehe
pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys){
if (!(oldkeys & KEY_ACTION) && (newkeys & KEY_ACTION))
{
new Tick=GetTickCount();
if(Tick-GetPVarInt(playerid,"LastMissileMS")<1000)
{
SetPVarInt(playerid,"LsstMissileMS",Tick+1000);
TogglePlayerControllable(playerid,0);
GameTextForPlayer(playerid,"dont spam",500,5);
}
else
{
SetPVarInt(playerid,"LastMissileMS",Tick);
TogglePlayerControllable(playerid,1);
GameTextForPlayer(playerid,"be careful",500,5);
}
//your stuff
}
i figured out a bug or glitch, where the key_action (rocket on hydra, shown as "key secondary fire" in options) gets recognized in a different way when a player got frozen inside a vehicle, its like on foot controls then. the thing you will need to add, is a check for the normal key_fire key (punch on foot) aswell, to unfreeze a player (togglecontrollable 1 then)...
@edited a bit, accidently swapped key_action with key_fire hehe