TrickyTommy Posted October 1, 2017 Share Posted October 1, 2017 Hi! I want serverside variables be drawn on my screen. This is what i have done so far, the script is not really working, but there are no errors, but it draws "nil". What i have done so far: Server: CanPlayerChooseTeam = false CanPlayerChooseCharacter = true function CanChooseTeam() return CanPlayerChooseTeam end addEvent ("CanChooseTeam", true) addEventHandler ("CanChooseTeam", root, CanChooseTeam) function CanChooseCharacter() return CanPlayerChooseCharacter end addEvent ("CanChooseCharacter", true) addEventHandler ("CanChooseCharacter", root, CanChooseCharacter) function SendDatasToDebug(BoolTeam, BoolChar) if BoolChar then BoolTeam = CanPlayerChooseTeam BoolChar = CanPlayerChooseCharacter triggerClientEvent ("RecieveDatas", root, BoolTeam, BoolChar) end end addEvent ("SendDatasToDebug", true) addEventHandler ("SendDatasToDebug", root, SendDatasToDebug) function ModifyDefaultChooseValues(Client, Command, Factor, Value) if Value then if Factor == "team" and Value == "true" then CanPlayerChooseTeam = true end if Factor == "team" and Value == "false" then CanPlayerChooseTeam = false end if Factor == "character" and Value == "true" then CanPlayerChooseCharacter = true end if Factor == "character" and Value == "false" then CanPlayerChooseCharacter = false end end end addCommandHandler ("mchoose", ModifyDefaultChooseValues) Client: function RecieveDatas(BoolTeam, BoolChar) if BoolChar then BoolTeam = BoolTeam BoolChar = BoolChar end end addEvent ("RecieveDatas", true) addEventHandler ("RecieveDatas", root, RecieveDatas) function RenderDebugHud() triggerServerEvent ("SendDatasToDebug", root, BoolTeam, BoolChar) dxDrawText ("Engedélyezett csapatválasztás: "..tostring(BoolTeam).."", 500, 500) end addEventHandler ("onClientRender", root, RenderDebugHud) Link to comment
Moderators IIYAMA Posted October 1, 2017 Moderators Share Posted October 1, 2017 function RecieveDatas(BoolTeam_, BoolChar_) if BoolChar_ then BoolTeam = BoolTeam_ BoolChar = BoolChar_ end end Parameters are local variables. They can't leave the function block. A simple underline _ after the variable makes it a different variable. function functionName(parameter1, parameter2) -- function block end Link to comment
TrickyTommy Posted October 2, 2017 Author Share Posted October 2, 2017 still not working, i started debugging it, and changed serverscript's line 21 to output into chatbox if not boolchar. (else) what went wrong? 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