Deactivate waterthrower - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Deactivate waterthrower (
/showthread.php?tid=201881)
Deactivate waterthrower -
selEcT - 22.12.2010
Hi guys!
Is there a function to deactivate / block the waterthrower of the firetruck?
Best regards
selEcT
Re: Deactivate waterthrower -
alpha500delta - 22.12.2010
No.
Altough you could make a Kill system when a player fires it...
Re: Deactivate waterthrower -
Mauzen - 22.12.2010
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
{
new keys, up, down;
GetPlayerKeys(playerid, keys, up, down);
if(keys & KEY_FIRE) return 0;
}
return 1;
}
This might be a solution, but a quite bad one. It checks if a player is in a fire truck, and if he presses the fire key. If he does, it will desync him.
Pro: he cant harm other players with the waterthrower.
Con: also his movement and everything else will be desynced. He will stop for other player when he shoots, and will beam around when he stops firing.
If you combine this with a warning, or a kick or a punishment in any kind, this might be a solution.
Edit: question: would it work, to just desync the player once when he starts pressing the key, and not return 0 all the time he has the key pressed? (So the keypress wouldnt be synced with other players -> he never pressed it for them) I saw this somewhere some time ago, but never tested it.
Re: Deactivate waterthrower -
Krx17 - 22.12.2010
You could just freeze and unfreeze him quickly instead.
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
{
new keys, up, down;
GetPlayerKeys(playerid, keys, up, down);
if(keys & KEY_FIRE)
{
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);
}
}
return 1;
}