golanu21 Posted March 24, 2013 Posted March 24, 2013 how i make the /me command to be on local ??. radius = 100
Ab-47 Posted March 24, 2013 Posted March 24, 2013 Learn to script would be a first. Here's the wiki: https://wiki.multitheftauto.com/
golanu21 Posted March 24, 2013 Author Posted March 24, 2013 man please, you know how to make it in local ?
Castillo Posted March 24, 2013 Posted March 24, 2013 Cancel the default message at: onPlayerChat With: cancelEvent Then, you can create your own local /me chat.
golanu21 Posted March 24, 2013 Author Posted March 24, 2013 but when i use cancelEvent for command /me, i can't create other function with /me
golanu21 Posted March 24, 2013 Author Posted March 24, 2013 (edited) i try it like that chat_rangee=100 function isPlayerInRangeOfPoint(player,xx,yy,zz,rangee) local pxx,pyy,pzz=getElementPosition(player) return ((xx-pxx)^2+(yy-pyy)^2+(zz-pzz)^2)^0.5<=rangee end function onChat(player,_,...) local pxx,pyy,pzz=getElementPosition(player) local msgg = table.concat({...}, " ") local nickk=getPlayerName(player) for _,c in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(c,pxx,pyy,pzz,chat_rangee) then outputChatBox( "#00ffff *"..nickk.." "..msgg,c,r,g,b,true) end end end addCommandHandler("me",onChat) addEventHandler ( "onPlayerChat", root, function ( message ) if message == me then cancelEvent ( ) end end ) Edited March 24, 2013 by Guest
Castillo Posted March 24, 2013 Posted March 24, 2013 That's wrong, firstly, you never defined "messageType" at your function, also, the type isn't "me", is 1.
codeluaeveryday Posted March 25, 2013 Posted March 25, 2013 Please learn from this code I just baked in my oven. chatRadius = 30 addEventHandler('onPlayerChat', getRootElement(), function(message, mType) if mType == 1 then cancelEvent() local posX, posY, posZ = getElementPosition(source) local chatSphere = createColSphere(posX, posY, posZ, chatRadius) local nearbyPlayers = getElementsWithinColShape(chatSphere, "player") destroyElement(chatSphere) for i, v in ipairs(nearbyPlayers) do outputChatBox('* '..getPlayerName(v):gsub('#%x%x%x%x%x%x', '')..' '..message:gsub('#%x%x%x%x%x%x', ''), v, 255, 0, 255) end end end )
golanu21 Posted March 25, 2013 Author Posted March 25, 2013 Please learn from this code I just baked in my oven. chatRadius = 30 addEventHandler('onPlayerChat', getRootElement(), function(message, mType) if mType == 1 then cancelEvent() local posX, posY, posZ = getElementPosition(source) local chatSphere = createColSphere(posX, posY, posZ, chatRadius) local nearbyPlayers = getElementsWithinColShape(chatSphere, "player") destroyElement(chatSphere) for i, v in ipairs(nearbyPlayers) do outputChatBox('* '..getPlayerName(v):gsub('#%x%x%x%x%x%x', '')..' '..message:gsub('#%x%x%x%x%x%x', ''), v, 255, 0, 255) end end end ) thanx man
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