mcer Posted June 6, 2013 Share Posted June 6, 2013 The idea of the script is to create a button, which when you click it to close the window and the user appear on the map. The only thing I fails here is the spawn. ClientSide addEventHandler ("onClientGUIClick", getRootElement(), function () if ( source == MilitaryB ) then guiSetVisible ( TeaSelectorWin,false) showCursor (false) triggerEvent ( "MilitarySpawnEvent", getRootElement(), "test" ) end end ) ServerSide addEvent ( "MilitarySpawnEvent", true ) function MilitarySpawn(source) if source then thePlayer = source else thePlayer = player end spawnPlayer( thePlayer, 2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285, 0, 0, Military) fadeCamera( thePlayer, true) setCameraTarget( thePlayer, source) end addEventHandler ( "MilitarySpawnEvent", getRootElement(), MilitarySpawn ) addCommandHandler("asd",MilitarySpawn) Link to comment
xXMADEXx Posted June 6, 2013 Share Posted June 6, 2013 function MilitarySpawn( ) local thePlayer = source spawnPlayer( thePlayer, 2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285, 0, 0, Military) fadeCamera( thePlayer, true) setCameraTarget( thePlayer, source) end Link to comment
mcer Posted June 6, 2013 Author Share Posted June 6, 2013 Idk how to put a trigger in Clientside, Please help me. Link to comment
mcer Posted June 6, 2013 Author Share Posted June 6, 2013 function MilitarySpawn( ) local thePlayer = source spawnPlayer( thePlayer, 2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285, 0, 0, Military) fadeCamera( thePlayer, true) setCameraTarget( thePlayer, source) end The spawn don't have any problems, What I would like to know is how to turn this function on clientside. Thanks fot that too! Link to comment
DakiLLa Posted June 6, 2013 Share Posted June 6, 2013 Replace this triggerEvent ( "MilitarySpawnEvent", getRootElement(), "test" ) with this: triggerServerEvent ( "MilitarySpawnEvent", getLocalPlayer() ) Link to comment
mcer Posted June 6, 2013 Author Share Posted June 6, 2013 Replace this triggerEvent ( "MilitarySpawnEvent", getRootElement(), "test" ) with this: triggerServerEvent ( "MilitarySpawnEvent", getLocalPlayer() ) Doesn't works. Link to comment
mcer Posted June 6, 2013 Author Share Posted June 6, 2013 With the new Triggering code appear some warnings in the console: Bad argument SpawnPlayer Bad argument FadeCamera Bad argument setCameraTarget Link to comment
mcer Posted June 6, 2013 Author Share Posted June 6, 2013 SOLVED!!! Thanks a lot. Replace this triggerEvent ( "MilitarySpawnEvent", getRootElement(), "test" ) with this: triggerServerEvent ( "MilitarySpawnEvent", getLocalPlayer() ) function MilitarySpawn( ) local thePlayer = source spawnPlayer( thePlayer, 2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74, 180, 285, 0, 0, Military) fadeCamera( thePlayer, true) setCameraTarget( thePlayer, source) end The spawn don't have any problems, What I would like to know is how to turn this function on clientside. Thanks fot that too! Link to comment
xXMADEXx Posted June 6, 2013 Share Posted June 6, 2013 Its server side, obviously... Idk how to put a trigger in Clientside, Please help me. bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) Example: triggerClientEvent ( root, "theClientSideEvent", root ) 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