Jump to content

Create vehicle


-Doc-

Recommended Posts

Posted

How i can make a script? For example i type /cv bug or bugatti and it should create 496(blista compact) or get vehicle name from part

My scripting skills

 


76561198189590622.pngAddFriend.png

Posted

What do you mean?

  
addCommandHandler("cv", function (player, _, arg1) 
   if tostring(arg1) then 
        veh = getVehicleModelFromName(arg1) 
               if veh then 
                   createVehicle(veh,unpack( {getElementPosition ( player ) } ) ) 
               else 
                   outputChatBox("wrong name", player) 
               end 
   else 
     if tonumber(arg1) then 
         createVehicle(arg1,unpack( {getElementPosition ( player ) } ) ) 
     end 
   end 
end 
) 
  

Currently developing for International Gaming Community - Join us!

Posted
Im asking where i dont know

Once you learn how to properly navigate the MTA Wiki, you'll be able to solve simple issues like these all by yourself.

What you're looking for is to take Tomas's example and modify it so you can give yourself a weapon instead, so, you'll want to look under weapon functions, wham, there you have getWeaponIDFromName.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...