SA-MP Forums Archive
Vehicle nos? - 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: Vehicle nos? (/showthread.php?tid=440550)



Vehicle nos? - Guitar - 30.05.2013

how do i create a CMD:NOS that lets players put nos in there vehicle


Re: Vehicle nos? - IceBilizard - 30.05.2013

pawn Код:
CMD:nos(playerid,params[])
{
    #pragma unused params
    if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
            return SendClientMessage(playerid,-1,"ERROR: You can not tune this vehicle!");
        }
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
    }else return SendClientMessage(playerid,-1,"ERROR: You must be in a vehicle.");
    return 1;
}



Re: Vehicle nos? - Littlehelper - 30.05.2013

pawn Код:
CMD:nos(playerid,params[]) {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Get in a vehicle");
    AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    SendClientMessage(playerid,-1,"Nos added");
    return 1;
}



AW: Vehicle nos? - HurtLocker - 30.05.2013

#pragma unused params
whats this? I mean I ve seen it before but never understood its purpose. Can you explain?


Re: Vehicle nos? - GiamPy. - 30.05.2013

First of all, you must check if a player is either inside a vehicle or not, in order to avoid any kind of issues.
Once the check is passed, you must take the player's vehicle ID by using GetPlayerVehicleID and add the vehicle component (AddVehicleComponent) 1010 that you could have found in the wiki page.

If you're using ZCMD, this should be the script:

pawn Код:
CMD:nos(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle.");
       
    new vehicleID = GetPlayerVehicleID(playerid);
    AddVehicleComponent(vehicleID, 1010); // Nitro
   
    SendClientMessage(playerid, 0xFFFFFFFF, "The nitro has been installed in your vehicle.");
    return 1;
}



Re: AW: Vehicle nos? - Littlehelper - 30.05.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
#pragma unused params
whats this? I mean I ve seen it before but never understood its purpose. Can you explain?
This