Tokio

[HELP] Why not working this script?

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? 

Share this post


Link to post

Did you give it acl rights?

 

Share this post


Link to post
1 minute ago, IIYAMA said:

Did you give it acl rights?

 

Yes

3 minutes ago, IIYAMA said:

Did you give it acl rights?

 

i get "ERROR: #404" in debugscript

Share this post


Link to post

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

 

Share this post


Link to post
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

Share this post


Link to post

Did you make sure you added this to the meta.xml? (on the resource where this function is located)

<export function="outputChatBoxRemote" http="true" />

 

 

Share this post


Link to post
1 minute ago, IIYAMA said:

Did you make sure you added this to the meta.xml? (on the resource where this function is located)


<export function="outputChatBoxRemote" http="true" />

 

 

yes, added

Share this post


Link to post

And what does responseData contain?

Share this post


Link to post
1 minute ago, IIYAMA said:

And what does responseData contain?

ERROR #404

Share this post


Link to post

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>

 

Share this post


Link to post
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>
 

Share this post


Link to post

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.

Share this post


Link to post
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 

Share this post


Link to post

Maybe you could ask it to somebody who already has done it, or the one who created the wiki topic.

I am very sure those guys are out there.

 

Share this post


Link to post

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.