DeathMta Posted October 19, 2015 Share Posted October 19, 2015 Server -Side antispam = false function mensajeglobal ( source, cmd, ... ) if antispam then outputChatBox ( "#FF0000[Global]: #FFFFFFEspera Un Segundo Para Enviar Otro Mensaje.",source, 255,0,0,true) return end antispam = true setTimer(function() antispam = false end, 1000, 1) local msg = table.concat ( {...} , " " ) local msg = string.gsub ( msg, '#%x%x%x%x%x%x', '' ) local nombre = getPlayerName(source) local onlyLettersMsg = string.gsub ( msg , "%A", "" ) if onlyLettersMsg == string.upper ( onlyLettersMsg ) and #onlyLettersMsg > 0 then outputChatBox ( "#FF0000[Global]: #FFFFFFNo Uses Mayúsculas.",source, 255,0,0,true) return end if string.find ( msg, "http://" ) then outputChatBox ( "#FF0000[Global]: #FFFFFFNo Publiques Links.",source, 255,0,0,true) return end if string.find ( msg, "mtasa://" ) then outputChatBox ( "#FF0000[Global]: #FFFFFFNo Publiques Ip's.", source,255,0,0,true) return end if string.find ( msg, "mierda" ) or string.find ( msg,"shit") or string.find ( msg,"noob") then outputChatBox ( "#FF0000[Global]: #FFFFFFNo Insultos.",source,255,0,0,true) return end if isPlayerMuted ( source ) then outputChatBox ( "#FF0000[Global]: #FFFFFFEstas Muteado.",source,255,0,0,true) return end local var, spacesCount = string.gsub( msg, " ", "") if ( #msg / spacesCount ) > 20 and #msg > 20 then outputChatBox ( "#FF0000[Global]: #FFFFFFNo Uses Palabras Grandes.",source,255,0,0,true) return end local mensaje = table.concat ( { ... }, " " ) local nivel = getElementData (source,"level") local clan = getElementData(source, "gang" ) local vida = getElementData(source, "blood") local nombre = getPlayerName(source) local registro = getPlayerAccount( source ) local cuenta = getAccountName(registro) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then outputChatBox("#5EAADE["..clan.."] #FF0000[Administrador] #FDFDFD"..nombre..": #FDFDFD"..mensaje, getRootElement(), 255, 255, 255, true) return end if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "SuperModerator" ) ) then outputChatBox("#5EAADE["..clan.."] #91DF2D[superMod] "..nombre..": #FDFDFD"..mensaje, getRootElement(), 255, 255, 255, true) return end if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) then outputChatBox("#5EAADE["..clan.."] #0E7C3E[Moderador 1] "..nombre..": #FDFDFD"..mensaje, getRootElement(), 255, 255, 255, true) return end if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Everyone" ) ) then outputChatBox("#FF0000[Global]"..nombre..": #FDFDFD"..mensaje, getRootElement(), 255, 255, 255, true) return end end addCommandHandler("Global", mensajeglobal) function ChatInicio() outputChatBox("Presiona [X] para usar el Chat Global", source, 255, 0, 0) end addEventHandler("onPlayerLogin", root, ChatInicio) Client-Side bindKey("x", "down", "chatbox", "Global") Link to comment
Kilfwan Posted October 19, 2015 Share Posted October 19, 2015 Gran parte del recurso no lo hicistes tu y te podías a ver ahorrado muchas lineas con tablas de ese string.find Explicame para que usastes return para algo del acl ? Link to comment
DeathMta Posted October 19, 2015 Author Share Posted October 19, 2015 este recurso no es mio , pero editado un poco Link to comment
Tomas Posted October 20, 2015 Share Posted October 20, 2015 El anti-spam no sirve, estás trabajando en server-side, esa forma no te sirve. Link to comment
aka Blue Posted October 20, 2015 Share Posted October 20, 2015 Y has puesto una variable global, eso significa que si uno hace spam, le quitará el permiso de hablar a todos. (Yo también tuve esos errores ) Link to comment
Recommended Posts