Annas Posted August 22, 2015 Posted August 22, 2015 Hello community members, Just i need something , when a player in ACL group Name , it setElementData "something" , i tried to make this: SERVER SIDE function hitdbs(player) accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL1" )) then setElementData (player, "CSThit", "DL1") end if isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL2" )) then setElementData (player, "CSThit", "DL2") end if isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL3" )) then setElementData (player, "CSThit", "DL3") else setElementData (player, "CSThit", "None") end end end When a player in DL1 Acl group , i need this element data setted to him ("CSThit", "DL1") , and when a player DL2 ("CSThit", "DL2") and DL3 ("CSThit", "DL3") , but not work , please help me , i can explain more.. , and i need it if you enter exemple to acl DL1 , it added that element data ("CSThit", "DL1") and when i leave it it back to 0 ("CSThit", "None") Sorry for my bad english
JR10 Posted August 22, 2015 Posted August 22, 2015 You should use elseif not just if. You have an extra end as well. function hitdbs(player) accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL1" )) then setElementData (player, "CSThit", "DL1") elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL2" )) then setElementData (player, "CSThit", "DL2") elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL3" )) then setElementData (player, "CSThit", "DL3") else setElementData (player, "CSThit", "None") end end Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Annas Posted August 22, 2015 Author Posted August 22, 2015 it's not work .. there is no "if Resource Start" ? , i mean , if i start the script so it make this all ..
JR10 Posted August 22, 2015 Posted August 22, 2015 I thought this was part of your code. If this is the full code then you need to use it with onPlayerLogin. function hitdbs(old, new) local accName = getAccountName(new) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL1" )) then setElementData (source, "CSThit", "DL1") elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL2" )) then setElementData (source, "CSThit", "DL2") elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "DL3" )) then setElementData (source, "CSThit", "DL3") else setElementData (source, "CSThit", "None") end end addEventHandler('onPlayerLogin', root, hitdbs) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Walid Posted August 22, 2015 Posted August 22, 2015 You don't need to do all fo this simply it can be like this. local dlGroups = { "DL1", "DL2", "DL3"}; addEventHandler ( "onPlayerLogin", root, function ( _, theAccount ) for a, g in ipairs (dlGroup) do if ( isObjectInACLGroup ( "user."..getAccountName(theAccount) , aclGetGroup (g))) then setElementData (source, "CSThit", "DL"..a) return; end end end ); Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
JR10 Posted August 22, 2015 Posted August 22, 2015 Most of the times it's better to edit the given code rather than provide an unnecessary changed one. This way, the user can understand his problems better. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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