MisaFix Posted September 13, 2021 Share Posted September 13, 2021 I tried to write a script that takes your weapons if you are not in the acl group EGM but it fails i dont know why. Can you guys please help me? Im new on scripting function test1 ( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "EGM" ) ) then else takeWeapon (player) outputChatBox ( "Tagın olmadığı için silahların alındı.", player, 255, 0, 0, true ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), test1 ) Link to comment
βurak Posted September 13, 2021 Share Posted September 13, 2021 function test1() local playerAccount = getPlayerAccount(source) if(isGuestAccount(playerAccount) == false) then local accName = getAccountName(playerAccount) if not isObjectInACLGroup("user."..accName, aclGetGroup("EGM")) then takeAllWeapons(source) outputChatBox ("Tagın olmadığı için silahların alındı.", source, 255, 0, 0, true) end end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), test1) try this Link to comment
MisaFix Posted September 13, 2021 Author Share Posted September 13, 2021 12 minutes ago, Burak5312 said: function test1() local playerAccount = getPlayerAccount(source) if(isGuestAccount(playerAccount) == false) then local accName = getAccountName(playerAccount) if not isObjectInACLGroup("user."..accName, aclGetGroup("EGM")) then takeAllWeapons(source) outputChatBox ("Tagın olmadığı için silahların alındı.", source, 255, 0, 0, true) end end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), test1) try this Thank you so much, it works. But i have one more question. How can i make it for multiple groups? Like EGM, TEST2, TEST3 etc. Link to comment
βurak Posted September 13, 2021 Share Posted September 13, 2021 (edited) You can use hasObjectPermissionTo You can give the authority to use weapons to the groups you want. If you add this to the group's acl rights, that group will be able to use weapons. otherwise their weapons will be taken <right name="permission.weaponUse" access="true"></right> and change your lua code like this function test1() local playerAccount = getPlayerAccount(source) if(isGuestAccount(playerAccount) == false) then local accName = getAccountName(playerAccount) if(hasObjectPermissionTo(source, "permission.weaponUse", false) == false) then takeAllWeapons(source) outputChatBox ("Tagın olmadığı için silahların alındı.", source, 255, 0, 0, true) end end end addEventHandler("onPlayerWeaponSwitch", getRootElement(), test1) Edited September 13, 2021 by Burak5312 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