Anubhav Posted March 15, 2014 Share Posted March 15, 2014 (edited) How to check if the element data is same? example; If i have a group I want to promote someone (command) then i will use /promote PLAYERNAME . How to check that if the player matches in the founders group/ Edited March 15, 2014 by Guest Link to comment
Anubhav Posted March 15, 2014 Author Share Posted March 15, 2014 Any help please? I realy need to make it fast. Link to comment
NeO_DUFFMAN Posted March 15, 2014 Share Posted March 15, 2014 Can you paste your code (Only parts that are relevant to your problem) ? I need to know how your system works. Link to comment
Anubhav Posted March 15, 2014 Author Share Posted March 15, 2014 function promote(source,command,rank,playerName,getLeader) local getLeader = getElementData(source,"safr.GFounder") or getElementData(source,"safr.GLeader") local playerName = getPlayerFromName(playerName) local group = getElementData(playerName,"safr.Group") local gorup = getElementData(group,"safr.Group") if not playerName then outputChatBox("[GANG] No player like"..playerName,source) return elseif not group then outputChatBox("[GANG] The player is not in a group.",source) return elseif not getLeader then outputChatBox("[GANG] You are not a leader/founder!",source) elseif getLeader and playerName and gorup then -- How to check if data is same? end end addCommandHandler("promote",promote) Here is it. Link to comment
NeO_DUFFMAN Posted March 15, 2014 Share Posted March 15, 2014 (edited) You can actually simplify your code by using one line statements. Anyway, check if the group element data of the founder matches the player's group data or not. Add the following line in your code: if group == getElementData(playerName, "safr.Group") then --your code else -- your message end I actually wanted to rewrite your function in a more simplified form but since I'm trying to make this post with my pathetically annoying blackberry, I doubt ill be able to lol. * Also, don't know why you're defining gorup. Edited March 15, 2014 by Guest Link to comment
Anubhav Posted March 15, 2014 Author Share Posted March 15, 2014 Thanks alot! Do you have skype? So please add me anubhav.agarwal87 i need to ask you a question. Link to comment
NeO_DUFFMAN Posted March 15, 2014 Share Posted March 15, 2014 You're welcome. I do have Skype but I can't come online at the moment. Feel free to send me a private message here. 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