Evil-Cod3r Posted January 27, 2012 Share Posted January 27, 2012 (edited) Hey All i want Make a script that Make The Player Type only Team Chat ! This is My Script function Extra () cancelEvent () outputChatBox("You Cant Type in Here Type Team Chat Only",source, 255,255,0) end addEventHandler( "onPlayerChat", getRootElement(), Extra) Edited January 27, 2012 by Guest Link to comment
BriGhtx3 Posted January 27, 2012 Share Posted January 27, 2012 function Extra (msg,msgType) if msgType ~= 2 then cancelEvent () outputChatBox("You Cant Type in Here Type Team Chat Only",255,255,0) end end addEventHandler( "onPlayerChat", getRootElement(), Extra) Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 Can You Explane Me Your Script xthepr0mise Link to comment
BriGhtx3 Posted January 27, 2012 Share Posted January 27, 2012 The parameters of the event onPlayerChat are : string message, int messageType messageType 0 means normal message 1 means action message 2 means team chat So if the messageType is NOT 2, we cancel the event. Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 So it Be Like this ? function Extra (msg,msgType) if msgType ~= 2 then cancelEvent () outputChatBox("You Cant Type in Here Type Team Chat Only",source,255,255,0) end end addEventHandler( "onPlayerChat", getRootElement(), Extra) function mta () outputChatBox ( "#FF0000Anti-Chat #00FF00", getRootElement(), 255, 255, 255, true ) end addEventHandler ( "onResourceStart", getRootElement(), mta) Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 it dont work i chat its output dont cancelEvent i even try this function colouredChat ( message, theType ) if theType == 0 then cancelEvent() outputChatBox("You Cant Type in Here Type Team Chat Only",source,255,0,0) end addEventHandler( "onPlayerChat", getRootElement(), colouredChat) Link to comment
Klesh Posted January 27, 2012 Share Posted January 27, 2012 (edited) addEventHandler( "onPlayerChat", getRootElement(), function (messageType) if messageType == 0 then outputChatBox("Sorry you cant use this chat, use team chat.", source, 255, 0, 0) cancelEvent() end end) Edited January 27, 2012 by Guest Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 Server function noChat( msg,messageType ) if messageType == 0 then outputChatBox( "Sorry you cant use this chat, use team chat.", source, 255, 0, 0 ) cancelEvent( ) end end addEventHandler( "onPlayerChat", root, noChat ) Klesh,Your code is wrong. P.S Tabulate code in next time. Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 its donst work at all see the img and iam using mta 1.1 Link to comment
Klesh Posted January 27, 2012 Share Posted January 27, 2012 What you put in meta? Server side or client side? Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 Stop freeroam And test again. Link to comment
Al3grab Posted January 27, 2012 Share Posted January 27, 2012 there is a resource changing the color of your text ( probably freeroam ) , stop it and try again Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 God i hate FreeRoam Thx Kenix For Help Thx Alll P.S Its Possble to add anti-Flood for it if he type 5 time give him mute 10 sec ? Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 (edited) No problem P.S Its Possble to add anti-Flood for it if he type 5 time give him mute 10 sec ? Yeah Example function noChat( msg,messageType ) if messageType == 0 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.", source, 255, 0, 0 ) if isTimer( tTimer[ source ] ) then killTimer( tTimer[ source ] ) end tTimer[ source ] = setTimer( function( player ) outputChatBox( "You are unmuted.", player, 255, 0, 0 ) setPlayerMuted( player,false ) tCounts[ player ] = 0 end, Time*1000, 1,source ) end end cancelEvent( ) end end addEventHandler( "onPlayerChat", root, noChat ) addEventHandler( "onPlayerQuit", root, function( ) tTimerInterv[ source ] = nil tTimer[ source ] = nil tCounts[ source ] = nil end ) P.S Need acl rights. Update code. Edited January 27, 2012 by Guest Link to comment
Klesh Posted January 27, 2012 Share Posted January 27, 2012 Anyways, always i post the first fix script and later give the thanks to the last make the fix. Link to comment
BriGhtx3 Posted January 27, 2012 Share Posted January 27, 2012 I can give you are reason His script was right, yours not. Today every script you posted was wrong Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 Anyways, always i post the first fix script and later give the thanks to the last make the fix. addEventHandler( "onPlayerChat", getRootElement(), -- use root in next time function (messageType) -- first argument is message second is message type see on wiki. if messageType == 0 then -- I think you understand problem. outputChatBox("Sorry you cant use this chat, use team chat.", source, 255, 0, 0) cancelEvent() end end) In first time you post code with syntax error.And i at once write my code. Link to comment
Evil-Cod3r Posted January 27, 2012 Author Share Posted January 27, 2012 its alot of write script i have to learn first thx Man For Help Link to comment
Kenix Posted January 27, 2012 Share Posted January 27, 2012 its alot of write script i have to learn first thx Man For Help No problem dude. I update code. Link to comment
Klesh Posted January 27, 2012 Share Posted January 27, 2012 Wrong, not all scripts are wrong. 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