Jump to content

getPlayerName


Recommended Posts

Source is the clicked gui element.

addEventHandler ( 'onClientGUIClick', root, 
    function () 
        if ( source == GUIEditor_Button[1] ) then 
            local row,col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
            local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
            local player = getPlayerFromName ( playerName ) 
            setElementData ( player,'canChat',true ) 
            outputChatBox( 'You Have Give Him Talk Power !',localPlayer, 255,255,0 ) 
            playSound ( 'sounds/talkpower_granted.wav' ) 
            outputChatBox ( getPlayerName(localPlayer) .. 'Has Been given Talk Power By The Admin !', 255, 255, 0 ) 
        end 
        elseif ( source == GUIEditor_Button[2] ) then 
            local row,col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
            local playerName = guiGridListGetItemText ( GUIEditor_Grid[1], row, 1 ) 
            local player = getPlayerFromName ( playerName ) 
            setElementData ( player, 'canChat', false ) 
            outputChatBox ( 'You Have Remove His Talk Power !', localPlayer, 255, 255, 0 ) 
            playSound ( 'sounds/talkpower_revoked.wav' ) 
            outputChatBox ( getPlayerName(localPlayer) .. ' Talk Power Has Been Removed Form Him By The Admin !', 0, 255, 255 ) 
            end 
        end 
    end 
) 

Edited by Guest
Link to comment
addEventHandler("onPlayerChat",root, 
    function (msg, msgType) 
        local canChat = getElementData(source,"canChat") 
        local r, g, b = getPlayerNametagColor(source) 
        if (msgType == 0 and canChat) then 
            cancelEvent() 
            outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg, root, r, g, b, true) 
        else 
            cancelEvent() 
        end 
        if (msgType == 2 and getPlayerTeam(source)) then 
            if (canChat) then 
                cancelEvent() 
                for index, player in ipairs(getPlayersInTeam(getPlayerTeam(source))) do 
                    outputChatBox("[TEAM]: ".. getPlayerName(source) .. ': #FFFFFF' .. msg, player, r, g, b, true) 
                end 
            else 
                outputChatBox("Warring- You Cant Type in This Chat !",source,255,255,255,true) 
            end 
        end 
    end 
) 

Link to comment
addEventHandler("onPlayerChat",root, 
    function (msg, msgType) 
        local canChat = getElementData(source,"canChat") 
        local r, g, b = getPlayerNametagColor(source) 
        if (msgType == 0 and canChat) then 
            outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg, root, r, g, b, true) 
        elseif (msgType == 2 and getPlayerTeam(source) and not canChat) then 
            for index, player in ipairs(getPlayersInTeam(getPlayerTeam(source))) do 
                outputChatBox("[TEAM]: ".. getPlayerName(source) .. ': #FFFFFF' .. msg, player, r, g, b, true) 
            end 
        end 
        cancelEvent() 
    end 
) 

If that's not what you wanted, then you should either search for someone who understand's you in your native language or learn to fix your problem on your own.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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