As you know Vice City Multiplayer has currently 3 languages available. Squirrel, Pawn, mIRC ( outdated ). People do use pawn but at the moment, squirrel is the best choice. I'll explain briefly how you can start writing scripts in Squirrel.
(I'm not much good at explaining!)Learning SquirrelYou need to learn Squirrel first. You can find the online manual
here.BasicsAs you know, to create a good and attractive server, your script should have:
- Regiser / Login System
- Statistics System
- Vehicles & Properties Systems
- and much more...
Besides these, their are vast ideas too but they depend on your imagination and knowledge.
Getting back into squirrel, the best idea is to study some released scripts. They'll give you a complete idea of how they work and you can learn much squirrel but studying them. Some scripts are:
VCMP Base Scripts (VBS)FBSMDM-SQBy studying these scripts, you can know how various systems works.
Firstly, you need to setup a squirrel server. You can download the server by clicking
here. A Tutorial about setting up the server can be found
here.
ExamplesI've written some examples below. Hope this helps. Don't forget to check the
wiki.
First, you need to create a .nut file and have to load it into the server by editing
server.conf. Scroll to the bottom and edit the line:
<script></script>
[code]
with
[code]
<script>your-script.nut</script>
Now, the script has been loaded into the server. This is where the VCMP server's event
onScriptLoad() is called. You can find a list of all VC:MP events
here with examples.
function onScriptLoad()
{
print( "Script loaded!" );
}
Following is the example of working with a class.
class Player
{
Kills = 0;
Deaths = 0;
Joins = 0;
}
At the top, we'll create an array to store the details.
playerStats <- array( GetMaxPlayers, null );
Let's welcome the player.
function onPlayerJoin( pPlayer )
{
PrivMessage( "Welcome to the server, "+player.Name+"!", player ); //Send a welcome message.
local id = player.ID;
playerStats[ id ] = null; //Delete any previous data.
playerStats[ id ] = Player(); //The class we declared at the top.
}
Stats Example:function onPlayerKill( killer, player, reason, bodypart )
{
playerStats[ killer.ID ].Kills++;
playerStats[ player.ID ].Deaths++;
}
Creating a command:function onPlayerCommand( player, command, text )
{
local
cmd = command.tolower(), //To avoid stupid bugs. For Example, the command "stats" will work even if the player types /c StAts or /c STATS etc
id = player.ID;
if ( cmd == "stats" )
{
PrivMessage( "Your Kills:<"+playerStats[player.ID].Kills+"> Deaths:<"+playerStats[player.ID].Deaths+"> Joins:<"+playerStats[player.ID].Joins+">", player );
}
}
You can find a list of all VCMP Squirrel Server functions
here with examples. You've to just use different functions at different places according to what you're building.