Hey Leute,
Hab versucht einen Global Chat zu scripten:
Lua
function sendMessageToNearbyPlayers( message, messageType )
if messageType == 0 then
if getElementData(source, "globalChat") == true then
local playerFraktion = getElementData( source, "Fraktion" )
local theName = getElementData ( source, "Username" )
if getElementData(source, "Adminlevel") == 5 then
if playerFraktion == 0 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #FFFFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 1 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #00FF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 2 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #0000FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 3 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #FFAD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 4 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #00AD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 5 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #00FFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 6 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #FF8B00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 7 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #FFFF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 8 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #FF0000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 9 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #181818".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 10 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #B40000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 11 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #070707".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 12 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #007FFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 13 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#FF0000Inhaber#FF7F00] #1E90FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
end
elseif getElementData(source, "Adminlevel") == 4 then
if playerFraktion == 0 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #FFFFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 1 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #00FF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 2 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #0000FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 3 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #FFAD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 4 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #00AD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 5 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #00FFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 6 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #FF8B00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 7 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #FFFF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 8 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #FF0000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 9 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #181818".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 10 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #B40000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 11 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #070707".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 12 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #007FFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 13 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] [#00FFFFMod#FF7F00] #1E90FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
end
else
if playerFraktion == 0 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #FFFFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 1 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #00FF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 2 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #0000FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 3 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #FFAD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 4 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #00AD00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 5 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #00FFFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 6 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #FF8B00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 7 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #FFFF00".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 8 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #FF0000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 9 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #181818".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 10 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #B40000".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 11 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #070707".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 12 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #007FFF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
elseif playerFraktion == 13 then
outputChatBox( "#FF7F00[#FFFF00Global#FF7F00] #1E90FF".. theName ..": #FFFFFF" .. message, root, 0, 0, 0, true )
end
end
end
end
cancelEvent()
end
addEventHandler( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers )
Alles anzeigen
Problem ist jetzt das wenn die Nachricht zu lang ist wird der Text nicht gesendet wie kann ich das ändern?