Jump to content

[SOLVED]Checking if element data is same.


Anubhav

Recommended Posts

  
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

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 by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...