FR0314 Posted November 21, 2021 Share Posted November 21, 2021 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
The_GTA Posted November 21, 2021 Share Posted November 21, 2021 (edited) Hello FR0314, you cannot use client-side-only functions on the server-side. Did you mean to use triggerEvent instead? Edited November 21, 2021 by The_GTA Link to comment
FR0314 Posted November 21, 2021 Author Share Posted November 21, 2021 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? Link to comment
The_GTA Posted November 21, 2021 Share Posted November 21, 2021 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
FR0314 Posted November 21, 2021 Author Share Posted November 21, 2021 I trigger it from a onPlayerLogin event, serversided. Link to comment
The_GTA Posted November 21, 2021 Share Posted November 21, 2021 (edited) 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 November 21, 2021 by The_GTA Link to comment
CastiaL Posted November 22, 2021 Share Posted November 22, 2021 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
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