SA-MP Forums Archive
[Tutorial] New with SA:MP?Check this out! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] New with SA:MP?Check this out! (/showthread.php?tid=306861)



New with SA:MP?Check this out! - §с†¶e®РµРe - 28.12.2011

Introduction
What is SA:MP?

San Andreas Multiplayer (SA:MP) is a modification for Grand Theft Auto: San Andreas which turns it into a multiplayer game. You can play over the internet (or LAN) with up to 500 other people. You need the original Grand Theft Auto: San Andreas PC game to play San Andreas Multiplayer.

In SA:MP you are able to do almost anything that you can do in single player GTA. SA:MP also features the ability to create your own scripted game modes. There are many game modes that feature a series of different and fun things to do. Many of which are not possible in single player.
System Requirements

SA:MP will run on any computer that will run San Andreas single player, but give better performance in most cases. However, if you are playing on larger servers(SA-MP Supports up to 500 slots), the game may run slower at times if you have a lower spec.
Minimum
Recommended
SA:MP specific

In addition to the standard Single Player requirements, SA:MP needs the following:
Installation
Download

The first and easiest step is to download the SA:MP Client from the website. The download page can be found at http://www.sa-mp.com/download.php - It is necessary to regularly check this page, especially if you get "Incorrect Version" errors after a few weeks..

Install

Simply run the download and install to your GTA San Andreas folder. The default directory is:

C:\Program Files\Rockstar Games\GTA San Andreas\

It is very important that SA:MP is installed in the same place as gta_sa.exe. This is important as SA:MP needs the core San Andreas files to run. You should see the following window with your San Andreas directory pre-selected. If it is slected, click install - if not, browse for the directory first.


This automatic installation process should place a shortcut named SAMP on your desktop, if it's not there check your GTA San Andreas directory - just open this file to choose a server.

Find a Server

Finding a server is simple - run the newly created shortcut on your desktop (samp.exe), and the browser will pop up. Click on the "internet" tab at the bottom of the client to query the masterlist, and you will see what is shown on the image above.


The only necessary user input to this page is to enter your name in the "name" field, to the top of the browser window. Then, simply choose a server you want, right-click on it, and press "Connect". If all goes well, this will load up San Andreas with the selected server, and you will be playing San Andreas with anywhere up to 500 other people!


If the online play doesn't start, see the list of common problems. If you need more help check [forum.sa-mp.com the forums]

Your First View

The first you will see in San Andreas Multiplayer is class selection, where you choose the skin you wish to play as. In some gamemodes choosing a skin will choose what team you are in, or what role you will play in the game. Different skins may also have different weapons - it is all Gamemode-dependent. In the gamemode shown, LVDM, the skin does not have any special abilities, weapons or roles - it is simply cosmetic. To scroll through available skins press the left or right keys on your keyboard, and press your Shift key to spawn. If a skin is part of a certain team then scrolling through them will normally show which team you will be on if you where to choose said skin.

A number of other key elements of SA:MP can be seen in the screenshot, which I will now detail.

Chat Box

The chatbox can be found in the top-left corner of the screen, and provides a way for users to talk with each other. You can type messages by using the T, `, or F6 keys. You can toggle the chat window on and off using the F7 key.

Kill Info Window

The "kill info window" can be found in the middle of the right side of the screen. It shows who killed who and what the death weapon was, as well as showing suicides or generic deaths. It can be shown/hidden by pressing F9.

Game Keys

As SA:MP is built on top of the San Andreas game, nearly all the keys are exactly the same as single player with the exception of a few SA:MP-specific commands :-
Key DescriptionAs for all other commands, they are exactly the same as single player. If you have never played San Andreas before it is highly recommended that you play through Single Player first - even if it is only the first few missions. A lot of playing SA:MP involves knowledge of single player itself, especially tasks such as driving around or looking for places to buy health/weapons.
Client
This category is for players.If you are a scripter and want to check out the category for scripters then scroll down.

Common Problems
I get the error "San Andreas cannot be found"

San Andreas Multi-player is not a stand-alone program! It adds multi-player functionality to San Andreas, and thus you need GTA San Andreas for the PC - it also needs to be EU/US v1.0, other versions such as v2.0 or Steam and Direct2Drive versions will not work. Click here to download a patch to downgrade your GTA: SA version to 1.0



I can not see any servers in SA-MP browser

First off, ensure you are following the procedures set out in the Quick-start guide. If you have followed what it says, and still cannot see any servers, you must allow SA:MP access through your firewall. Unfortunately, due to the large amount of available firewall software, we can not offer further support on this - we suggest looking at the manufacturers website or trying a ****** search. Also make sure you have the latest SA:MP version!



Single Player Loads instead of SA:MP

YOU ARE NOT SUPPOSED TO SEE THE SINGLE PLAYER OPTIONS (NEW GAME, LOAD GAME, ETC) - SA:MP SHOULD LOAD BY ITSELF AND NOT PRESENT THESE OPTIONS. IF YOU SEE "NEW GAME" SINGLE PLAYER HAS LOADED, NOT SAN ANDREAS MULTIPLAYER.

Single player can load for 2 reasons - you have installed SA:MP to the wrong folder or you have the wrong version of San Andreas. If you have the wrong version it's easy to fix. . Click here to download the downgrade patch.

Sometimes the single-player menu will be shown, but SA:MP will have in fact loaded properly. To fix this you simply need to select an item on the menu then press esc until you're out of it, then SA:MP will proceed to load.



I get "Unacceptable NickName" when connecting to a server

Ensure you are not using any disallowed characters in your name (use 0-9, a-z, [], (), $, @, . and = only), and that your name is no longer than 20 characters. This also could be caused when a player is on a server with the same name as you (which can happen if you re-join a server very soon after timing out or crashing).



Screen sticks at "Connecting to iport..."

The server could be offline, or if you can't connect to any server, disable your firewall and see if it works. If it does you must set up your firewall properly - go to its website to find out how. It could also be that you have an old version of SA-MP, download the latest version from the SA-MP download page.



I have a modified GTA: San Andreas and SA:MP won't load

If it won't load then remove your mods.



When launching GTA with SA:MP it won't start

Delete the gta_sa.set file from your userfiles folder and make sure you don't have any cheats/mods.



The game crashes when a vehicle explodes

If you have 2 monitors then there are 3 ways to solve this:For Scripters
Scripter's guide has now been started.If you want to check out the client/players guide scroll up.
Downloading
Pawno is the main Pawn editor, and Pawn is the programming language used in sa-mp.
In order to play SA-MP you need to download SA-MP from this page, the client, and aswell the server pack. It will include many folders (the server pack), I suggest you to put them in a easy to open place, for example, your desktop.
Types of scriptserver.cfg
pawn Code:
echo - This is what the sampserver.exe echos when executing server.cfg, there is no need to change this at all as you'll be the only one who sees the the console. By default this says Executing Server Config...

    lanmode - Turning lanmode on will result in the server using more bandwidth, this mode makes the server a lot more accurate though. You can turn lanmode on by changing the value to 1 and you can turn it off by changing the value to 0. By default this is set to 0

    maxplayers - This is the maximum amount of players your server can hold, by changing this number you can alter how many players can enter the server. The maximum is 500 and the minimum is 1. By default this is set to 50.

    announce - Toggle server to be announced to SA-MP masterlist. Set to 1 to enable announcing or 0 to disable.

    port - The port in which the server will use to communicate can be specified here, you will need to Port Forward in order to run the server. By default this is set to 7777.

    hostname - This is the name that will display in the server browser for other users to see. By default this is set to SA-MP 0.3 Server.

    gamemode(n) (N) (t) - It'
s possible to set the gamemode that plays, how many times it plays and when it plays by editing the values here. To use this correctly you must understand how it works, (n) is the gamemode number, (N) is the gamemode name*, and (t) is the times played before switching onto the next mode. By default this area will look like this:
        gamemode0 lvdm 1
        gamemode1 rivershell 1
        gamemode2 area51 1
        gamemode4 sftdm 1

    weburl - This is the website people can visit to gain more information about the server, a web url is not needed. By default this is set to [url]www.sa-mp.com[/url].

    rcon_password - This is the password used to administrate the server and use the rcon, you must make sure you change this to something hard to crack so that others cannot take control of your server. By default this is set to changeme. Your server will NOT start if "changeme" is the RCON password!

    filterscripts (N) - Filterscripts are scripts that run in the background of your gamemode, they are there to add extras to the server without editing the gamemode. It's very useful if you want to carry a specific property to more than one gamemode. To use this you must find the folder in your server folder named filterscripts and place your filterscripts (.amx) in there. (N) symbolizes the filterscript name*. By default this option is not here. If you have multiple filterscripts you want to load, put them all in a row separated by "space", e.g. filterscripts script1 script2.

    plugins (N) - The plugins directive allows you to specify plugins which are designed to enhance gamemodes and filterscripts. (N) symbolizes the plugin'
s name. If you have multiple plugins you want to load, put them all in a row separated by "space", e.g. plugins plugin1 plugin2.
        You may find more information about the SDK for plugin development in the forum's main topic
    password (p) - Locking your server is another option that is available for the root server administrator. You can use this to lock unwanted visitors from the server. (p) symbolizes the password that will be used. By default your server will not have a password.
    mapname (m) - The mapname appears in the server browser. (m) symolizes the mapname. By default this is set to San Andreas.
        Replace [name] to anything you want, e.g. My-stunt-map
        The gamemode/filterscript name is the gamemodes/filterscripts compiled name in your gamemodes/filterscripts folder, all must match exactly except you must leave the .amx extension off.

    bind - Force the server to use a specific IP on a server. This IP must match one assigned to a network card on the server. This is useful for running multiple servers on the same port on the same box.

    rcon 0/1 - If 0 is specified the rcon Remote Console feature is disabled.

    maxnpc - The maximum number of NPCs that can join your server.

    onfoot_rate - The minimum time in milliseconds a client updates the server with new data while running/walking.

    incar_rate - The minimum time in milliseconds a client updates the server with new data while in a vehicle.

    weapon_rate - The minimum time in milliseconds a client updates the server with new data while firing a weapon.

    stream_distance - The distance on the X,Y plane which server entities will stream in for connected players.

    stream_rate - The number of milliseconds that must elapse before server entities stream distance is retested for each player.

    timestamp - Enable/Disable timestamp.
logtimeformat - Allows you to configure the timestamp format. The format is based on the strftime format from C/C++.

output - Enable/Disable output of console messages to stdout. Has no effect on Windows server.

gamemodetext - Set game mode text, similar to SetGameModeText . Set to Unknown by default.

Lower values of onfoot_rate incar_rate weapon_rate increase sync performance although increase bandwidth.
stream_distance With larger values, players can see server entities at a greater distance although will require more client processing and potentially more bandwidth.
stream_rate Lower values increase server CPU as it has to recheck streaming conditions more frequently for each player.
The stream_distance and stream_rate can be changed while the server is running e.g. /rcon stream_distance 300.0 or /rcon stream_rate 1000. The onfoot_rate, incar_rate, weapon_rate can also be changed while the server is running, although it will only effect newly connecting players.

Examples for logtimeformat: logtimeformat [%H:%M:%S] - (default) This displays only the time, and is the default format for all previous SA-MP server versions. logtimeformat [%d/%m/%Y %H:%M:%S] - This would display the date in dd/mm/yyyy format followed by the time in hour:minuteecond format. [/pawn]
Creating Scripts
When you click on new this is the defualt script that comes.
pawn Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
The first 3 lines
pawn Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
Are comments.For making comments you can add // before the line.
NOTE - They are single lined comments so if you do
pawn Code:
//hello
hello
it will give you an error.
For multi lined comments you need to put /* (to start) and */(to end).The text between them will be comments.
pawn Code:
/*hello
hello
this is also a comment o.O*/

But this is not
For more scripting information check out these cool links.
First
Second
Credits
Deskoft - For the first link(Scripter's Guide [NEW])
Me - For the tutorial.
SA:MP - For everything and the wiki also (second link)
THANK YOU!! HOPE YOU LIKED THIS!!


Re: New with SA:MP?Check this out! - Jack_Rocker - 28.12.2011

WOW, that must have taken a while! Well done! +Repped!


Re: New with SA:MP?Check this out! - Ironboy - 28.12.2011

Really nice work dude, keep going


Re: New with SA:MP?Check this out! - Max_Coldheart - 28.12.2011

You should update this tutorial.
Quote:
Originally Posted by §с†¶e®РµРe
(SA-MP Supports up to 500 slots)
800 now


Re: New with SA:MP?Check this out! - Jochemd - 28.12.2011

I am pretty sure SA-MP need more than 5.6 MB of free space


Re: New with SA:MP?Check this out! - Ash. - 28.12.2011

Quote:
Originally Posted by Jochemd
View Post
I am pretty sure SA-MP need more than 5.6 MB of free space
Especially with the new custom objects (*.img) and *.ide files to go with them!


Re: New with SA:MP?Check this out! - Jochemd - 28.12.2011

Quote:
Originally Posted by funky1234
View Post
Especially with the new custom objects (*.img) and *.ide files to go with them!
That's what I meant, yep.



And this is only the install, which is compressed!


Re: New with SA:MP?Check this out! - Ash. - 28.12.2011

Quote:
Originally Posted by Jochemd
View Post
That's what I meant, yep.



And this is only the install, which is compressed!
Woah! Hadn't noticed that before haha!

Anyway, I'm assuming most of the thread that the OP has posted has been taken from the Wiki. This is where we need Wiki editing permission on 'locked' pages, because they don't seem to get updated anymore. Take the changelog for example, last time I checked 0.3d hadn't even been mentioned there.


Re: New with SA:MP?Check this out! - §с†¶e®РµРe - 31.12.2011

Quote:
Originally Posted by Jack_Rocker
View Post
WOW, that must have taken a while! Well done! +Repped!
Quote:
Originally Posted by Ironboy
View Post
Really nice work dude, keep going
yeah it took a while.
thanks.


Re: New with SA:MP?Check this out! - Max_Coldheart - 31.12.2011

There still reads that SA:MP supports maximum of 500 slots, even though it supports maximum of 800 slots now.