Author Topic: Very new and want to know how to make a script for any server  (Read 2395 times)

So I have a script, But I want it to work on any server i go on, how can i do this...

function clientCmdFetch(%client)
{

  %ping = %client.getPing();
  
  messageClient("<color:ffffff>Your ping is " @ '%ping');
  
}

Code: [Select]
function serverCmdGetPing(%client)
{
  %ping = %client.getPing();
  
  %client.chatmessage("<color:ffffff>Your ping is " @ %ping); //Changed this to make more sense... Don't put quotes around %ping, it could be a problem
}

Try now.

Also:

You can't use a client command because the server you go on will also need that script. You can't use clientCmdFetch or serverCmdFetch because that command is already registered.

Did this help?
« Last Edit: January 04, 2013, 11:06:45 PM by Advanced Bot »

^that won't work because of the single quotes
also, wrong number of arguments

Code: [Select]
function serverCmdGetPing(%client)
{
    messageClient(%client, '', "\c6Your ping is: " @ %client.getPing());
}
« Last Edit: January 04, 2013, 10:54:20 PM by Electrk »

Neither of those will work because you are forgetting to define the client in the messageClient function
Code: [Select]
messageClient(%client,"<color:ffffff>Your ping is " @ %client.getPing());

Neither of those will work because you are forgetting to define the client in the messageClient function
Code: [Select]
messageClient(%client,"<color:ffffff>Your ping is " @ %client.getPing());

I realized this after I posted

You all are wrong :). He said he wants this to work for any server he goes on, which means it must be client sided. @OP, you cannot get other player's ping from the client side but you can get yours against the server.

serverConnection.getPing();

So this should work on any server?

Code: [Select]
function serverCmdGetPing(%client)
{

%ping = %client.serverConnection.getPing();

messageclient(%client,"<color:ffffff>Your ping is " @ %ping);

}
« Last Edit: January 04, 2013, 11:02:35 PM by yankee903 »

So this should work on any server?

Code: [Select]
function serverCmdGetPing(%client)
{

%ping = %client.serverConnection.getPing();

messageclient(%client,"<color:ffffff>Your ping is " @ %ping);

}

No.

This will though:

Code: [Select]
function getMyPing()
{
     echo("Your ping is " @ serverConnection.getPing());
}

You all are wrong :). He said he wants this to work for any server he goes on, which means it must be client sided. @OP, you cannot get other player's ping from the client side but you can get yours against the server.

serverConnection.getPing();
this.
So this should work on any server?

Code: [Select]
function serverCmdGetPing(%client)
{

%ping = %client.serverConnection.getPing();

messageclient(%client,"<color:ffffff>Your ping is " @ %ping);

}
only elms code will work on any server.

However, he only gave you a command.
Look into the chat bots code for how to detect messages sent and send ping back.

After all this, your all wrong and i figured it out :) I made a command, /getping, and it works on any server and it shows your ping in your chat box and only you can see it.

After all this, your all wrong and i figured it out :) I made a command, /getping, and it works on any server and it shows your ping in your chat box and only you can see it.

facepalm.png

Heres the script...
Code: [Select]
package ClientPing
{
  function NMH_Type::Send(%this)
  {
    if(%this.getValue() $= "/getping")
  {
  NewChatSO.addLine("<color:ffffff>Your ping is " @ "<color:00C800>" @ serverConnection.getPing());
  }
    Parent::Send(%this);
  }
};
ActivatePackage(ClientPing);
:)

Heres the script...
Code: [Select]
package ClientPing
{
  function NMH_Type::Send(%this)
  {
    if(%this.getValue() $= "/getping")
  {
  NewChatSO.addLine("<color:ffffff>Your ping is " @ "<color:00C800>" @ serverConnection.getPing());
  }
    Parent::Send(%this);
  }
};
ActivatePackage(ClientPing);
:)

congratulations on using search.

Good job :) Hopefully you understand everything in there?

Heres the script...
Code: [Select]
package ClientPing
{
  function NMH_Type::Send(%this)
  {
    if(%this.getValue() $= "/getping")
  {
  NewChatSO.addLine("<color:ffffff>Your ping is " @ "<color:00C800>" @ serverConnection.getPing());
  }
    Parent::Send(%this);
  }
};
ActivatePackage(ClientPing);
:)


Check out Elm's formatting guide for proper format: http://forum.blockland.us/index.php?topic=192083.0
And also checkout this page for more resources: http://forum.blockland.us/index.php?topic=214415.0