Suerte Posted June 26, 2011 Share Posted June 26, 2011 CLIENT: --gui button leads to triggerServerEvent ( "onChooseSpawn", getRootElement(), 105 ) SERVER: addEvent( "onChooseSpawn", true ) function spawnHandler ( skinID ) setCameraTarget ( getRootElement() ) fadeCamera(getRootElement(), true ) spawnPlayer(getRootElement(), 2495, -1685, 14) end addEventHandler( "onChooseSpawn", getRootElement(), spawnHandler ) The event is triggered and the function starts. This part works. The command spawnPlayer(getRootElement(), 2495, -1685, 14) does not work however giveWeapon( getRootElement(), 34, 1000 ) does work? Note: I used "onPlayerJoin" and "onPlayerDeath" and spawnPlayer(source, 2495, -1685, 14), and that works. But I need it to work with the GUI Link to comment
0 SDK Posted June 27, 2011 Share Posted June 27, 2011 This should be moved to the Scripting section Anyway, you should use the source of the event to pass on the player element, and then you can use it to spawn him. --gui button leads to triggerServerEvent ( "onChooseSpawn", getLocalPlayer(), 105 ) --set "source" to local player element addEvent( "onChooseSpawn", true ) function spawnHandler ( skinID ) local player = source setCameraTarget ( player ) fadeCamera ( player, true ) spawnPlayer ( player, 2495, -1685, 14, 0, skinID) end addEventHandler( "onChooseSpawn", getRootElement(), spawnHandler ) Link to comment
0 Suerte Posted June 27, 2011 Author Share Posted June 27, 2011 This should be moved to the Scripting sectionAnyway, you should use the source of the event to pass on the player element, and then you can use it to spawn him. Yes, you are right. I was about to request it moved. Also, thank you very much!!!!!! Link to comment
Question
Suerte
CLIENT:
SERVER:
The event is triggered and the function starts. This part works.
The command spawnPlayer(getRootElement(), 2495, -1685, 14) does not work however giveWeapon( getRootElement(), 34, 1000 ) does work?
Note: I used "onPlayerJoin" and "onPlayerDeath" and spawnPlayer(source, 2495, -1685, 14), and that works. But I need it to work with the GUI
Link to comment
2 answers to this question
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