Jump to content

How do I do this?


callum123

Recommended Posts

Right so, DD servers or race or whatever.

In the maps for these you have things like:

"spawnpoint (Mesa) (1)" vehicle="500" posX="3527.3000488281" posY="-1711.9000244141" posZ="102.90000152588" rotX="0" rotY="0" rotZ="0">

This is all well and good, but what if I want to use over 100 vehicles, do I have to make a new spawn point every single time with the new vehicle, or would there be a way to have like 10 spawnpoints set in the map file and then depending on which random spawnpoint you get, you get a random vehicle.

I made this so when you respawn a vehicle is made the other side of the map and then you get warped into it, but its not really what I wanted, and then I tryed to do it so when you spawn, you are in a vehicle and it will change that vehicles model

Here was the spawn vehicle code

function getCar () 
    theVehicle = createVehicle ( 602, 3, 3, 3 ) 
    vehicles = {602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529,513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 485, 552, 431, 
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490,528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 568, 557, 424, 471, 504, 495, 457, 483, 508, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458} 
    vehicleid = tonumber(vehicles[math.random(#vehicles)]) 
    warpPedIntoVehicle(source, theVehicle) 
    setElementModel(theVehicle, vehicleid) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), getCar ) 

Obviously I do not want that at all, since if I die (in the car) then i want to return back to a previous spawn point, not 3, 3, 3 like I set it to.

Ideal world, would be to set the spawns for every single map in a script and that have it like, if map = blah then spawnpoints = blah. - So would this be possible, or would the spawn points be called from the map file and then the model changed once you spawn?

Link to comment

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...