Evil-Cod3r Posted March 6, 2012 Share Posted March 6, 2012 (edited) X Edited March 6, 2012 by Guest Link to comment
drk Posted March 6, 2012 Share Posted March 6, 2012 (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 March 6, 2012 by Guest Link to comment
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 lol i fixed it by this outputChatBox(getPlayerName(player) .. Nice to fix things by your self lol Thanx Again Link to comment
drk Posted March 6, 2012 Share Posted March 6, 2012 I thought that you want to output to the player who clicked in the gui element Link to comment
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 (edited) X Edited March 7, 2012 by Guest Link to comment
Castillo Posted March 6, 2012 Share Posted March 6, 2012 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
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 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 ! Link to comment
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 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 Link to comment
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 i also removed 1 cancelEvent and didnt work the same thing Link to comment
Castillo Posted March 6, 2012 Share Posted March 6, 2012 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
Evil-Cod3r Posted March 6, 2012 Author Share Posted March 6, 2012 (edited) X Edited March 7, 2012 by Guest Link to comment
Evil-Cod3r Posted March 7, 2012 Author Share Posted March 7, 2012 Thanx All i fixed it Thanx SoldSnake14 .: Topice Closed . : Link to comment
Castillo Posted March 7, 2012 Share Posted March 7, 2012 You're welcome. Topic locked. Link to comment
Recommended Posts