Jump to content

Some Help Over Here


Evil-Cod3r

Recommended Posts

Posted

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 :D

Posted

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

Posted

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

Posted

SoldSnake one more thing my frind :D

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 :D

Posted

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

Posted

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 :D

just these 2 things :D

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

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