Evil-Cod3r Posted February 1, 2012 Share Posted February 1, 2012 (edited) ........ Fixed Thx Edited February 2, 2012 by Guest Link to comment
NeXTreme Posted February 1, 2012 Share Posted February 1, 2012 I have no idea what you want, try to explain it better? Link to comment
Evil-Cod3r Posted February 1, 2012 Author Share Posted February 1, 2012 this script use For Spar /Cw its Cancel the Type in NorMal Chat and let them Type in team Chat how to Make it Select 1 Form Red Team to talk in the Normal chat and Select 1 Form Blue Team To Talk in the Normal Chat and the Rest of Player Type in team Only Link to comment
Al3grab Posted February 1, 2012 Share Posted February 1, 2012 maybe : function noChat( msg,messageType ) if messageType == 0 then local canChat = getElementData(source,"canChat") if not canChat then if not tCounts[ source ] then tCounts[ source ] = 0 end if tCounts[ source ] ~= Max then tCounts[ source ] = tCounts[ source ] + 1 outputChatBox( "Sorry you cant use this chat, use team chat", source, 255, 0, 0 ) if isTimer( tTimerInterv[ source ] ) then killTimer( tTimerInterv[ source ] ) end tTimerInterv[ source ] = setTimer( function( player ) tCounts[ player ] = 0 end, interv*1000, 1,source ) else if not isPlayerMuted( source ) then setPlayerMuted( source,true ) outputChatBox( "Sorry you are muted For Flooding !", source, 255, 0, 0 ) if isTimer( tTimer[ source ] ) then killTimer( tTimer[ source ] ) end tTimer[ source ] = setTimer( function( player ) outputChatBox( "You are unmuted dont Try Flood in Chat !", player, 255, 0, 0 ) setPlayerMuted( player,false ) tCounts[ player ] = 0 end, Time*1000, 1,source ) end end cancelEvent( ) end end end addEventHandler( "onPlayerChat", root, noChat ) addEventHandler( "onPlayerQuit", root, function( ) tTimerInterv[ source ] = nil tTimer[ source ] = nil tCounts[ source ] = nil end ) addCommandHandler("canChat",function(me,c,him,state) local him = getPlayerFromName(him) if him and state then setElementData(him,"canChat",state) outputChatBox(getPlayerName(him).. " chat state has been set to "..state) end end ) use command /canChat Link to comment
Evil-Cod3r Posted February 1, 2012 Author Share Posted February 1, 2012 is there other way Like an Gui Window ? Link to comment
Al3grab Posted February 1, 2012 Share Posted February 1, 2012 is there other way Like an Gui Window ? you can make it with gui with the same idea Link to comment
Evil-Cod3r Posted February 1, 2012 Author Share Posted February 1, 2012 (edited) ........ Fixed Thx Edited February 2, 2012 by Guest Link to comment
Evil-Cod3r Posted February 1, 2012 Author Share Posted February 1, 2012 Please any one Al3grab i have made the windows what i dot next Help me to Made it Please Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 at least can some one give me the functions and events ? Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 What are you trying to achieve? could you explain us at least? Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 Castillo i want like Al3grab Say if i Select a Player and Press Yes Button then he can write in Normal chat if i Press No He Can write in Team Chat Only Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 -- client side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(372,198,451,297,"Anti-Chat V2.0 For Spar/Cw",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,24,248,264,false,GUIEditor_Window[1]) guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.80) GUIEditor_Button[1] = guiCreateButton(269,26,138,35,"Yes",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(263,95,161,32,"No",false,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(256,135,168,139,"images/mtalogo.png",false,GUIEditor_Window[1]) function loadPlayersToGrid() guiGridListClear(GUIEditor_Grid[1]) for index, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) end end loadPlayersToGrid() addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 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) 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) end end end) -- server side: 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) cancelEvent() else cancelEvent() end if (msgType == 2 and not canChat and getPlayerTeam(source)) then for index, player in ipairs(getPlayersInTeam(getPlayerTeam(source))) do outputChatBox("[TEAM]: ".. getPlayerName(source) .. ': #FFFFFF' .. msg, player, r, g, b, true) end cancelEvent() end end) Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 SoldSnake if i press Yes He type 2 times ? and if i press no he let me type my points is yes= can talk but 2 times ? no = talk team Chat Only not in noraml Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 Yes, I forgot to cancel the original message, copy the server side again. Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 SoldSnake one more thing my frind how can i make the Panel Show for admin only and if he Select Player and press 1 Play sound and if he press 2 Play another sound i have the sound but i need show the Panel for admin only and code Play Sound Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 (edited) ........ Fixed Thx Edited February 2, 2012 by Guest Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 -- client side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(372,198,451,297,"Anti-Chat V2.0 For Spar/Cw By Evil-Cod3r",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,24,248,264,false,GUIEditor_Window[1]) guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.80) GUIEditor_Button[1] = guiCreateButton(269,26,138,35,"Yes",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(263,95,161,32,"No",false,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(256,135,168,139,"images/mtalogo.png",false,GUIEditor_Window[1]) function loadPlayersToGrid() guiGridListClear(GUIEditor_Grid[1]) for index, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) end end loadPlayersToGrid() addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 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 !",source, 255,255,0) playSound("sounds/talkpower_granted.wav") 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 !",source, 255,255,0) playSound("sounds/talkpower_revoked.wav") end end end) function toggleGUI() if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end end addEvent("toggleGUI",true) addEventHandler("toggleGUI",root,toggleGUI) -- server side: 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) cancelEvent() else cancelEvent() end if (msgType == 2 and getPlayerTeam(source)) then for index, player in ipairs(getPlayersInTeam(getPlayerTeam(source))) do outputChatBox("[TEAM]: ".. getPlayerName(source) .. ': #FFFFFF' .. msg, player, r, g, b, true) end cancelEvent() end end) addEventHandler("onPlayerJoin",root, function () bindKey(source,"F3","down",showGUI) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"F3","down",showGUI) end end) function showGUI(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then triggerClientEvent(thePlayer,"toggleGUI",thePlayer) end end Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 its Run No Proplem but need simple thing if he press F3 and he is not admin outputChatBox("You Muste Be Admin ..") and if he admin and press F3 show and hide the window just these 2 things Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 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) cancelEvent() else cancelEvent() end if (msgType == 2 and getPlayerTeam(source)) then for index, player in ipairs(getPlayersInTeam(getPlayerTeam(source))) do outputChatBox("[TEAM]: ".. getPlayerName(source) .. ': #FFFFFF' .. msg, player, r, g, b, true) end cancelEvent() end end) addEventHandler("onPlayerJoin",root, function () bindKey(source,"F3","down",showGUI) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"F3","down",showGUI) end end) function showGUI(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then triggerClientEvent(thePlayer,"toggleGUI",thePlayer) else outputChatBox("You must be an admin.",thePlayer,255,0,0) end end Link to comment
Evil-Cod3r Posted February 2, 2012 Author Share Posted February 2, 2012 Thank You So Mutch Castillo i owe 1 Realy Realy Awosem Man Now Your in the Credits Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now