ELmarcoS. Posted October 16, 2012 Share Posted October 16, 2012 Hey all, can you tell me what functions I need to give a car to a random player in 2 mins, Thanks Link to comment
Callum Posted October 16, 2012 Share Posted October 16, 2012 setTimer getRandomPlayer createVehicle warpPedIntoVehicle Link to comment
ELmarcoS. Posted October 16, 2012 Author Share Posted October 16, 2012 createVehicle should work if I use it in a fun map?, let me explain, I will do a fun map, first everyone start with kart, after 2 mins a random player get a rinho. Link to comment
Callum Posted October 16, 2012 Share Posted October 16, 2012 It will work with anything, if done correctly. Link to comment
BorderLine Posted October 16, 2012 Share Posted October 16, 2012 can be better if you use setElementModel() Link to comment
Guest Guest4401 Posted October 17, 2012 Share Posted October 17, 2012 A fun map for race gamemode, right? If so, then you mustn't use getRandomPlayer because he might be dead, and isPlayerAlive also doesn't work in such a case. Try adding this as a server side script in your map. function _getAlivePlayers() local t = {} for i,v in ipairs(getElementsByType'player') do if getElementData(v,"state") == "alive" then table.insert(t,v) end end if #t ~= 0 then return t end return false end addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function(n,o) if o == "GridCountdown" and n == "Running" then outputChatBox("Someone will get a rhino in 2 minutes",root) setTimer( function() local p = _getAlivePlayers() if p then local p = p[math.random(#p)] local v = getPedOccupiedVehicle(p) if v then setElementModel(v,432) end end end,120000,1 ) end end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now