R3ter Posted June 12, 2016 Share Posted June 12, 2016 addEventHandler("onClientResourceStart", resourceRoot, function() score = guiCreateLabel(584, 244, 104, 42, "+100", false) guiSetFont(score, "sa-header") guiSetVisible(score,false) addEventHandler("onClientPlayerWasted",localPlayer, function (killer) guiSetVisible(score,true) end) end ) how can show this to the killer (it shows to the player who died) its on client-side Link to comment
Bean666 Posted June 12, 2016 Share Posted June 12, 2016 because you're using onClientPlayerWasted only. you can use triggerClientEvent way easier. if you want u can still use client , make sure to use "attacker" sorry for mistakes if i have ( not tested ) example: client: addEvent("showGUI", true) function guishow(player) guiSetVisible(score, true) end addEventHandler("showGUI",getRootElement(),guishow) server: function kill (attacker, weapon, bodypart, loss) if (attacker) then triggerClientEvent ( attacker, "showGUI", attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) Link to comment
R3ter Posted June 12, 2016 Author Share Posted June 12, 2016 because you're using onClientPlayerWasted only. you can use triggerClientEvent way easier. if you want u can still use client , make sure to use "attacker" sorry for mistakes if i have ( not tested )example: client: addEvent("showGUI", true) function guishow(player) guiSetVisible(score, true) end addEventHandler("showGUI",getRootElement(),guishow) server: function kill (attacker, weapon, bodypart, loss) if (attacker) then triggerClientEvent ( attacker, "showGUI", attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) i don't know how is that (triggerClientEvent) and all these stuff work,so i prefer to keep my script in on side but i don't know where should i put (killer), and you'r code is not working.. Link to comment
R3ter Posted June 12, 2016 Author Share Posted June 12, 2016 because you're using onClientPlayerWasted only. you can use triggerClientEvent way easier. if you want u can still use client , make sure to use "attacker" sorry for mistakes if i have ( not tested )example: client: addEvent("showGUI", true) function guishow(player) guiSetVisible(score, true) end addEventHandler("showGUI",getRootElement(),guishow) server: function kill (attacker, weapon, bodypart, loss) if (attacker) then triggerClientEvent ( attacker, "showGUI", attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) can u help me?? Link to comment
Bean666 Posted June 12, 2016 Share Posted June 12, 2016 u wont need to keep ur code in one side, it 's simple, i don't see anything wrong in my code, just paste the client code i sent to your client side and paste the server code i sent to your server side. do /debugscript 3 then start the resource then test it, if it dont work tell me the errors shown in the debug below. also remove this fuNCTION in client side, you wont need it : addEventHandler("onClientPlayerWasted",localPlayer, function (killer) guiSetVisible(score,true) end) end ) Link to comment
Bean666 Posted June 12, 2016 Share Posted June 12, 2016 sorry for double post but try changing attacker to killer, i don't think it will make any changes but try function kill (killer, weapon, bodypart, loss) if (killer) then triggerClientEvent ( killer, "showGUI", killer ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) 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