How to Upload Gamemode to Samp Server
Basic SA-MP & PAWN GUIDE
INTRO:
This guide is based on other tutorials and on my own experience. It is created specially for new scripters and people who want to learn SA-MP Pawn scripting, information technology explains just basic scripting and how to starting time.
* Note: this guide is based on the one I made for SA-MP forum in the first months of 2015; if you read this afterward, some elements may accept changed or updated.
Based on:
Nicholas tutorial
Kwarde tutorial
Wiki SA-MP
Own noesis.
INDEX:
STARTING
Explaining each file (bones ones)
scriptfiles
plugins
pawno
npcmodes
include
gamemodes
filterscripts
announce.exe
samp-npc.exe
samp-server.exe
server.cfg
CONFIGURATION
PAWN SCRIPTING
Publics
public OnGameModeInit()
public OnGameModeExit()
public OnPlayerRequestClass(playerid, classid)
public OnPlayerConnect(playerid)
public OnPlayerSpawn(playerid)
public OnPlayerDeath(playerid)
public OnPlayerDisconnect(playerid, reason)
public OnPlayerText(playerid)
public OnPlayerUpdate(playerid)
Functions
SetPlayerPos(playerid, Ten, Y, Z);
TextDrawCreate(X, Y, text[])
Dialog Function (menus & others)
ShowPlayerDialog(playerid, dialogid, fashion, caption[], info[], button1[], button2[]);
Message box way (sends a message to the player)
Input style (allows players to input text into the dialog)
List way (menu, show the thespian a list of options)
Password style (allows players to input text into the dialog without revealing information technology)
CREATING AND REMOVING OBJECTS
Map editor (i & 2)
Get-go using it
Creating objects
Removing objects
MTA map editor
Start using it
Delux GTA Map Converter v2
Creating Objects
Streamer installation
START PRACTICING
STARTING:
Starting time we must download the SA-MP Windows Server from SA-MP.com
Afterwards doing this we will open the files independent in the download and subsequently decompressing it, we will see our server files & folders...
Basic files & folders:
scriptfiles, plugins, pawno, npcmodes, include, gamemodes, filterscripts, announce.exe, samp-npc.exe, samp-server.exe & server.cfg
Other files:
Text files that include terms & a configuration guide (samp-license.txt & server-readme.txt respectively).
Explaining each file (bones ones):
scriptfiles: this folder contains information called inside your script or logs created by your script, commonly used as a database.
plugins: this folder contains additional codes that give more than options in SA-MP programming, usually programmed in other languages. This guide volition not give detailed information virtually plugins as they are more advanced.
pawno: contains the basic programme to kickoff scripting in SA-MP; also has the "include" folder that contains basic includes to start our script (SA-MP basic functions). We tin can also add together our own includes and add them to our script.
npcmodes: this contains information nearly NPCs (script & rec); this guide will not requite detailed data about NPCs equally they are more than advanced.
include: this contains codes that can be included within your script.
gamemodes: contains bones gamemodes and we must place our gamemode if we create 1.
filterscripts: contains additional codes apart from your gamemode, non included in it and can be called past using rcon commands.
announce.exe: this will allow us to show our server on Masterlist.
samp-npc.exe: this will allow us to apply NPCs.
samp-server.exe: we beginning our server with this.
server.cfg: our server configuration.
CONFIGURATION:
First we must open up the file "server.cfg" and edit our server configuration.
After opening information technology, you will find:
Code:
echo Executing Server Config...
lanmode 0
rcon_password changeme
maxplayers l
port 7777
hostname SA-MP 0.three Server
gamemode0 grandlarc i
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner
announce 0
query ane
chatlogging 0
weburl www.sa-mp.com
onfoot_rate twoscore
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%Thou:%S]
You tin can edit your configuration based on this:
Lawmaking:
echo Executing Server Config...
lanmode 0 (lan mode on "ane" or off "0")
rcon_password changeme (the rcon password you will utilize "/Rcon login"; you must edit this)
maxplayers fifty (amount of slots available for players)
port 7777 (the port you will use, for example: 127.0.0.1:7777)
hostname SA-MP 0.3 server (the proper noun of your server)
gamemode0 grandlarc1 (proper name of the gamemode you will utilize, yous can add a gamemode if you create/download one)
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner (filterscripts that will be used)
announce 0 (server visible on Masterlist; "one" to show it and "0" to hide information technology)
query ane (information of the server visible "1", "0" will disable your server information to other players)
chatlogging 0 (salvage chat logs in server_log.txt "1", not saving it "0")
weburl world wide web.sa-mp.com (website of your server)
onfoot_rate 40 (we volition not explain this in this tutorial, advanced)
incar_rate 40 (we volition not explain this in this tutorial, advanced)
weapon_rate twoscore (we will not explicate this in this tutorial, avant-garde)
stream_distance 300.0 (nosotros will not explain this in this tutorial, advanced)
stream_rate m (nosotros will non explain this in this tutorial, advanced)
maxnpc 0 (number of NPCs that can join your server)
logtimeformat [%H:%K:%Due south]
You tin too read more information about server.cfg configuration.
Configuration example (this guide is based on this configuration):
Lawmaking:
echo Executing Server Config...
lanmode 0
rcon_password Pawn
maxplayers 100
port 7777
hostname SA-MP Server [0.3z]
gamemode0 Basic 1
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner
announce i
query 1
chatlogging 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate thousand
maxnpc 0
logtimeformat [%H:%M:%S]
PAWN SCRIPTING:
After changing our configuration we will start scripting our gamemode.
In this instance we will use a basic mode you can download here.
Put it within the "gamemodes" folder.
After doing this open the pawno folder inside your server and open the file "pawno.exe".
Press "File/Open" (or just press CTRL + O) and open our basic mode, placed inside the gamemodes folder.
Inside we take this:
This is the bones SA-MP include, it will exist included in every script you create in SA-MP.
This bulletin will be shown in panel when we open our server with samp-server.exe:
Code:
main()
{
print("Blank mode developed by Ygzeb.");
}
The bluish text is the message that volition be shown.
You tin edit the text that you want to be shown in console when your gamemode starts, just editing the blue text; for example:
Code:
main()
{
print("My first mode!");
}
* Note: Every code must have opening and endmost braces to start and end the function (all codes).
Example:
Opening braces = Red
Closing braces = Light-green
main()
{
print("My first fashion!");
}
* Notation: It is very important to press F5 subsequently editing or creating a script! This will update the AMX file and all changes will exist saved ("if there is not mistake", merely in special cases may happen programming mistakes that volition not figure in the compilation and will bear on your server). If everything is okay you will see something similar:
If not there is a fault and you demand to fix it.
Publics:
Publics are bones functions chosen while your server is running. SA-MP counts with basic publics chosen in most gamemodes. Nigh bones public names describe when the public is executed.
Some basic publics are called in special moments, for example while spawning; you can add together a function to that moment.
Instance; if we want to set players health to fifty when spawning information technology would be something like:
Code:
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, l);
return 1;
}
* Note: we can not use identical publics in the same script; for example 2 OnPlayerSpawn publics; if we want to add an extra office we must add together it inside the same public or inside a filterscript. Base of operations on the last case, we will add a message while spawning:
Code:
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, fifty);
SendClientMessage(playerid, -1, "You lot spawned!"); // Function added.
return 1;
}
Hither are some basic publics that are generally used past scripters:
public OnGameModeInit() - Called when your style starts.
Additional information: https://sampwiki.blast.hk/wiki/OnGameModeInit
Basic construction:
Code:
public OnGameModeInit()
{
// Lawmaking hither.
render i;
}
Example code:
Lawmaking:
public OnGameModeInit()
{
UsePlayerPedAnims(); // Allow players to run similar CJ.
SetGameModeText("Blank"); // Name of your manner; will be evidence in SA-MP list.
AddPlayerClass(115, 1958.3783, 1343.1572, fifteen.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(122, 1958.3783, 1343.1572, xv.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(166, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddPlayerClass(270, 1958.3783, 1343.1572, xv.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return one;
}
AddPlayerClass is a office that adds peel options to class selection; for example if we want to add Sweet's Pare nosotros should add this to our lawmaking:
Code:
AddPlayerClass(270, 1958.3783, 1343.1572, xv.3746, 269.1425, 0, 0, 0, 0, 0, 0);
The number "270" is the pare ID of Sweet.
public OnGameModeExit() - Called when your mode ends; it is non necessary in all scripts (optional in most cases).
Additional information: https://sampwiki.blast.hk/wiki/OnGameModeExit
Basic construction:
Code:
public OnGameModeExit()
{
// Lawmaking here.
return 1;
}
Example lawmaking:
Code:
public OnGameModeExit()
{
print("Fashion ended."); // Message to console (blue text).
return i;
}
public OnPlayerRequestClass(playerid, classid) - Called when y'all cull your skin.
Additional information: https://sampwiki.blast.hk/wiki/OnPlayerRequestClass
Basic structure:
Lawmaking:
public OnPlayerRequestClass(playerid, classid)
{
// Lawmaking hither.
return 1;
}
Example code:
Code:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2294.2810, 558.2053, 7.7813); // Peel position.
SetPlayerCameraPos(playerid, 2294.3071, 560.6948, 8.7324); // Position of the camera.
SetPlayerCameraLookAt(playerid, 2294.2810, 558.2053, 7.7813); // Position where the camera is looking at.
SetPlayerFacingAngle(playerid, 0);
return 1;
}
SetPlayerFacingAngle sets the angle where the player is looking; it's structure is:
Code:
north (0)playerid = ID of the thespian
0 = angle (in this example north).
|
(90) westward- -due east (270)
|
south (180)
More information about SetPlayerFacingAngle.
public OnPlayerConnect(playerid) - Called when a thespian connects.
Boosted data: https://sampwiki.blast.hk/wiki/OnPlayerConnect
Basic construction:
Code:
public OnPlayerConnect(playerid)
{
// Code here.
render i;
}
Example code:
Code:
public OnPlayerConnect(playerid)
{
PlayAudioStreamForPlayer(playerid, "http://s1.radio.ge/Music/AcDc/1980_Back_In_Black/06_Back_In_Black.mp3"); // Will play Back in Black, AC/DC.
return 1;
}
PlayAudioStreamForPlayer is a office that plays an audio stream for a histrion. Information technology'south basic structure is:
Code:
playerid = ID of the thespian
"http://s1.radio.ge/Music/AcDc/1980_Back_In_Black/06_Back_In_Black.mp3" = audio link
* Note: sound links must be in a specific format to be played; for example thislink.
You tin can find music in many websites. For instance in this website.
public OnPlayerSpawn(playerid) - Used subsequently class selection, while spawning. This are the functions that will impact you when spawning.
Additional information: https://sampwiki.blast.hk/wiki/OnPlayerSpawn
Basic structure:
Code:
public OnPlayerSpawn(playerid)
{
// Lawmaking here.
render 1;
}
Example lawmaking:
Lawmaking:
public OnPlayerSpawn(playerid)
{
SendClientMessage(playerid, -1, "You lot spawned!"); // Sends a message.
return one;
}
SendClientMessage is a function that sends a message to the actor; it's structure is:
Code:
playerid = ID of the actor
-1 = Color, -1 is white
"You spawned!" = message
More data about SendClientMessage.
public OnPlayerDeath(playerid) - Called when yous die. This office volition affect you when yous die.
Additional data: https://sampwiki.blast.hk/wiki/OnPlayerDeath
Basic structure:
Code:
public OnPlayerDeath(playerid)
{
// Lawmaking here.
return 1;
}
Example lawmaking:
Code:
public OnPlayerDeath(playerid)
{
GameTextForPlayer(playerid, "Wasted", 5000, ii); // Screen message for player.
return 1;
}
GameTextForPlayer is a function that sends a screen message to the player; information technology's structure is:
Lawmaking:
playerid = ID of the player
"Wasted" = bulletin
5000 = time in milliseconds; in this case 5 seconds
2 = type of message
More data about GameTextForPlayer.
public OnPlayerDisconnect(playerid, reason) - Called when a player disconnects.
Boosted information: https://sampwiki.boom.hk/wiki/OnPlayerDisconnect
Basic structure:
Code:
public OnPlayerDisconnect(playerid, reason)
{
// Code here.
render 1;
}
Example lawmaking:
Code:
public OnPlayerDisconnect(playerid, reason)
{
// Sending a message to all players that a player asunder.
new Cord[64], // Variable assigned to a message. 64 is the number of characters that will be used in our message (maybe more).
Name[MAX_PLAYER_NAME]; // Variable assigned to the player's name; commonly defined every bit MAX_PLAYER_NAME.
GetPlayerName(playerid, Name, MAX_PLAYER_NAME); // Getting the name of the player (Name) and it's length which is MAX_PLAYER_NAME (default by SA-MP).
format(Cord, sizeof String, "%due south left the server.", Name); // Applying a format to our message.
SendClientMessageToAll(-1, Cord); // Sending the message to all players; String is the format nosotros used for this message.
return 1;
}
public OnPlayerText(playerid) - Called when a player sends a bulletin (conversation).
Additional information: https://sampwiki.nail.hk/wiki/OnPlayerText
Basic structure:
Code:
public OnPlayerText(playerid, text[])
{
// Code hither.
return ane;
}
Example code:
Lawmaking:
public OnPlayerText(playerid, text[])
{
new Proper noun[MAX_PLAYER_NAME], String[175];
GetPlayerName(playerid, Proper noun, sizeof(Name));
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Name, playerid, text); // Assigning a format.
SendClientMessageToAll(GetPlayerColor(playerid), String); // Sending the message with GetPlayerColor, that is the actual color of the player.
render 0; // Ignoring the default text, ending the function.
}
This part is the format assigned to SendClientMessageToAll. When it is send, it will follow that format:
Lawmaking:
format(String, sizeof(String), "%s [%d]: {FFFFFF}%southward", Name, playerid, text);
Code:
%southward and %d are values assigned depending on the player.
%south is a letter value (in this case the player'south proper name and the text).
%d is a numerical value (ID of the player).
Code:
format(String, sizeof(String), "%southward [%d]: {FFFFFF}%s", Name, playerid, text);
Name, playerid & text are the values assigned to %s, %d and %s.
public OnPlayerUpdate(playerid) - Chosen everytime a customer/player updates the server with their status.
Additional information: https://sampwiki.blast.hk/wiki/OnPlayerUpdate
Basic construction:
Code:
public OnPlayerUpdate(playerid)
{
// Code here.
return 1; // If information technology returns 0 the client will not be updated to others (like paused).
}
Example lawmaking:
Lawmaking:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == 38) return Kick(playerid); // Kicking the histrion if he is using minigun.
return 1;
}
"if" is used to determine that if something is happening, the server will execute that function.
Information technology would hateful something like:
If he is using minigun, kick him!
* Notation: using "if" in OnPlayerUpdate may crusade lag, this is just an instance.
Using return means that the function ends there, with "Kick(playerid);". If y'all have other code downward that function, it will not be executed.
For example:
Code:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == 38) return Kick(playerid);
SendClientMessage(playerid, -1, "Updated!"); // Will non be executed if the player is using a minigun.
render 1;
}
Functions:
Basically, most functions names (native functions) draw what the function does; you tin can discover many of them here.
Some bones functions that might be used in a basic gamemode:
SetPlayerPos(playerid, X, Y, Z); - Sets a thespian position (X, Y & Z are the place where the player volition be moved).
Additional data: https://sampwiki.blast.hk/wiki/SetPlayerPos
Example lawmaking:
Code:
SetPlayerPos(playerid, 0.0, 0.0, 3.0); // Changes actor's position to a farm.
You can save your current position by using the command /Relieve within the game (default command by SA-MP). After using this you must get to "\GTA San Andreas User Files\SAMP" and so open the file "savedpositions.txt". There you lot will find something like:
Code:
AddPlayerClass(270, 700, 700, 5, 0, 0, 0, 0, 0, 0, 0);
Then just copy the red values:
Code:
AddPlayerClass(270, 700, 700, 5, 0, 0, 0, 0, 0, 0, 0);
* Notation: plainly our values are not reddish, information technology is just for the example.
Then paste those values inside your SetPlayerPos function; like this:
Lawmaking:
SetPlayerPos(playerid, 700, 700, five);
You tin can too utilize this system that will do information technology for you.
TextDrawCreate(X, Y, text[]) - Creates a textdraw (X & Y are the coords in the screen and "text" is the text that volition be shown).
Boosted information: https://sampwiki.blast.hk/wiki/TextDrawCreate
Instance of textdraw:
Lawmaking:
public OnGameModeInit()new Text:Textdraw0;
{
Textdraw0 = TextDrawCreate(240.0, 580.0, "SA-MP 0.3z"); // This creates a textdraw without any modification.
return 1;
}
An easy way to use this function is using a Textdraw Creator.
To show a textdraw to a player y'all should use the function TextDrawShowForPlayer.
Example of employ (based on the last case):
Code:
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw0);
}
To hibernate a textdraw to a thespian you lot must utilize the office TextDrawHideForPlayer.
Example:
Code:
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Textdraw0);
return one;
}
And to destroy a textdraw y'all use the office TextDrawDestroy.
Instance:
Code:
public OnGameModeInit()
{
TextDrawDestroy(Textdraw0);
return 1;
}
Dialog Function (menus & others):
ShowPlayerDialog(playerid, dialogid, way, caption[], info[], button1[], button2[]); - Shows the histrion a dialog box.
Boosted information: https://sampwiki.blast.hk/wiki/ShowPlayerDialog
* Annotation: Every dialog needs a unique "dialogid"; unless you do not use that ID inside the public OnDialogResponse (filterscripts and include dialogs must also utilize a unique dialogid).
In that location are 4 types of dialog:
Bulletin box style (sends a bulletin to the thespian):
Example code (with cancel button):
Code:
if(!strcmp(cmdtext, "/Help", true))
{
new Menu[202]; // This is the number of characters you lot are using inside your dialog (all characters).
Bill of fare[0]='\0'; // Variable of the dialog, divers before.
strcat(Carte du jour, "This is the text that will be shown inside your dialog. Yous can add together another\n", 77); // 77 is the number of characters in this line.
strcat(Menu, "line using the symbol shown in the upper line (due north). You do not need to add\n", 153); // 153 is the number of characters in the other lines plus this line.
strcat(Menu, "that symbol in the last line of your dialog box.", 202); // This are all the characters in your dialog box (202).
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog Help", Menu, "Have", "Cancel");
render 1;
}
Every lines has characters; the first line has 77 characters, so nosotros put 77 at the end.
In the 2nd line we have to count the characters in that line plus the characters in all the lines earlier that line. In this example is 153; and then we put 153 at the end.
Case code (without abolish button):
Code:
if(!strcmp(cmdtext, "/Help", true))
{
new Bill of fare[202];
Bill of fare[0]='\0';
strcat(Carte du jour, "This is the text that will be shown inside your dialog. You tin can add some other\n", 77); // strcat concatenates (joins together) our Carte du jour string and our text.
strcat(Card, "line using the symbol shown in the upper line (northward). Y'all do not demand to add\due north", 153); // Every line uses strcat.
strcat(Menu, "that symbol in the last line of your dialog box.", 202);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog Help", Menu, "Accept", ""); // We get out the 2nd botton only with "".
return 1;
}
The role "strcat" concatenates (joins together) our Carte string and our text.
* Note: You can use special websites to count characters.
When counting characters you only count the characters inside the ""; for example:
Code:
if(!strcmp(cmdtext, "/Aid", true))
{
new Card[202];
Carte[0]='\0';
strcat(Menu, "This is the text that volition be shown inside your dialog. You can add another\northward", 77);
strcat(Card, "line using the symbol shown in the upper line (n). You do not need to add\n", 153);
strcat(Carte, "that symbol in the last line of your dialog box.", 202);
ShowPlayerDialog(playerid, ane, DIALOG_STYLE_MSGBOX, "Dialog Assistance", Menu, "Accept", "");
return one;
}
The \due north graphic symbol also counts.
We can also add a office when we press "Accept" or "Abolish" within the public OnDialogResponse.
For instance:
Lawmaking:
if(!strcmp(cmdtext, "/Aid", true))
{
new Card[202];
Menu[0]='\0';
strcat(Card, "This is the text that will be shown inside your dialog. Yous can add together another\northward", 77);
strcat(Bill of fare, "line using the symbol shown in the upper line (n). You lot do not need to add together\n", 153);
strcat(Menu, "that symbol in the last line of your dialog box.", 202);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog Help", Menu, "Accept", "");
render ane;
}
We add together a bulletin function inside the public OnDialogResponse:
Lawmaking:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1) // Number 1 is the number of our dialog.
{
if(response) // If they clicked 'Accept'.
{
SendClientMessage(playerid, -1, "Thanks for reading!");
}
return 1; // Closing dialog response from dialog # one!
}
return 1; // Closing the public.
}
* Note: When using OnDialogResponse every dialog needs a number. In this example we used number 1:
Code:
ShowPlayerDialog(playerid, ane, DIALOG_STYLE_MSGBOX, "Dialog Aid", Menu, "Take", "");
render one;
}
Input style (allows players to input text into the dialog):
Example code:
Code:
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Text", "Write a text for all players!", "Take", "Abolish");
Afterward creating our code we must create a function to that lawmaking; so we volition use the public OnDialogResponse:
Example code:
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2)
{
if(!response) // If they clicked 'Cancel'.
{
SendClientMessage(playerid, -1, "Message canceled!");
}
else // If they pressed 'Accept'.
{
new Cord[200], Name[MAX_PLAYER_NAME]; // Defining variables.
GetPlayerName(playerid, Name, MAX_PLAYER_NAME); // Getting thespian'south name.
format(String, sizeof(String), "[<!>] Announce from %southward: %s", Proper name, inputtext); // Using a format for the message.
SendClientMessageToAll(-1, String);
}
return 1; // Closing dialog response from dialog # ii!
}
return 1; // Closing the public.
}
List manner (carte, show the player a list of options):
Example code (creating a weapon menu):
Code:
if(!strcmp(cmdtext, "/Weapon", true))
{
ShowPlayerDialog(playerid, three, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\north AK-47\n Combat Shotgun", "Select", "Shut");
render i;
}
Code:
"Weapons" = Title of the list.
"Desert Eagle\n AK-47\n Combat Shotgun" = Listing.
"Select" = Choose a weapon.
"Close" = Close the listing.
The \northward symbol is used to separate the elements of the listing.
To give the weapon nosotros use the public OnDialogResponse:
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 3)
{
if(response) // If they clicked 'Select' or double-clicked a weapon.
{
switch(listitem) // We create a switch to listing all the items; each example is a item from our dialog.
{
case 0:
{
GivePlayerWeapon(playerid, 24, 14); // Give them a desert eagle with xiv bullets.
}
instance 1:
{
GivePlayerWeapon(playerid, thirty, 120); // Requite them an AK-47 with 120 bullets.
}
instance 2:
{
GivePlayerWeapon(playerid, 27, 28); // Give them a Combat Shotgun with 28 bullets.
}
}
}
return 1; // Ending the dialog #iii.
}
render 1;
}
Structure of the part GivePlayerWeapon:
Code:
GivePlayerWeapon(playerid, weaponid, ammo);
Additional information about this office: https://sampwiki.nail.hk/wiki/GivePlayerWeapon
Countersign style (allows players to input text into the dialog without revealing information technology):
It has the same structure of "Input style"; by and large used in business relationship systems (it is a flake advanced for this tutorial).
If y'all desire to create an account system you can read this tutorials:
Kush account arrangement guide (Y_INI).
Lorenc_ account system guide (SQLite using rBits).
CREATING AND REMOVING OBJECTS:
There are many programs to create maps for your server; the well-nigh known are:
Map editor 1
Map editor 2
MTA map editor
Game Object ID List: https://sampwiki.blast.hk/wiki/Model_ID
Map editor (1 & 2):
Both have the same construction; and then this is an explanation for both.
Start using it:
- Afterwards dowloading it, you must open up the file "editor.exe" and press the button "LOAD".
- It will load the game map (GTA-SA); y'all can move your camera by moving your mouse while clicking the right mouse button. Y'all can movement around the map with the mouse scroll or with the keys "Due west, A, Due south & D" while pressing the right mouse push.
Creating objects:
- Motion to the place where you want to add together your mapping, then press the button "Objects" inside the carte (the menu on the correct of the window).
- Press "Add together" and search the object you want to add (ID or name); then press double click on it and press the button "Add".
- After doing it press on the object shown on the right of the window and after doing it press "insert".
- You can motility the object by using the "Movement" console.
- Subsequently mapping y'all can become the lawmaking and add it to your GM past pressing "Testify Code". Copy the code and paste information technology inside the public OnGameModeInit.
Instance code:
Code:
public OnGameModeInit()
{
CreateObject(2587, 2001.195679, 1547.113892, xiv.283400, 0.0, 0.0, 96.0); // Object will render at it'due south default distance.
return one;
}
Boosted information: https://sampwiki.blast.hk/wiki/CreateObject
Removing objects:
- Movement around the map and search the object you want to delete.
- Click on it and press "Supr".
- Later on deleting the object press "Testify Code". Paste the lawmaking within the public OnPlayerConnect.
Instance lawmaking:
Code:
public OnPlayerConnect(playerid)
{
RemoveBuildingForPlayer(playerid, 3782, 1803.0859, -1294.2031, 34.3438, 0.25);
return 1;
}
Additional information: https://sampwiki.smash.hk/wiki/RemoveBuildingForPlayer
MTA map editor:
This program is easier than the other editor.
You can download it here.
* Note: It is able to create objects just not to delete them from the original map.
Start using it:
- Later downloading it, open up the file MTA.exe
- Click on the map editor.
- To move around the map utilise the camera and the keys "Due west, A, Southward & D".
- To create objects press "F" and click on the cube object (in the lesser):
- Search or select your object and place it on the map.
* Note: Y'all can move information technology downward and up past clicking on the object and using the keys "Page Down (pg dn)" and "Page Up (pg up)". To rotate it employ "Shift + Curlicue". To alter information technology's angle use "CTRL + Folio Downwardly/Page Upwardly" or "CTRL + Arrow keys".
- To save your map press the salve button:
- To go the object lawmaking you can utilize a MTA converter:
Delux GTA Map Converter v2 (2015)
Delux GTA Map Converter v2:
- Instead of IPL file format cull PAWN Code for SA-MP. Search your map inside your MTA folder; it is normally within \mods\deathmatch\resources.
- Re-create your lawmaking.
Creating Objects:
After having the lawmaking of the object(s), you must add it within the public OnGameModeInit or OnFilterScriptInit.
Example code:
Lawmaking:
public OnGameModeInit()
{
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object volition render at it's default distance.
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0); // Object will render at 250.0 units (visible at 250 units).
return 1;
}
Merely SA-MP has an object limit of k objects. If yous desire to optimize your script or you want to add more than objects you should use the plugin Streamer.
Streamer installation:
- Dowload information technology from the streamer plugin thread.
- Later on downloading it, paste the file "streamer.so" or "streamer.dll" within the plugins folder (or but paste the plugins folder, the download ane, inside your server folder).
- Re-create the include "streamer.inc" inside your pawno includes folder.
- Edit the file "server.cfg" within your server folder and add together this line if you are using Windows:
Code:
plugins streamer.dll
If you are using Linux add:
- Copy this code down all the includes (include example: #include <a_samp>), within every script that uses streamer:
Lawmaking:
#define STREAMER_TYPE_OBJECT (0) #define STREAMER_AREA_TYPE_CIRCLE (0) #define STREAMER_OBJECT_TYPE_GLOBAL (0) enum#include <streamer>
#define STREAMER_TYPE_PICKUP (1)
#define STREAMER_TYPE_CP (2)
#define STREAMER_TYPE_RACE_CP (iii)
#define STREAMER_TYPE_MAP_ICON (iv)
#define STREAMER_TYPE_3D_TEXT_LABEL (v)
#ascertain STREAMER_TYPE_AREA (6)
#define STREAMER_AREA_TYPE_CYLINDER (1)
#define STREAMER_AREA_TYPE_SPHERE (two)
#ascertain STREAMER_AREA_TYPE_RECTANGLE (3)
#ascertain STREAMER_AREA_TYPE_CUBOID (4)
#define STREAMER_AREA_TYPE_POLYGON (5)
#define STREAMER_OBJECT_TYPE_PLAYER (1)
#define STREAMER_OBJECT_TYPE_DYNAMIC (2)
{
E_STREAMER_ATTACHED_OBJECT,
E_STREAMER_ATTACHED_PLAYER,
E_STREAMER_ATTACHED_VEHICLE,
E_STREAMER_ATTACH_OFFSET_X,
E_STREAMER_ATTACH_OFFSET_Y,
E_STREAMER_ATTACH_OFFSET_Z,
E_STREAMER_ATTACH_R_X,
E_STREAMER_ATTACH_R_Y,
E_STREAMER_ATTACH_R_Z,
E_STREAMER_ATTACH_X,
E_STREAMER_ATTACH_Y,
E_STREAMER_ATTACH_Z,
E_STREAMER_COLOR,
E_STREAMER_DRAW_DISTANCE,
E_STREAMER_EXTRA_ID,
E_STREAMER_INTERIOR_ID,
E_STREAMER_MAX_X,
E_STREAMER_MAX_Y,
E_STREAMER_MAX_Z,
E_STREAMER_MIN_X,
E_STREAMER_MIN_Y,
E_STREAMER_MIN_Z,
E_STREAMER_MODEL_ID,
E_STREAMER_MOVE_R_X,
E_STREAMER_MOVE_R_Y,
E_STREAMER_MOVE_R_Z,
E_STREAMER_MOVE_SPEED,
E_STREAMER_MOVE_X,
E_STREAMER_MOVE_Y,
E_STREAMER_MOVE_Z,
E_STREAMER_NEXT_X,
E_STREAMER_NEXT_Y,
E_STREAMER_NEXT_Z,
E_STREAMER_PLAYER_ID,
E_STREAMER_R_X,
E_STREAMER_R_Y,
E_STREAMER_R_Z,
E_STREAMER_SIZE,
E_STREAMER_STREAM_DISTANCE,
E_STREAMER_STYLE,
E_STREAMER_TEST_LOS,
E_STREAMER_TYPE,
E_STREAMER_WORLD_ID,
E_STREAMER_X,
E_STREAMER_Y,
E_STREAMER_Z
}
* Note: This code is based on the Streamer plugin update from 2015 (v2.seven.4).
- After doing this edit the object lawmaking you have. Instead of using "CreateObject" use "CreateDynamicObject".
Instance:
Instead of using a normal code...
Code:
public OnGameModeInit()
{
CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
return 1;
}
Apply this:
Code:
public OnGameModeInit()
{
CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
render 1;
}
* Note: You tin can edit your "CreateObject" code faster by using a ".txt" file. Paste the code inside of it; press "CTRL + R", search "CreateObject" and supersede information technology with "CreateDynamicObject" (use this if your map is very big).
- After doing this open the PWN file where you desire to add together the objects (ordinarily inside the gamemode) and paste your lawmaking.
Case code:
Code:
public OnGameModeInit()
{
CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
return i;
}
Boosted information about Streamer plugin.
Outset PRACTICING:
Now you know this, you can practice by editing other scripts or you lot tin can attempt creating your own script.
A good way of starting is editing other gamemodes!
If there is whatever mistake in this guide or something should be added, just mail service it.
* Note: this is an pocket-size guide compared to all the basic information of SA-MP that a new scripter should know; this guide volition be updated according to post suggestions on this thread.
Guide credits: Ygzeb (David Talledo)
Special cheers to:
Y_Less for a correction in some information presented in this guide and Kwarde that helped to update some links that were broken (2021) :)
Addon (2021) .- Some links or images may just not work at present or in the future, they may exist stock-still or not. However, I hope this guide volition still help people.
pepperthatheriams.blogspot.com
Source: https://www.burgershot.gg/showthread.php?tid=738&action=lastpost
0 Response to "How to Upload Gamemode to Samp Server"
Post a Comment