Jump to content

i dont understand why


Park

Recommended Posts

i dont know why this not work i am new scripter and i want to learn and i am not good and i dont know many things and my friend didnt want to help me and he make fun of me

  
function(message) 
 themessage == message 
  if themessage then 
    themessage = message 
    outputchatbox( string themessage) : follow this > 
x = 5 
y = 10   
-- Displays the message 
outputChatBox ( "I have " .. x .. " apples and " .. y .. " oranges." ) 
function colouredChat ( message, theType ) 
    if theType == 0 then --if its normal chat (not /me or teamchat) then 
        cancelEvent() --prevent MTA from outputting chat 
        message = string.gsub(message, "#%x%x%x%x%x%x", "") --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub 
        local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour 
        local chatterName = getPlayerName ( source ) --get his name 
        --output a message with the name as his nametag colour, and the rest in white. 
        outputChatBox ( chatterName..":#FFFFFF "..message, getRootElement(), r, g, b, true ) 
    end 
end 
addEventHandler("onPlayerChat", getRootElement(), colouredChat) 
  end; 
  else 
   outputchatbox(string error) :  
 local msg_red,msg_green,msg_blue = 255,255,0 
  
function servertalkprivate(message, sendto) 
        --Talk to one client only 
    outputChatBox(tostring(message), sendto, msg_red, msg_green, msg_blue, true) 
end 
  
function servertalk(message) 
        --Talk to everyone 
    servertalkprivate(message, getRootElement()) 
end 
  
function onJoin() 
    servertalkprivate("error", source) 
end 
  
addEventHandler("onPlayerJoin",getRootElement(),onJoin) 
  end; 
 outputchatbox(string true) 
end. 
function "test" (message) 

Link to comment

Many functions haven't 'end'.

function(message) 
 themessage == message 
  if themessage then 
    themessage = message 
    outputchatbox( string themessage) : follow this > 
x = 5 
y = 10   
-- Displays the message 
outputChatBox ( "I have " .. x .. " apples and " .. y .. " oranges." ) 
end 
end 
function colouredChat ( message, theType ) 
    if theType == 0 then --if its normal chat (not /me or teamchat) then 
        cancelEvent() --prevent MTA from outputting chat 
        message = string.gsub(message, "#%x%x%x%x%x%x", "") --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub 
        local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour 
        local chatterName = getPlayerName ( source ) --get his name 
        --output a message with the name as his nametag colour, and the rest in white. 
        outputChatBox ( chatterName..":#FFFFFF "..message, getRootElement(), r, g, b, true ) 
    end 
end 
addEventHandler("onPlayerChat", getRootElement(), colouredChat) 
  
function servertalkprivate(message, sendto) 
        --Talk to one client only 
    outputChatBox(tostring(message), sendto, msg_red, msg_green, msg_blue, true) 
end 
  
function servertalk(message) 
        --Talk to everyone 
    servertalkprivate(message, getRootElement()) 
end 
  
function onJoin() 
    servertalkprivate("error", source) 
end 
  
addEventHandler("onPlayerJoin",getRootElement(),onJoin) 

The code is a really mess...

Link to comment

addEventFunction(message)

themessage == themessage

if not message then

message= message

outputchatbox( string themessage) : follow this >

x = nill

y = nill

-- Displays the message

outputChatBox ( "I have " .. x .. " apples and " .. y .. " oranges." )

function colouredChat ( message, theType )

if theType == 0 then --if its normal chat (not /me or teamchat) then

cancelEvent() --prevent MTA from outputting chat

message = string.gsub(message, "#%x%x%x%x%x%x", "") --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub

local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour

local chatterName = getPlayerName ( source ) --get his name

--output a message with the name as his nametag colour, and the rest in white.

outputChatBox ( chatterName..":#FFFFFF "..message, getRootElement(), r, g, b, true )

end

end

addEventHandler("onPlayerChat", get

addEventCommand("onPlayerJoin",getRootElement(),onQuit)

end;

outputchatbox(string true)

end.

function "test" (message)

addEventFunction(nill)

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...