Jump to content

commandhandler help


JKiller55

Recommended Posts

function sayglobal (player,_,msg)
	if getElementData(player,"LoggedIn") == true then
		--muted einfg
		for i,d in ipairs(getElementsByType("player"))do
			if getElementData(d,"LoggedIn") == true then
				outputChatBox("#F0E68C[Global]".."#FFFFFF"..getPlayerName(player)..": "..msg,d,255,255,255,true)
				dbSetStat(getPlayerName(source),"ChatSays",dbGetStat(getPlayerName(source),"ChatSays")+1)
			end
		end
	end
end
addCommandHandler("g",sayglobal)
addCommandHandler("Global",sayglobal)

i need help here. when someone chat it only show the first word of the text a person wrote. so if i do "/g hey i am JKiller55" the script will show "[Global]JKi: hey"

Link to comment
function sayglobal (player,_,... )
    local msg = table.concat({...}, " ") 
	if getElementData(player,"LoggedIn") == true then
     for i, d in pairs(getElementsByType("player")) do 
		if getElementData(d,"LoggedIn") == true then
				outputChatBox("#F0E68C[Global]".."#FFFFFF"..getPlayerName(player)..": "..msg, d,255,255,255,true)
				dbSetStat(getPlayerName(source),"ChatSays",dbGetStat(getPlayerName(source),"ChatSays")+1)
			end
		end
	end
end
addCommandHandler("g",sayglobal)
addCommandHandler("Global",sayglobal)

 

Edited by Dimos7
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...