Author Topic: /\ Need help!  (Read 3518 times)

Function servercmdYo(%client)
{
      Messageclient(%client,'',"Yo.");
}

function reloadMe()
{
exec("Config/Server/yo2.cs");
{
function servercmdHi(%client)
{
      Messageclient(%client,'',"Hi.");
}
function servercmdHello(%client)
{
      Messageclient(%client,'',"<color:27C90A><font:Impact:40>-- <color:0293BF><font:Impact:30>This addon is working fine");
}



This does'nt seem to work also, How to i put my .cs in a zip and put it on my server so everytime i don't need to exec("config/server/yo2"); Thanks, And thank you for the positive replyes

function reloadMe()
{
exec("Config/Server/yo2.cs");
{

function servercmdHi(%client)
{
      Messageclient(%client,'',"Hi.");
}

function servercmdHello(%client)
{
      Messageclient(%client,'',"<color:27C90A><font:Impact:40>-- <color:0293BF><font:Impact:30>This addon is working fine");
}



This does'nt seem to work
It does not work because you put an opening bracket at the end of the reloadMe function, instead of a closing bracket. None of the script executes if there's a syntax error.
How to i put my .cs in a zip and put it on my server so everytime i don't need to exec("config/server/yo2"); Thanks, And thank you for the positive replyes
It only needs to be in a .zip if your planning on sharing it with other people. Otherwise it can just be in a folder.

Step 1: make a folder named Server_MyAddOn in your Add-Ons folder.
Step 2: make a server.cs file in Server_MyAddOn. Put your script in here.
Step 3: make a description.txt file in Server_MyAddOn. It does not matter what text is inside it, it can even be blank.
Step 4: When you start a custom server, enabled Server_MyAddOn. Tada. Your add on was executed when you started the server. But if you make any changes to it while the server is up, you need to use exec("Add-Ons/Server_MyAddOn/server.cs"); to make those changes take effect.


function reload()
{
exec("Config/Server/yo2.cs");
}
function servercmdrichard(%client)
{
      Messageclient(%client,'',"<color:00DBA4>Hai");
}
function servercmdHello(%client)
{
      Messageclient(%client,'',"<color:27C90A><font:Impact:40>-- <color:0293BF><font:Impact:30>This addon is working fine");
}


This dosn't work to, Everything seems to be good here, Idk what i did wrong.


This is the error.

Executing config/server/server.cs.
config/server/server.cs Line: 5 - Syntax error.
>>> Some error context, with ## on sides of error halt:
unction reload()

Did you do discoverfile("add-ons/Server_YourAddOn/server.cs"); before exec("add-ons/Server_YourAddOn/server.cs"); ?


I have a new problem D: Sorry for all theses helps,


function servercmdkill(%client)
{
 %name = %.client.getPlayerName();
 %player = %client.player:

 %player.kill();
}
function servercmdHello(%client)
{
      Messageclient(%client,'',"<color:00DE21><font:Impact:40>-- <color:F50539><font:Impact:32>This addon is working fine.");
}

And this the console

==>exec("config/server/yo.cs");
config/server/yo.cs Line: 3 - Syntax error.
>>> Some error context, with ## on sides of error halt:
unction serverCmdkill(%client)

 %name = %client.getPlayerName():
##


%name = %client.getPlayerName():
You put a : at the end instead of a ;

You need to understand that the syntax is extremely picky and does not like you putting in anything stray. Try just looking at your code, remember that every ( needs a ) to close it, every { needs a } to close it, and every " needs another " to close a string. Each function or method you call needs to end with a semicolon. (This does not include function declarations or IF statements) You can't put periods where ever you want, they are only used inside strings or to go between references

if(isObject(%client.player))
{
    %client.player.setScale("2 2 2");
}

An editor like Notepad++ might help you see syntax better. I recommend you download it and set the language to C#.

Code: [Select]
%name = %.client.getPlayerName();
 %player = %client.player:
There is 3 things wrong with this code.

Code: [Select]
%name = %.client.getPlayerName();
 %player = %client.player:
There is 3 things wrong with this code.
Do you want to tell him what the three things are or just tell him theres a problem, because i'm pretty sure he knows theres a problem or else he wouldn't be posting.

So whats the correct code?

He said it already, you put a : at the end of %player = %client.player: instead of a ;
 %player = %client.player;

Also, it says %name = %.client.getPlayerName(); and that should not have a . after the %.
%name = %client.getPlayerName();