Vehicle nos?
#1

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

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;
}
Reply
#3

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;
}
Reply
#4

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

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;
}
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)