Author Topic: My questions thread  (Read 9650 times)

no, %status would be the client in this example
good catch, I keep forgetting that after I haven't coded for a while

How would I define a variable with a server command?

I want /vis 1 to make $vis = 1;
and /vis 2 to make $vis = 2;
ect

using Global.Blocklanders.JohnnyBlo ckland;
using Coding.TorqueScript;

JohnnyBlockhead.Knowledge += TorqueScript;


That totally works, right?

How would I define a variable with a server command?

I want /vis 1 to make $vis = 1;
and /vis 2 to make $vis = 2;
ect
Code: [Select]
function servercmdVis(%client, %value)
{
if(!%client.isAdmin)
{
return;
}
$vis = %value;
}
I thought you would know how to at least do that by now.

How would I define a variable with a server command?
[img ]http://i.imgur.com/3i7kivi.png[/img]
I want /vis 1 to make $vis = 1;
and /vis 2 to make $vis = 2;
ect
function servercmdSetValue(%client,%value) //Server command
{
   if(!%client.isAdmin)
      return; //return if they aren't admin
   %value = mFloor(%value); //convert value to an integer
   switch(%value) //Switch statement %value
   {
      case 1 : //Check if %value is equal to 1
         $Variable=2; //set $variable to %value
         messageAllExcept(%client,'MsgAdminForce',"\c5"@%client.name@"\c6 changed the value to \c51"); //tell everyone that client changed the value
         messageClient(%client,'',"\c6Changed variable to \c51"); //tell the client they changed the value
      case 2 : //Check if %value is equal to 2
         $Variable=2; //set $variable to %value
         messageAllExcept(%client,'MsgAdminForce',"\c5"@%client.name@"\c6 changed the value to \c52"); //tell everyone that client changed the value
         messageClient(%client,'',"\c6Changed variable to \c52"); //tell the client they changed the value
      default : //Check otherwise
         messageClient(%client,'',"\c6Could not change value"); //tell the client they did not change the value
   }
}

It'll be easier if you stop doing things in eval.

Wtf Marble Man?


function serverCmdSetValue(%client, %value)
{
    if(!%client.isAdmin)
        return;
    if(%value/1 !$= %value)
    {
        messageClient(%client, "\c6Could not change the value.");
        return;
    }
    $Variable = %value;
    messageAllExcept(%client, 'MsgAdminForce', "\c5" @ %client.getPlayerName() @ "\c6 changed the value to \c5" @ %value);
    messageClient(%client, 'MsgAdminForce', "\c5You \c6changed the value to \c5" @ %value);
}


Why use a switch?
« Last Edit: November 04, 2013, 10:08:11 PM by $trinick »

It'll be easier if you stop doing things in eval.

I've been coding on my RTB Hosting server, and you can't modify already uploaded add-ons
eval is the only choice

I've been coding on my RTB Hosting server, and you can't modify already uploaded add-ons
eval is the only choice

It might be easier to do your testing on a local server and then transfer it to the RTB server when you're done.

I've been coding on my RTB Hosting server, and you can't modify already uploaded add-ons
eval is the only choice
exec("Add-Ons/Script_MyThingy/server.cs");

exec("Add-Ons/Script_MyThingy/server.cs");

I would have to restart the server for every change I make
not normal server
rtb

I've done development on RTB servers before, idk what you're talking about. Just use an FTP client and drag in the .cs file every time you make an update.

SILLY
ignore this i made a silly mistake

I've done development on RTB servers before, idk what you're talking about. Just use an FTP client and drag in the .cs file every time you make an update.
Never used ftp access before, will attempt.

How would you make an auto announcer script?

Where I just put what I want it to say in the script and it repeats it every 2 minutes or so?
Server-Sided