Jump to content

How to do this?


Recommended Posts

Could u give me an example with this?

addEventHandler ( "onPlayerChat", root, 
    function ( message ) 
        if ( message == "lol" ) then 
            cancelEvent ( ) 
            outputChatBox("Message",root,255,255,0,true) 
        end 
    end 
) 

Link to comment
addEventHandler( "onPlayerChat", root, 
    function ( message ) 
        if message:find( "lol" ) then 
            cancelEvent( ) 
            outputChatBox( "Message", root, 255, 255, 0, true ) 
        end 
    end 
) 

Link to comment

Hello Gamer Try this :) :

-- # Server Side ! 
  
local LastMassage = 0 
  
addEventHandler('onPlayerChat',root, 
 function ( message )  
    if string.find ( message,'lol' ) then 
       LastMassage = LastMassage +1 
         if LastMassage == 4 then 
            setPlayerMuted ( source,true ) 
            outputChatBox('You said lol 4 times you are muted now!',source,255,0,0) 
        setTimer ( 
            function (  source  ) 
                setPlayerMuted ( source,false ) 
                LastMassage = 0 
                outputChatBox('You are unmuted now!',source,0,255,0) 
            end,120000,1,source 
            ) 
        end 
    end 
end 
) 

Add the resource to the acl for the mute function ( resource.ResourceName ) ! And try it and tell me :) !

Link to comment
  
addEventHandler("onClientRender", root, 
    function() 
        dxDrawText("lol", 162, 131, 325, 163, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("!!", 421, 131, 584, 163, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("d", 163, 342, 417, 363, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("draw.", 166, 363, 541, 381, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
    end 
) 
  

Do u know how to use drawText ONLY when the window "wnd" is opened?

Link to comment
  
addEventHandler("onClientRender", root, 
  function (  ) 
    if guiGetVisible ( MyWindow ) then 
        dxDrawText("lol", 162, 131, 325, 163, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("!!", 421, 131, 584, 163, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("d", 163, 342, 417, 363, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("draw.", 166, 363, 541, 381, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) 
    end 
end 
) 
  

Link to comment
Hello Gamer Try this :) :

-- # Server Side ! 
  
local LastMassage = 0 
  
addEventHandler('onPlayerChat',root, 
 function ( message )  
    if string.find ( message,'lol' ) then 
       LastMassage = LastMassage +1 
         if LastMassage == 4 then 
            setPlayerMuted ( source,true ) 
            outputChatBox('You said lol 4 times you are muted now!',source,255,0,0) 
        setTimer ( 
            function (  source  ) 
                setPlayerMuted ( source,false ) 
                LastMassage = 0 
                outputChatBox('You are unmuted now!',source,0,255,0) 
            end,120000,1,source 
            ) 
        end 
    end 
end 
) 

Add the resource to the acl for the mute function ( resource.ResourceName ) ! And try it and tell me :) !

This will make it a global variable, meaning that if another player says "lol", it'll increase the variable. He should use a table instead.

Link to comment
-- # Server Side ! 
  
local LastMassage = { } 
  
addEventHandler('onPlayerChat',root, 
    function ( message ) 
        if string.find ( message,'lol' ) then 
            if LastMassage[source] then 
                LastMassage[source] = LastMassage[source] + 1 
            else 
                LastMassage[source] = 1 
            end 
            if LastMassage[source] == 4 then 
                setPlayerMuted ( source,true ) 
                outputChatBox('You said lol 4 times you are muted now!',source,255,0,0) 
                setTimer ( 
                    function (  source  ) 
                        setPlayerMuted ( source,false ) 
                        LastMassage[source] = nil 
                        outputChatBox('You are unmuted now!',source,0,255,0) 
                    end,120000,1,source 
                ) 
            end 
        end 
    end 
) 

Link to comment
Hello Gamer Try this :) :

-- # Server Side ! 
  
local LastMassage = 0 
  
addEventHandler('onPlayerChat',root, 
 function ( message )  
    if string.find ( message,'lol' ) then 
       LastMassage = LastMassage +1 
         if LastMassage == 4 then 
            setPlayerMuted ( source,true ) 
            outputChatBox('You said lol 4 times you are muted now!',source,255,0,0) 
        setTimer ( 
            function (  source  ) 
                setPlayerMuted ( source,false ) 
                LastMassage = 0 
                outputChatBox('You are unmuted now!',source,0,255,0) 
            end,120000,1,source 
            ) 
        end 
    end 
end 
) 

Add the resource to the acl for the mute function ( resource.ResourceName ) ! And try it and tell me :) !

This will make it a global variable, meaning that if another player says "lol", it'll increase the variable. He should use a table instead.

I know that , It's an example we don't accept requests here .. :wink: .

Link to comment

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