---What you will learn---
1.Echo's
2.Local and global variables
3.Chat messages and centerprints
4.Commands
5.The If() statement
6.Packageing
---Echo's---
A echo simply says something to a console. Simply use this code to do it
echo("Hello world!");
Lets move onto variables now
---Variables---
There is two types of variables. Global and local. The local varaibles are used for just for a specific code. Global can be used anywhere. To set a Local variable simply use
%variable = 5;
%variable now equals five in this code. Now on with the globals. This varaible can be used in any case. Simply do this by useing this code
$variable = 5;
This may seem like the last one,But notice how i used a $ sign instead of %. Thats how a local and global variable is identified. Lets move on to Chatmessages and centerprints.
---Messages---
There is many ways to do messages. The 4 types are messageBoxOk,Centerprint,Chatmessage,And of couse bottomprint. For now ill teach you the centerprint and chatmessage. To centerprint we wanna use this code
centerPrintAll("Hello guys!",5);
That will say "Hello guys!" in the center of everyones screen.
Now,Lets do a chatmessage useing this code
messageAll(",","Hi!");
This will say "Hi!" in everyones chatbox. I think its time to move onto commands.
---commands---
Ok,we now know enough to make a simple command. We will start with this.
function ServerCmdhello(%client)
Now,Thats just the start. Lets make it message everyone saying "hello".
function ServerCmdhello(%client)
{
messageAll(",","Hello");
}
Now,That will say hello on everyones screen. This is a very basic command to make. Lets move on to the if statement.
---The If() statement---
The if statement is very handy for admin only things. Like commands. We will first start with the command. Ill use the previous code for the "hello" message.
function ServerCmdhello(%client)
{
messageAll(",","Hello!");
}
Now,I want only admins able to do that. So ill add the If statement
function ServerCmdhello(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
messageAll(",","Hello!");
}
}
There! you just made your first admin only command. Lets move on to packageing tips.
---Packageing---
Well,Packageing is important if you make a mod. To package a mod make a Zipped file. Then place the following into it
1.Description.txt
2.server.cs
In server.cs you will have your code. I hope this guide helped you guys. Have a great time coding
---Didnt see what you needed?--
If you didnt see what you needed please post a comment.