27.01.2011, 05:29
How do i make a system when player type /spawncar then it will not spawn at that time. It will spawn after 2 mins, after he typed it. How will i make that? BTW how will i make the car not spawn on his head?
How do i make a system when player type /spawncar then it will not spawn at that time. It will spawn after 2 mins, after he typed it. How will i make that? BTW how will i make the car not spawn on his head?
|
Why would you want a delay of 2 minutes? If someone is spawning a vehicle, its probably because they need one at that exact moment lol.
You have several available methods to delay the vehicle spawning. The first is probably the easiest, and that is using a timer to call the function that spawns a vehicle (The SetTimerEx function calls a public function WITH parameters, so keep that in mind when making the function). The second is using gettime when the player types the command, and then checking the time the player spawned it against the current time. You would so this in a timer (ie: if you use SetTimer instead of SetTimerEx, and do a player loop) or OnPlayerUpdate (if you use this method you'll likely need to build a module to make sure your code doesnt execute every update). As for your question regarding how to make a vehicle spawn around the player, you can increase the X or Y position by like 5, or you can use the trig functions to make it always spawn infront of the player (Look up floatsin/floatcos or GetXYInfrontOfPlayer). |