Castillo Posted March 28, 2014 Share Posted March 28, 2014 Uh, that makes no sense. Problems: 1º removeEventHandler arguments are: attachedTo, function. And if you remove it, nobody else will be able to spawn when join. 2º bindKey server-side requires a player element, "player" is not defined there. Bind it when the player joins. Link to comment
John Smith Posted March 29, 2014 Author Share Posted March 29, 2014 Uh, that makes no sense.Problems: 1º removeEventHandler arguments are: attachedTo, function. And if you remove it, nobody else will be able to spawn when join. 2º bindKey server-side requires a player element, "player" is not defined there. Bind it when the player joins. I've removed that removeEventHandler but i didn't understand clearly what u meant with 2) is this good? function onSumoPlayerVehicleExit(player) if isPedInVehicle(player) then killPed(player) else outputDebugString("a player pressed enter/f key without being in a vehicle.") end end addEventHandler("onVehicleStartExit",root,onSumoPlayerVehicleExit) function bindKill(player) bindKey(player, "enter", "down", onSumoPlayerVehicleExit) bindKey(player, "f", "down", onSumoPlayerVehicleExit) end addEventHandler("onPlayerJoin",root,bindKill) btw idk how to set a timer when player should respawn(5 sec) Link to comment
justn Posted March 29, 2014 Share Posted March 29, 2014 (edited) Why ask if it's good or not ? First you should try it, instead of waiting for someone to say if it's good or bad. btw idk how to set a timer when player should respawn(5 sec) addEventHandler ( "onPlayerWasted", getRootElement(), function () setTimer(function() -- RESPAWN CODE HERE end, 5000, 1 ) end) Edited March 29, 2014 by Guest Link to comment
John Smith Posted March 29, 2014 Author Share Posted March 29, 2014 function respawnSumoPlayer() addEventHandler("onPlayerWasted",getRootElement(), setTimer(function() spawnPlayer ( source, unpack ( spawnPoints [ math.random ( #spawnPoints ) ] ) ) setCameraTarget ( source, source ) end, 5000, 1 )) end im not respawning and my camera is going higher and higher because im dead [10:19:12] WARNING: [gamemodes]\[sumo]\sumo\load_map\spawn_s.lua:34: Bad argument @ 'spawnPlayer'[10:19:12] WARNING: [gamemodes]\[sumo]\sumo\load_map\spawn_s.lua:35: Bad argument @ 'setCameraTarget Link to comment
Castillo Posted March 29, 2014 Share Posted March 29, 2014 @#Twerky: Please don't post if you don't know what you are talking about. @John Smith: That doesn't make any sense. Link to comment
John Smith Posted March 29, 2014 Author Share Posted March 29, 2014 i've tried this too addEventHandler("onPlayerWasted", root, function() setTimer( function(source) local vehicle = createVehicle ( model, unpack ( spawnPoints [ math.random ( #spawnPoints ) ] ) ) spawnPlayer ( source, unpack ( spawnPoints [ math.random ( #spawnPoints ) ] ) ) ) setCameraTarget ( source, source ) warpPedIntoVehicle ( source, vehicle ) end, 5000, 1, source ) end) it respawns me but how can i make it respawn me into random vehicle? Link to comment
Castillo Posted March 29, 2014 Share Posted March 29, 2014 addEventHandler ( "onPlayerWasted", root, function ( ) setTimer ( function ( thePlayer ) if isElement ( thePlayer ) then local model = vehicles [ math.random ( #vehicles ) ] local vehicle = createVehicle ( model, unpack ( spawnPoints [ math.random ( #spawnPoints ) ] ) ) spawnPlayer ( thePlayer, unpack ( spawnPoints [ math.random ( #spawnPoints ) ] ) ) setCameraTarget ( thePlayer, thePlayer ) warpPedIntoVehicle ( thePlayer, vehicle ) end end ,5000, 1, source ) 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