Is it possible? - 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)
+--- Thread: Is it possible? (
/showthread.php?tid=365094)
Is it possible? -
CoDeZ - 01.08.2012
to limit hydra missiles to 1 missile per 1 second?
Re: Is it possible? -
[KHK]Khalid - 01.08.2012
I don't think so. Why do you wanna do that anyway?
Re: Is it possible? -
CoDeZ - 01.08.2012
Players are spamming hydra missles , which is kinda unfair
Re: Is it possible? -
Babul - 01.08.2012
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;
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
}
...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