HerculePoirot Posted April 8, 2014 Share Posted April 8, 2014 Here are the scripts:- The label doesn't shows the rank and deliveries. Server:- function bindRankInfo(player) local accountPlayer = getPlayerAccount(player) local rank = getAccountData(accountPlayer, "Rank") if (rank) then else setAccountData(accountPlayer, "Rank", "Novice") end local deliveries = getAccountData(accountPlayer, "deliveries") if (deliveries) then else setAccountData(accountPlayer, "deliveries", "0") end local team = getPlayerTeam(player) local teamName = getTeamName(team) if ( teamName == "Freight") then triggerClientEvent("rankShow", player, deliveries, rank) end end function binding() bindKey(source,"F5", "up", bindRankInfo) end addEventHandler("onPlayerJoin", getRootElement(), binding) Client :- function jobRankInfo(arg1, arg2) guiSetVisible(GUIEditor.window[2], not guiGetVisible(GUIEditor.window[2])) guiSetText(GUIEditor.label[1], "Your Current Deliveries are :-"..arg1.." You Rank:-"..arg2) guiSetInputEnabled(not guiGetInputEnabled) showCursor ( not isCursorShowing ()) end addEvent("rankShow", true) addEventHandler("rankShow", getRootElement(), jobRankInfo) Link to comment
Saml1er Posted April 8, 2014 Share Posted April 8, 2014 Server side to client side : triggerClientEvent(player,"rankShow", player, deliveries, rank) Client to server side: triggerServerEvent("rankShow", localPlayer, arg1,arg2,arg3,...) Link to comment
HerculePoirot Posted April 8, 2014 Author Share Posted April 8, 2014 Server side to client side : triggerClientEvent(player,"rankShow", player, deliveries, rank) Client to server side: triggerServerEvent("rankShow", localPlayer, arg1,arg2,arg3,...) Not Working Link to comment
Saml1er Posted April 8, 2014 Share Posted April 8, 2014 Replace your code with mine and tell me what does it debugs. function bindRankInfo(player) local accountPlayer = getPlayerAccount(player) local rank = getAccountData(accountPlayer, "Rank") if (rank) then else setAccountData(accountPlayer, "Rank", "Novice") end local deliveries = getAccountData(accountPlayer, "deliveries") if (deliveries) then else setAccountData(accountPlayer, "deliveries", "0") end local team = getPlayerTeam(player) local teamName = getTeamName(team) if ( teamName == "Freight") then if triggerClientEvent(player,"rankShow", player, tostring(deliveries), tostring( rank) ) then outputDebugString(' Event rankShow has been triggered with data: '..tostring(deliveries)..', '..tostring(rank)) end end end function binding() bindKey(source,"F5", "up", bindRankInfo) end addEventHandler("onPlayerJoin", getRootElement(), binding) outputDebugString('Server side: Code Loaded!') client: function jobRankInfo(arg1, arg2) outputDebugString('Client side: Data has been sent from server to client side!') guiSetVisible(GUIEditor.window[2], not guiGetVisible(GUIEditor.window[2])) guiSetText(GUIEditor.label[1], "Your Current Deliveries are :-".. arg1 .." You Rank:-".. arg2) guiSetInputEnabled(not guiGetInputEnabled) showCursor ( not isCursorShowing ()) end addEvent("rankShow", true) addEventHandler("rankShow", getRootElement(), jobRankInfo) outputDebugString('Client side: Code Loaded!') If still this doesn't work then go to your server and login ( you must be an admin ) and type /debugscript 3 Link to comment
Spajk Posted April 10, 2014 Share Posted April 10, 2014 function bindRankInfo(player) local accountPlayer = getPlayerAccount(player) local rank = getAccountData(accountPlayer, "Rank") if (rank) then else rank = "Novice" setAccountData(accountPlayer, "Rank", "Novice") end local deliveries = getAccountData(accountPlayer, "deliveries") if (deliveries) then else deliveries = 0 setAccountData(accountPlayer, "deliveries", 0) end local team = getPlayerTeam(player) local teamName = getTeamName(team) if ( teamName == "Freight") then triggerClientEvent(player, "rankShow", player, deliveries, rank) end end function binding() bindKey(source,"F5", "up", bindRankInfo) end addEventHandler("onPlayerJoin", getRootElement(), binding) Client: function jobRankInfo(arg1, arg2) guiSetVisible(GUIEditor.window[2], not guiGetVisible(GUIEditor.window[2])) guiSetText(GUIEditor.label[1], "Your Current Deliveries are :-"..arg1.." You Rank:-"..arg2) guiSetInputEnabled(not guiGetInputEnabled) showCursor ( not isCursorShowing ()) end addEvent("rankShow", true) addEventHandler("rankShow", getRootElement(), jobRankInfo) Link to comment
HerculePoirot Posted April 10, 2014 Author Share Posted April 10, 2014 function bindRankInfo(player) local accountPlayer = getPlayerAccount(player) local rank = getAccountData(accountPlayer, "Rank") if (rank) then else rank = "Novice" setAccountData(accountPlayer, "Rank", "Novice") end local deliveries = getAccountData(accountPlayer, "deliveries") if (deliveries) then else deliveries = 0 setAccountData(accountPlayer, "deliveries", 0) end local team = getPlayerTeam(player) local teamName = getTeamName(team) if ( teamName == "Freight") then triggerClientEvent(player, "rankShow", player, deliveries, rank) end end function binding() bindKey(source,"F5", "up", bindRankInfo) end addEventHandler("onPlayerJoin", getRootElement(), binding) Client: function jobRankInfo(arg1, arg2) guiSetVisible(GUIEditor.window[2], not guiGetVisible(GUIEditor.window[2])) guiSetText(GUIEditor.label[1], "Your Current Deliveries are :-"..arg1.." You Rank:-"..arg2) guiSetInputEnabled(not guiGetInputEnabled) showCursor ( not isCursorShowing ()) end addEvent("rankShow", true) addEventHandler("rankShow", getRootElement(), jobRankInfo) Not Working, now the GUI is also not opening. Link to comment
Saml1er Posted April 10, 2014 Share Posted April 10, 2014 Go to your server and login and type /debugscript 3 Please tell us what does it output. Link to comment
HerculePoirot Posted April 11, 2014 Author Share Posted April 11, 2014 Go to your server and login and type /debugscript 3Please tell us what does it output. No error is shown Link to comment
XeniusORIGINAL Posted April 11, 2014 Share Posted April 11, 2014 bool triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] ) 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