Jump to content

Find edit


abu5lf

Recommended Posts

function onUpdateMoneyplayersList() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(17,59,166,327,false,WinSend) 
        guiGridListSetSelectionMode(playerList,2) 
        -- Create a players column in the list 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then  
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
                if ( source == bhsh ) then 
            guiGridListClear ( playerList ); 
            local sName = guiGetText ( source ); 
            if ( sName ~= "" ) then 
                for _, pPlayer in ipairs ( getElementsByType 'player' ) do 
                    if string.find ( getPlayerName ( pPlayer ):lower ( ), sName:lower ( ), 1, true ) then  
                       -- local row = guiGridListAddRow ( playerlist ); 
                        guiGridListSetItemText ( playerlist, row, column, getPlayerName ( pPlayer ), false, false ); 
                    end 
                end 
            end 
        end 
    end 
  
  
addEventHandler ( "onClientResourceStart", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientGUIChanged", getRootElement(), onUpdateMoneyplayersList) 

Find edit of the player is not working correctly

Edited by Guest
Link to comment

It's so messy.

Where is function click? And you commented guiGridListAddRow function.

function onUpdateMoneyplayersList() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(17,59,166,327,false,WinSend) 
        guiGridListSetSelectionMode(playerList,2) 
        -- Create a players column in the list 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
                if ( source == bhsh ) then 
            guiGridListClear ( playerList ); 
            local sName = guiGetText ( source ); 
            if ( sName ~= "" ) then 
                for _, pPlayer in ipairs ( getElementsByType 'player' ) do 
                    if string.find ( getPlayerName ( pPlayer ):lower ( ), sName:lower ( ), 1, true ) then 
                        local row = guiGridListAddRow ( playerlist ); 
                        guiGridListSetItemText ( playerlist, row, column, getPlayerName ( pPlayer ), false, false ); 
                    end 
                end 
            end 
        end 
    end 
  
  
addEventHandler ( "onClientResourceStart", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientGUIChanged", getRootElement(), onUpdateMoneyplayersList) 

Link to comment
pList = guiCreateGridList ( 17, 59, 166, 327, false, WinSend ) 
guiGridListSetSelectionMode ( pList, 2 ) 
  
onUpdateMoneyPlayerList = function ( ) 
    local pName = getPlayerName ( localPlayer ) 
    local column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
        addEventHandler ( 'onClientGUIClick', root, click ) -- where is click function? also, put in the start of function "if ( source == pList ) then" 
    elseif ( source == bhsh ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if ( string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientGUIClick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', root, onUpdateMoneyPlayerList ) 

Just a edit. Also, what doesn't works? Player names don't appear?

Link to comment
onUpdateMoneyPlayerList = function ( ) 
    local pName = getPlayerName ( localPlayer ) 
    local column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
        addEventHandler ( 'onClientGUIClick', root, click ) -- where is click function? also, put in the start of function "if ( source == pList ) then" 
    elseif ( source == bhsh ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientGUIClick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', root, onUpdateMoneyPlayerList ) 
  
function click ()  
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( plnmedit, playerName ) 
end 

not work

Edit:

if ( string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) then 

")" expected near "then"

Link to comment

My bad...

pList = guiCreateGridList ( 17, 59, 166, 327, false, WinSend ) 
guiGridListSetSelectionMode ( pList, 2 ) 
  
onUpdateMoneyPlayerList = function ( ) 
    local column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
        addEventHandler ( 'onClientGUIClick', root, click ) 
    elseif ( source == bhsh ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if ( string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientGUIClick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', root, onUpdateMoneyPlayerList ) 
  
function click ( ) 
    if ( source == pList ) then 
        local row, col = guiGridListGetSelectedItem ( source ) 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            local pName = guiGridListGetItemText ( source, row, col ) 
            guiSetText ( plnmedit, tostring ( pName ) ) 
        end 
    end 
end 

Copy all my code, not just a part!

Link to comment
pList = guiCreateGridList ( 17, 59, 166, 327, false, WinSend ) 
column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
  
onUpdateMoneyPlayerList = function ( ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
    elseif ( source == bhsh ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', resourceRoot, onUpdateMoneyPlayerList ) 
  
function click ( ) 
    local row, col = guiGridListGetSelectedItem ( pList ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( pList, row, col ) 
        guiSetText ( plnmedit, playerName ) 
    end 
end 
addEventHandler ( 'onClientGUIClick', pList, click ) 

Link to comment
pList = guiCreateGridList ( 17, 59, 166, 327, false, WinSend ) 
column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
  
onUpdateMoneyPlayerList = function ( ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
    elseif ( source == bhsh ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), 1, true ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', resourceRoot, onUpdateMoneyPlayerList ) 
  
function click ( ) 
    local row, col = guiGridListGetSelectedItem ( pList ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( pList, row, col ) 
        guiSetText ( plnmedit, playerName ) 
    end 
end 
addEventHandler ( 'onClientGUIClick', pList, click ) 

pList = guiCreateGridList ( 17, 59, 166, 327, false, WinSend ) 
column = guiGridListAddColumn ( pList, 'Player', 0.85 ) 
  
onUpdateMoneyPlayerList = function ( ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
        end 
    elseif ( source == bahs ) then 
        guiGridListClear ( pList ) 
        local sName = guiGetText ( source ) 
        if ( sName ~= '' ) then 
            for _, player in ipairs ( getElementsByType 'player' ) do 
                if string.find ( getPlayerName ( player ):lower ( ), sName:lower ( ), -1, true ) then 
                    local row = guiGridListAddRow ( pList ) 
                    guiGridListSetItemText ( pList, row, column, getPlayerName ( player ), false, false ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( 'onClientPlayerChangeNick', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerQuit', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientPlayerJoin', root, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientResourceStart', resourceRoot, onUpdateMoneyPlayerList ) 
addEventHandler ( 'onClientGUIChanged', root, onUpdateMoneyPlayerList ) 
  
  
  
function click ( ) 
    local row, col = guiGridListGetSelectedItem ( pList ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local playerName = guiGridListGetItemText ( pList, row, col ) 
        guiSetText ( plnmedit, playerName ) 
    end 
end 
addEventHandler ( 'onClientGUIClick', pList, click ) 

35632254.png

Link to comment
string.gsub( s, '#%x%x%x%x%x%x', '' ) 

onUpdateMoneyPlayerList = function ( ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            local name = getPlayerName ( player ) 
            guiGridListSetItemText ( pList, row, column, name, "#%x%x%x%x%x%x", ( player ), false, false ) 
            string.gsub( name, "#%x%x%x%x%x%x", "" ) 
        end 
    end 
end 

Link to comment
onUpdateMoneyPlayerList = function ( ) 
    if ( column ) then 
        for _, player in ipairs ( getElementsByType 'player' ) do 
            local row = guiGridListAddRow ( pList ) 
            local name = getPlayerName ( player ) 
            guiGridListSetItemText ( pList, row, column, string.gsub( name, "#%x%x%x%x%x%x", "" ), false, false ) 
        end 
    end 
end 

Is that hard?

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...