JuAnY Posted September 12, 2015 Share Posted September 12, 2015 Hi, Im trying to do a resource to restrict players put the skin of an admin, is for "freeroam" gamemode, but this dont work: function admskin(thePlayer) local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if ( getElementModel ( thePlayer ) == 188 ) then outputChatBox("Skin de admin correcto.",thePlayer,0,255,0) else outputChatBox("ADMIN SIN SKIN.",thePlayer,255,0,0) end else if ( getElementModel ( thePlayer ) == 188 ) then outputChatBox("No puedes usar skin de ADMIN.",thePlayer,255,0,0) setElementModel(thePlayer,14) end end end addEventHandler("onElementModelChange",root,admskin) I need your help please Link to comment
JR10 Posted September 12, 2015 Share Posted September 12, 2015 The element is the source, not a parameter. The first parameter is the old model. function admskin(old) if (getElementType(source) ~= 'player') then return end local account = getPlayerAccount(source) local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if ( getElementModel ( source ) == 188 ) then outputChatBox("Skin de admin correcto.",source,0,255,0) else outputChatBox("ADMIN SIN SKIN.",source,255,0,0) end else if ( getElementModel ( source ) == 188 ) then outputChatBox("No puedes usar skin de ADMIN.",source,255,0,0) setElementModel(source,14) end end end addEventHandler("onElementModelChange",root,admskin) Link to comment
JuAnY Posted September 12, 2015 Author Share Posted September 12, 2015 Thanks JR10 for the reply. Now I get the message at line 13 but dont change the skin, the player still with the admin skin (188). Link to comment
JR10 Posted September 12, 2015 Share Posted September 12, 2015 Perhaps a slight delay might fix it: setTimer(setElementModel, 500, 1, source,14) Link to comment
JuAnY Posted September 12, 2015 Author Share Posted September 12, 2015 Now its working. Thank so much man! 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