Minotaur Posted June 11, 2013 Posted June 11, 2013 How to i do the skin only for the admins? Please anybody help me
PaiN^ Posted June 11, 2013 Posted June 11, 2013 'onElementModelChange' if not isObjectInACLGroup aclGetGroup setElementModel " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
Minotaur Posted June 11, 2013 Author Posted June 11, 2013 and write to skin id after set element model? so? i think this is not good 'onElementModelChange' if not isObjectInACLGroup aclGetGroup setElementModel 1 And thank you!
aymeness81 Posted June 12, 2013 Posted June 12, 2013 addEventHandler("onElementModelChange", root, function () if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementModel(source, model_id) else outputChatBox("Only Admin Members can take this skin", 0, 255, 0) cancelEvent() end end) Skype: Aymen.trabelsi71 .
Minotaur Posted June 12, 2013 Author Posted June 12, 2013 My console say:Error skin/skin.lua:3 attempt to concatenate global 'accName' ( a nil value ) what is the problem?
aymeness81 Posted June 12, 2013 Posted June 12, 2013 try this. addEventHandler("onElementModelChange", root, function (thePlayer) local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then setElementModel(thePlayer, 1) else outputChatBox("Only Admin Members can take this skin", 0, 255, 0) cancelEvent() end end) Skype: Aymen.trabelsi71 .
Minotaur Posted June 12, 2013 Author Posted June 12, 2013 Not good 5 problem but i thank you for your help
xXMADEXx Posted June 12, 2013 Posted June 12, 2013 You can use a command, and when the player uses the command you can check to see if the player is in the admin ACL... Here is a function i made a while back that might help you. function isPlayerInACL(player,acl) local account = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..account,aclGetGroup(acl))) then return true else return false end end The Ultimate Lua Tutorial! | MTA PHP SDK
Minotaur Posted June 12, 2013 Author Posted June 12, 2013 I created this i think it would be good but i have one problem: '' expected near 'setElementModel' function isPlayerInACL(player,acl) end local account = getAccountName(getPlayerAccount(player)) if (isObjectInACLGroup("user."..account,aclGetGroup(acl))) then end return true setElementModel ( thePlayer, 1 ) else outputChatBox("Only Admin Members can take this skin", 0, 255, 0) return false end end
aymeness81 Posted June 12, 2013 Posted June 12, 2013 This one , you must type the command /adminskin and you may choose your skin id then if the plaayer is aclgroup "Admin" then he will be given this skin, good luck function lol ( player, command ) if ( not isObjectInACLGroup( "user."..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) ) then return end setElementModel(player, your_skin_id) outputChatBox("here is your admin skin", player, 133, 133, 133) end addCommandHandler ( "adminskin", lol ) Skype: Aymen.trabelsi71 .
Minotaur Posted June 12, 2013 Author Posted June 12, 2013 this is good but i have one problem the players can be change this skin themselves for example: im in not logged in type /ss 1 this skin is my
aymeness81 Posted June 12, 2013 Posted June 12, 2013 You need to be logged in to get yourself in an ACL Group... Skype: Aymen.trabelsi71 .
denny199 Posted June 12, 2013 Posted June 12, 2013 You need to change freeroam for that. Sometimes I dream about cheese
Castillo Posted June 12, 2013 Posted June 12, 2013 addEventHandler ( "onElementModelChange", root, function ( oldModel, newModel ) local account = getPlayerAccount ( source ) local accountName = getAccountName ( account ) if ( newModel == 1 and not isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then outputChatBox ( "This skin is restricted to the Admin group.", source, 0, 255, 0 ) setElementData ( source, oldModel ) end end ) That'll set the skin back to what he had if he's not in the Admin group and the skin he's trying to use is 1. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
xXMADEXx Posted June 12, 2013 Posted June 12, 2013 Here: addCommandHandler ( "skin", function ( p ) if ( isPlayerInACL ( p, "Admin" ) ) then setElementModel ( p, 1 ) end end ) function isPlayerInACL(player,acl) local account = getAccountName(getPlayerAccount(player)) if(isObjectInACLGroup("user."..account,aclGetGroup(acl))) then return true else return false end end The Ultimate Lua Tutorial! | MTA PHP SDK
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