Log in to reply
 

[C#] How can I spawn Cars by Name?



  • Hey Guys, im searching for a solution to spawn cars by name. Like you have a TextBox and there you type in the Vehicle name.

    Maybe someone can give me a Code Example!

    Greetings From Germany



  • Use Game.GetUserInput for the text box.

    If you want to spawn cars with a model name, just put the returned string from Game.GetUserInput into World.CreateVehicle

    If you want to spawn cars with their actual name:
    Create a Dictionary<Key, Value> with the keys set as vehicle names and values set as model names.
    Put the returned string from Game.GetUserInput in yourDictionaryVariable.TryGetValue(userInputReturnedStringHere, out variableForValue) to get the model name. Use that model name in World.CreateVehicle



  • Thanks !


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.