Xeno Posted January 2, 2012 Share Posted January 2, 2012 I made a script that changes the players skin on GUI Click and it triggers a serverSided event.... For some reason it works for everyone, I have tried changing the Element bit to "player" "thePlayer" "source" and it still doesnt work... Here is the code: function activateTheBomb() triggerServerEvent("bomb", getLocalPlayer()) end function bomb(source) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 1) end addEvent("bomb", true) addEventHandler("bomb", getRootElement(), bomb) Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 Try function bomb( ) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 1) end addEvent("bomb", true) addEventHandler("bomb", getRootElement(), bomb) Link to comment
Xeno Posted January 2, 2012 Author Share Posted January 2, 2012 That is the same, it makes everyone spawn there. Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 Please show full your client side. Link to comment
Xeno Posted January 2, 2012 Author Share Posted January 2, 2012 I cant really show the hole Client, its quite big... But ill give you select parts that involve this code... function evenTeams(thePlayer) local ali = getTeamFromName ( "" ) pred = getTeamFromName ( "" ) local aliCount = countPlayersInTeam ( ali ) local predCount = countPlayersInTeam ( pred ) if aliCount == predCount then setPlayerTeam (source, pred) triggerClientEvent("onSpawn2", getRootElement()) --outputChatBox("Debug test2" , 255,0,0) elseif predCount > aliCount then triggerClientEvent("evenTeamsMessage2", getRootElement()) elseif predCount < aliCount then setPlayerTeam (source, pred) triggerClientEvent("onSpawn", getRootElement()) end end addEvent("evenTeams", true) addEventHandler("evenTeams", getRootElement(), evenPredTeams) function onSpawn2() guiSetVisible(ali, false) guiSetVisible(startImage, false) guiSetVisible(pred, false) guiSetVisible(label1, false) guiSetVisible(label2, false) guiSetVisible(label3, false) guiSetVisible(label4, false) guiSetVisible(label5, false) guiSetVisible(label6, false) showCursor(false) triggerServerEvent("spawnHerePlayer", getLocalPlayer()) end addEvent("onSpawn2", true) addEventHandler("onSpawn2", getRootElement(), onSpawn2) function spawnHerePlayer(source) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 22) end addEvent("spawnHerePlayer", true) addEventHandler("spawnHerePlayer", getRootElement(), spawnHerePlayer) Its really confusing and hurts my head xP Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 (edited) So you trigger all in root https://wiki.multitheftauto.com/wiki/Element_tree triggerClientEvent("onSpawn2", getRootElement()) replace with: triggerClientEvent( thePlayer,"onSpawn2",thePlayer ) or if thePlayer nil ( idk thePlayer is empty not used argument in your function i not see how you trigger event "evenTeams" and what is source in your event( player,ped or something ) ) triggerClientEvent( source,"onSpawn2",source ) and replace function spawnHerePlayer(source) fadeCamera(source, true) spawnPlayer(source, 0,0,5) setCameraTarget(source) setElementModel(source, 22) end addEvent("spawnHerePlayer", true) addEventHandler("spawnHerePlayer", getRootElement(), spawnHerePlayer) with this function spawnHerePlayer( ) fadeCamera( source, true ) spawnPlayer( source, 0,0,5 ) setCameraTarget( source ) setElementModel( source, 22 ) end addEvent( "spawnHerePlayer", true ) addEventHandler( "spawnHerePlayer",root, spawnHerePlayer ) if it not working show how you trigger event "evenTeams" or send me in pm your resource. Edited January 2, 2012 by Guest Link to comment
Xeno Posted January 2, 2012 Author Share Posted January 2, 2012 There's a problem with: triggerClientEvent( thePlayer,"onAlienSpawn",thePlayer ) It doesnt seem to trigger the client event Link to comment
Xeno Posted January 2, 2012 Author Share Posted January 2, 2012 Thats fantastic! Thank you very muchly :3 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