Jump to content

Clan system problem


TheIceman1

Recommended Posts

I will do it for you, seems u don't get it ^^

function setleaderplayer () 
     if ( source == GUIEditor_Button[6] ) then 
          if ( getElementData ( localPlayer, "leader" ) ) then 
               local playerNamel = guiGridListGetItemText ( GUIEditor_Grid[2], guiGridListGetSelectedItem ( GUIEditor_Grid[2] ), 1 ) 
               if ( playerNamel ) then 
                    triggerServerEvent ( "setleader",localPlayer, playerNamel) 
               end 
          end 
     end 
end 
  
addEventHandler ( "onClientGUIClick", root, setleaderplayer ) 

addEvent ( "setleader", true ) 
  
function setleader (playerNamel) 
     local playe = getPlayerFromName ( playerNamel ) 
     if ( playe ) then 
          setElementData ( playe, "leader", "leader" ) 
          local acc = getPlayerAccount ( playe ) 
          setAccountData ( acc, "Leader", getElementData ( playe, "leader" ) ) 
          outputChatBox ( "You are promoted to Vice-Leader!", playe, 255, 255,0 ) 
     end 
end 
  
addEventHandler ( "setleader", root, setleader ) 

Link to comment

How can i solve it?I want when i press F3 then players are on grid list but when i click F3 again then it shows me this:mta-screen2013-03-1421-2.png

function setplayers () 
    local clan = getElementData ( localPlayer, "clan" ) 
    for _, playeritems in ipairs ( getElementsByType ( "player" ) ) do 
        local pclan = getElementData ( playeritems, "clan" ) 
        if ( clan == pclan ) then 
            local row = guiGridListAddRow ( GUIEditor_Grid[2] ) 
            guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[2], getPlayerName( playeritems ), false, false ) 
                  if ( getElementData ( playeritems, "leader" ) ) then 
                              guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Leader", false, false ) 
  
                  else   
                              guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Member", false, false ) 
     
                  end    
        end 
    end 
end 
bindKey ( "F3", "down", setplayers ) 
  

Link to comment

guiGridListClear 

==============

try this :

function setplayers () 
guiGridListClear(GUIEditor_Grid[2]) 
    local clan = getElementData ( localPlayer, "clan" ) 
    for _, playeritems in ipairs ( getElementsByType ( "player" ) ) do 
        local pclan = getElementData ( playeritems, "clan" ) 
        if ( clan == pclan ) then 
            local row = guiGridListAddRow ( GUIEditor_Grid[2] ) 
            guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[2], getPlayerName( playeritems ), false, false ) 
                  if ( getElementData ( playeritems, "leader" ) ) then 
                              guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Leader", false, false ) 
  
                  else   
                              guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Member", false, false ) 
     
                  end    
        end 
    end 
end 
bindKey ( "F3", "down", setplayers ) 
  
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...