Jump to content

[HELP] Why not working this script?


Tokio

Recommended Posts

function outputChatBoxRemote ( playerName, message, type, serverport )
    outputChatBox ( "From " .. playerName .. " on " .. serverport .. ": " .. message )
    return "hello sailor"
end

function finishedCallback( responseData, errno )
    responseData = tostring(responseData)
    if responseData == "ERROR" then
        outputDebugString( "callRemote: ERROR #" .. errno )
    elseif responseData ~= "hello sailor" then
        outputDebugString( "callRemote: Unexpected reply: " .. responseData  )
    else
	
    end
end

function playerChat ( message, type )
    callRemote ( "87.229.77.40:22030", getResourceName(getThisResource()), "outputChatBoxRemote", finishedCallback, getPlayerName(source), message, type, getServerPort() )
end
addEventHandler ( "onPlayerChat", getRootElement(), playerChat )

This is the code, but does not working.. what wrong? 

Link to comment
  • Moderators

I am not sure if you can call remote to yourself. But the error 404 means not found.

So try to ping to the ip, just to check if it available.

 

Also the port is important, just to figure out which port you should use:

function playerChat ( message, type )
	for port=22000, 22030 do
    callRemote ( "87.229.77.40:" .. port, getResourceName(getThisResource()), "outputChatBoxRemote", finishedCallback, getPlayerName(source), message, type, getServerPort() )
    end
end

 

Link to comment
18 minutes ago, IIYAMA said:

I am not sure if you can call remote to yourself. But the error 404 means not found.

So try to ping to the ip, just to check if it available.

 

Also the port is important, just to figure out which port you should use:


function playerChat ( message, type )
	for port=22000, 22030 do
    callRemote ( "87.229.77.40:" .. port, getResourceName(getThisResource()), "outputChatBoxRemote", finishedCallback, getPlayerName(source), message, type, getServerPort() )
    end
end

 

now i do not get error, but the message does not show in another server

and my server use 22030 as http port, and this is a hosted server, not localhost :D

Edited by 50cent
Link to comment
  • Moderators

I think you should do some more digging in the server. Because it is almost as if the Firewall is blocking it.

 

Also check the mta config file at that server, on this:

<!-- This parameter specifies the TCP port on which the server will be accepting incoming http connections. It can be set to the same value as <serverport>. It is a required parameter if <httpserver> is set to 1. -->

<httpport>22005</httpport>

 

Link to comment
2 minutes ago, IIYAMA said:

I think you should do some more digging in the server. Because it is almost as if the Firewall is blocking it.

 

Also check the mta config file at that server, on this:


<!-- This parameter specifies the TCP port on which the server will be accepting incoming http connections. It can be set to the same value as <serverport>. It is a required parameter if <httpserver> is set to 1. -->

<httpport>22005</httpport>

 

    <!-- This parameter specifies the UDP port on which the server will be accepting incoming player
         connections; default value: 22003. It is a required parameter. -->
    <serverport>22030</serverport>
    
    <!-- This parameter specifies the number of maximum player slots available on the server; default
         value: 32. It is a required parameter. -->
    <maxplayers>40</maxplayers>
    
    <!-- This parameter specifies whether the built-in http server will be used.
         Values: 0 - disabled , 1 - enabled ; default value: 1. Optional parameter. -->
    <httpserver>1</httpserver>
    
    <!-- This parameter specifies the TCP port on which the server will be accepting incoming http
         connections. It can be set to the same value as <serverport>22030</serverport>
         if <httpserver> is set to 1. -->
    <httpport>22030</httpport>
 

Link to comment
9 minutes ago, IIYAMA said:

hmm, well to figure out the problem, should start with try the same thing on another (2) server(s). Just to be sure that it isn't the server.

i tried with another server, but does not working too :S 

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