EngMohamedLish Posted June 7, 2015 Share Posted June 7, 2015 When i click on the button, the player don't spawn, here. Could you help? No bugs found, on debugscript 3 Client: function useage(button, state) if not button == "left" and not state== "up" then return end triggerServerEvent("Clicked", source) destroyElement(spawn) showCursor(false) end addEventHandler ("onClientGUIClick", spawn, useage) Server: addEvent("Clicked", true) addEventHandler ("Clicked", root, function() spawnPlayer(source, 2287.66113, 558.75110, 7.78125) fadeCamera (source, true) setCameraTarget(source, source) end) Link to comment
Enargy, Posted June 7, 2015 Share Posted June 7, 2015 function useage(button, state) if button == "left" and state == "down" then triggerServerEvent("Clicked", source) destroyElement(spawn) showCursor(false) end end addEventHandler ("onClientGUIClick", spawn, useage) Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 function useage(button, state) if button == "left" and state == "down" then triggerServerEvent("Clicked", source) destroyElement(spawn) showCursor(false) end end addEventHandler ("onClientGUIClick", spawn, useage) Actually, It made no sense, still the same problem, but now the button doesn't even disappear... It was working correctly about the part of "if not" anyways, do you have a solution? Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 function useage(button, state) if button == "left" and state == "down" then triggerServerEvent("Clicked", source) destroyElement(spawn) showCursor(false) end end addEventHandler ("onClientGUIClick", spawn, useage) Actually, It made no sense, still the same problem, but now the button doesn't even disappear... It was working correctly about the part of "if not" anyways, do you have a solution? And you know? When anyone die, the gui be shown to everyone... How to fix that, as well? Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 it should be like this -- Client side function useage(button, state) if not button == "left" and not state== "up" then return end triggerServerEvent("Clicked", localPlayer) destroyElement(spawn) showCursor(false) end addEventHandler ("onClientGUIClick", spawn, useage,false) -- Server side addEvent("Clicked", true) addEventHandler ("Clicked", root, function() spawnPlayer(source, 2287.66113, 558.75110, 7.78125) fadeCamera (source, true) setCameraTarget(source, source) end ) Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 it should be like this -- Client side function useage(button, state) if not button == "left" and not state== "up" then return end triggerServerEvent("Clicked", localPlayer) destroyElement(spawn) showCursor(false) end addEventHandler ("onClientGUIClick", spawn, useage,false) -- Server side addEvent("Clicked", true) addEventHandler ("Clicked", root, function() spawnPlayer(source, 2287.66113, 558.75110, 7.78125) fadeCamera (source, true) setCameraTarget(source, source) end ) Alright, it works , But i didn't try it with another play, to see if it will appear to everyone, when someone dies, do you know if it'll appear or not? And another thing, is it possible to make the camera look at the player, from the top side, the up side? like "setCameraTarget, but camera target just look to player from the back, i need it to look from up side, is it possible? Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 do it by yourself then post your code here and we will help you. setCameraMatrix() Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 do it by yourself then post your code here and we will help you. setCameraMatrix() I made it myself ! And works fine, thanks for your guide, anyways, about the script, will the gui appear to all players, when someone dies ? It happened before it be solved, will it happen again? and if no, why? and how to specify a gui to open for players whose the event happened to them. Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 as i can see u didn't use onClientPlayerWasted event in ur code, i think it's just a part. post full code here. Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 as i can see u didn't use onClientPlayerWasted event in ur code, i think it's just a part.post full code here. SERVER addEventHandler ("onPlayerWasted", root, function() triggerClientEvent ("showButton", source) end CLIENT addEvent("showButton", true) addEventHandler ("showButton", root, function() guiSetVisible (spawn, true) showCursor (true) end Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 it should work addEventHandler ("onPlayerWasted", root, function() triggerClientEvent (source,"showButton", source) end Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 it should work addEventHandler ("onPlayerWasted", root, function() triggerClientEvent (source,"showButton", source) end Before using it, could you explain me it ? What difference happened? Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 Before using it, could you explain me it ? What difference happened? You can find every thing on the wiki page about triggerClientEvent. triggerClientEvent (sendTo, theEventName,sourceElement, arg...) sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements. Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 Before using it, could you explain me it ? What difference happened? You can find every thing on the wiki page about triggerClientEvent. triggerClientEvent (sendTo, theNameOfTheEvent,sourceElement, arg...) sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements. COOL, what about the sourceElement? what is that? I didn't get it, when i read it. Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 COOL, what about the sourceElement? what is that? I didn't get it, when i read it. as i told you read the wiki page sourceElement: The element that is the source of the event. Link to comment
EngMohamedLish Posted June 7, 2015 Author Share Posted June 7, 2015 COOL, what about the sourceElement? what is that? I didn't get it, when i read it. as i told you read the wiki page sourceElement: The element that is the source of the event. I said, i read it through the wiki, but i didn't get what it means, I need more good explanation, could you explain it more, if possible? Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 I said, i read it through the wiki, but i didn't get what it means, I need more good explanation, could you explain it more, if possible? the sourceElement is the element that performed the action. 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