Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Ampersand

Pages: [1]
1
Modification Help / TCPObjects not correctly sending
« on: July 27, 2014, 01:38:05 AM »
I can't seem to properly get this TCPObject to work. I'm trying to make it so I can announce from another server to my server. Am I doing something wrong?

Code: [Select]
new TCPobject(AServerTCP);

function AServerTCP::onConnectRequest(%this, %ip, %socket)
{
echo("Connected"); //This does echo
%this.connection[%ip] = new TCPobject(AServerTCP_Inst, %socket)
{
parent = %this;
};
}

function AServerTCP_Inst::onLine(%this, %line)
{
echo("Server"); //This does not echo
announce(%line);
}
AServerTCP.listen(3000);

function AClientTCP::onLine(%this, %line)
{
echo(%line);
}

function AClientTCP::onConnected(%this)
{
$LRA::Connected = 1;
}

function AClientTCP::onDisconnect(%this)
{
$LRA::Connected = 0;
%this.delete();
}

$LRA::Connected = 0;
function LongRangeAnnounce(%msg) {
if($LRA::Connected)
$LRA::TCP.send(%msg);
echo("Client"); //This does echo
}

function StartClientTCP() {
$LRA::TCP = new TCPobject(AClientTCP);
$LRA::TCP.connect("127.0.0.1:3000"); //This port is forwarded and I'm on localhost anyways
echo("Create Client TCP"); //This does echo
}

2
I'm currently trying to convert a string with quotation marks into a proper for to be able to send to the server through a command. It's using a GUI but I can't seem to properly replace quotation marks to be able to be sent.

So let's say I have a string that is stored like this
Code: [Select]
%str = "Hello \"Bob\"";and if you echoed %str it would display as
Hello "Bob"

I am trying to make it so if you type something into a GUI text box like this  Hello "Bob"  it'll properly put \'s into the string before them.

It's used for something like this
Code: [Select]
In the GUI lets say you type [i]you "suck" bob[/i] it would give me a syntax error because it thinks the quotation marks are for the command to server.
commandtoserver('tell', "Bob \"" @ GUIText.getValue() @ "\"");
I know something like this can be done another way with something with more parameters, but in the case of what I'm trying to achieve, I need to figure out how to do this.

I tried using strreplace(%str, "\"", "\\\""); but that didn't seem to give me proper results and still came back with syntax errors.

Hopefully that is understandable. If not, I will find another way to do this. Thanks for any help I receive.

4
Modification Help / Function for when someone is admin'd
« on: July 15, 2014, 01:31:07 AM »
What is the function that is called when someone gets admin'd and what are the parameters?

5
Add-Ons / Wrong section
« on: July 15, 2014, 01:28:52 AM »
forget, wrong section. Sorry I'm new at this.

Pages: [1]