Jump to content

getPlayerName


Recommended Posts

Posted (edited)

X

Edited by Guest

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted (edited)

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

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

lol i fixed it by this

outputChatBox(getPlayerName(player) .. 

Nice to fix things by your self lol

Thanx Again

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

I thought that you want to output to the player who clicked in the gui element :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted (edited)

X

Edited by Guest

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted
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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

first BUG is its type 2 times in Chat

seconed Bug is when i take the Talk Power he can Write in Chat and the msg say you cant write here !

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

Copy the script again.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Same what i post

i want if i give you TalkPower You Can Talk

else

if he write in nomal Chat Say You can write in team Chat Only

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

i also removed 1 cancelEvent and didnt work the same thing :x

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

X

Edited by Guest

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

Thanx All i fixed it Thanx SoldSnake14 :$

.: Topice Closed . :

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

You're welcome.

Topic locked.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

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