[Include] ToggleVehicleWeapons -Completely disarm every vehicle !
#1

ToggleVehicleWeaponsV1.0

This script can toggle the weapons for every armed vehicle on/off! I developed a smart method of detecting when a player is about to shoot, this script is using that method to return 0 at OnPlayerUpdate when the player is pressing the shoot keys.

This means you can completely disable the weapons of any vehicle you want!, the bullets or missiles will still be visible for the shooter though, but will NOT spawn serverside (for other players)!

Please note that this does NOT works on miniguns (like the hunter/seasparrow) yet! It will be detected only it will not prevent the shooter from shooting other people ! I succesfully tested this but my test person seems to be altabbed at that moment since it still works :/

Functions
pawn Код:
ToggleVehicleWeaponsForAll(toggle) //toggle for everyone (this will also overwrite PER PLAYER!)
ToggleVehicleWeaponsForPlayer(playerid,toggle); //toggle per player
Callbacks
pawn Код:
OnPlayerVehicleFire(playerid,vehicleid,allowed)
Example script
pawn Код:
#include <a_samp>
#include <nodm>

public OnPlayerVehicleFire(playerid,vehicleid,allowed)
{
    /*
        Callback,
        playerid    = playerid of shooter
        vehicleid   = vehicleid of player
        allowed     = is shot really fired (was it disabled or not, returns 1 when really fired)
    */

    return 1;
}

public OnFilterScriptInit()
{
    ToggleVehicleWeaponsForAll(0); //disarm for everyone
}

// Please note that the following functions MUST be in the script where you include the filterscript to return 1! else they will be called anymore in other scripts
public OnPlayerConnect(playerid)
{
    return 1;
}
public OnPlayerUpdate(playerid)
{

    return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    return 1;
}
Special thanks to cessil on IRC for helping me fix a small bug (when using multiple keys).
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)