Jump to content

Need help with command


FR0314

Recommended Posts

Both of my codes are on server side;

function phoenix( player )
		local accName = getAccountName (getPlayerAccount ( player ))
		if isObjectInACLGroup("user."..accName, aclGetGroup ( "Moderator" )) or isObjectInACLGroup("user."..accName, aclGetGroup ( "Admin" )) then

				triggerServerEvent('phoenix', root, player)

		end
end

addCommandHandler ( "phoenix", phoenix )
function phoenixLogin( player )
	--code
end

addEvent('phoenix', true)
addEventHandler("phoenix", root, phoenixLogin)

This comes back with the error code of: "resourcename/the-first-code.lua:16 attempt to call global 'triggerServerEvent' (a nil value)"

What could be the problem?

Link to comment
1 minute ago, FR0314 said:

I've meant to use that, yes. Thanks for the help!
I also want to make code here to check the name of the person who triggered the event.
if getPlayerName(player) == phoenix then
this doesn't work for some reason, could you sort it out please?

Your "phoenix" event is marked for remote-availability. Do you trigger the event from any client-side aswell?

Link to comment
2 minutes ago, FR0314 said:

I trigger it from a onPlayerLogin event, serversided.

If you don't trigger it from any client-sde, then remove the "true" parameter from the addEvent call for "phoenix". Also, you have not shown me the code location you mentioned. Do you care about doing it?

Edited by The_GTA
Link to comment
function phoenix( player )
		local accName = getAccountName (getPlayerAccount ( player ))
		if isObjectInACLGroup("user."..accName, aclGetGroup ( "Moderator" )) or isObjectInACLGroup("user."..accName, aclGetGroup ( "Admin" )) then

				triggerEvent('phoenix', root, player)

		end
end

addCommandHandler ( "phoenix", phoenix )
function phoenixLogin( player )
	--code
end

addEvent('phoenix', true)
addEventHandler("phoenix", root, phoenixLogin)

 

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