ednatmp Posted October 11, 2016 Share Posted October 11, 2016 Hi all, several weeks ago I was trying to solve a problem which i can not find solution. I've tried everything and nothing has worked. I need something to check if the user account is banner from the arena, and this code does not work ... Any help? All the code is in client side. The part of the function who call the checker: if checkArenaBan(getAccountNamePlayer(_local), getElementID(arena.Element)) then addNotification("Usted está prohibido en esta arena.", "error") return else etc end The checker: function checkArenaBan(account, arena) local banlist = xmlLoadFile("arenas/acl/banlist.xml") for i, m in ipairs(xmlNodeGetChildren(banlist)) do if xmlNodeGetAttribute(m, "account") == account and xmlNodeGetAttribute(m, "arena") == arena then xmlUnloadFile(banlist) return true else xmlUnloadFile(banlist) return false end end end Link to comment
gghvcffcv Posted October 11, 2016 Share Posted October 11, 2016 I think instead of _local you should put (source) Link to comment
ednatmp Posted October 11, 2016 Author Share Posted October 11, 2016 3 minutes ago, gghvcffcv said: I think instead of _local you should put (source) I defined _local local _local = getLocalPlayer() Link to comment
Adolfram Posted October 11, 2016 Share Posted October 11, 2016 if everything is clientside it might be cheeky because players can edit xml files when it's added on clientside. this is prolly the source of the issue because you might be trying to reach a server xml file on clientside and it naturally cannot reach the file. try serverside Link to comment
ednatmp Posted October 11, 2016 Author Share Posted October 11, 2016 10 minutes ago, Adolfram said: if everything is clientside it might be cheeky because players can edit xml files when it's added on clientside. this is prolly the source of the issue because you might be trying to reach a server xml file on clientside and it naturally cannot reach the file. try serverside Oh right, thank you, but i have a question, how can i use a function from serverside to clientside with a return value, like true or false? Link to comment
Adolfram Posted October 11, 2016 Share Posted October 11, 2016 (edited) you'll use arguments, it's all well explained on wiki. takes some time to understand though. here are related wiki links: https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent it's like passing arguments to a function. pretty handy stuff really you'll use arguments, it's all well explained on wiki. takes some time to understand though. here are related wiki links: https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent it's like passing arguments to a function. pretty handy stuff really. here's an example for you: --serverside addEvent ("myEvent"); --add your event addEventHandler ("myEvent", root, --and its handler function (data) --argument of your data outputChatBox (tostring (data)); --execute end ); --clientside triggerServerEvent ("myEvent", resourceRoot, "My name is Jeff"); --this triggers "myEvent" event added on serverside and outputs "My name is Jeff" on serverside Edited October 11, 2016 by Adolfram 2 Link to comment
Gravestone Posted October 12, 2016 Share Posted October 12, 2016 7 hours ago, Enz0Z said: getAccountNamePlayer Do you have this function? 7 hours ago, Enz0Z said: etc What's 'etc'? Link to comment
ednatmp Posted October 12, 2016 Author Share Posted October 12, 2016 18 hours ago, Adolfram said: you'll use arguments, it's all well explained on wiki. takes some time to understand though. here are related wiki links: https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent it's like passing arguments to a function. pretty handy stuff really you'll use arguments, it's all well explained on wiki. takes some time to understand though. here are related wiki links: https://wiki.multitheftauto.com/wiki/TriggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent it's like passing arguments to a function. pretty handy stuff really. here's an example for you: --serverside addEvent ("myEvent"); --add your event addEventHandler ("myEvent", root, --and its handler function (data) --argument of your data outputChatBox (tostring (data)); --execute end ); --clientside triggerServerEvent ("myEvent", resourceRoot, "My name is Jeff"); --this triggers "myEvent" event added on serverside and outputs "My name is Jeff" on serverside Thanks dude, now I understand. I was wondering if you have Skype so I can help with this problem, because I understood but not how to do it, you can help by Skype? 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