Jump to content

Problem in Client


ednatmp

Recommended Posts

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

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
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

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 by Adolfram
  • Like 2
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...