OnVehicleMod

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 02:41, 7 November 2017
RIDE2DAY (Talk | contribs)

← Previous diff
Current revision
Dugi (Talk | contribs)
(revert)
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Description|This callback is called when a component is added to a vehicle inside a mod shop.}}+{{Description|This callback is called when a vehicle is modded.}}
{{Parameters|playerid, vehicleid, componentid}} {{Parameters|playerid, vehicleid, componentid}}
Line 11: Line 11:
* It is always called first in gamemode so returning 0 there also blocks other filterscripts from seeing it.}} * It is always called first in gamemode so returning 0 there also blocks other filterscripts from seeing it.}}
-{{note|+{{note|This callback is NOT called by [[AddVehicleComponent]].}}
-* This callback is not called by [[AddVehicleComponent]].+
-* Using an invalid [[Car Component ID|component ID]] crashes the player's game, [https://goo.gl/GnA1j5 vSync] fixes this issue.}}+
{{Example}} {{Example}}

Current revision



Description:

This callback is called when a vehicle is modded.


Parameters:
(playerid, vehicleid, componentid)
playeridThe ID of the driver of the vehicle.
vehicleidThe ID of the vehicle which is modded.
componentidThe ID of the component which was added to the vehicle.


Return Values:

Return 0 to desync the mod (or an invalid mod) from propagating and / or crashing players.
  • It is always called first in gamemode so returning 0 there also blocks other filterscripts from seeing it.


Image:32px-Ambox_warning_orange.png

Note

This callback is NOT called by AddVehicleComponent.


Example Usage:

public OnVehicleMod(playerid,vehicleid,componentid)
{
    printf("Vehicle %d was modded by ID %d with the componentid %d",vehicleid,playerid,componentid);
    if(GetPlayerInterior(playerid) == 0)
    {
        BanEx(playerid, "Tuning Hacks"); // Anti-tuning hacks script 
        return 0; // Prevents the bad modification from being synced to other players
        //(Tested and it works even on servers wich allow you to mod your vehicle using commands, menus, dialogs, etc..
    }
    return 1;
}

Related Functions

The following functions might be useful, as they're related to this callback in one way or another.


Related Callbacks

The following callbacks might be useful as well, as they are related to this callback in one way or another.

Personal tools
In other languages