Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 6,509
» Latest member: crazyosman365
» Forum threads: 2,233
» Forum posts: 12,033

Full Statistics

Online Users
There are currently 490 online users.
» 0 Member(s) | 487 Guest(s)
Google, Bing, Yandex

Latest Threads
Command does not work in-...
Forum: Pawn Scripting
Last Post: PANZEHIR_
2024-11-23, 06:36 PM
» Replies: 0
» Views: 41
White Screen
Forum: Support
Last Post: Phat202146_real
2024-11-21, 02:50 PM
» Replies: 0
» Views: 39
I get error 021 using y_h...
Forum: Pawn Scripting
Last Post: daniscript18
2024-11-18, 11:34 PM
» Replies: 0
» Views: 60
Il reste des français sur...
Forum: French/Fran?ais
Last Post: tysanio
2024-11-18, 05:39 AM
» Replies: 2
» Views: 466
Object creation issues
Forum: Programming
Last Post: K1271
2024-11-15, 11:51 PM
» Replies: 0
» Views: 56
Is the SAMP Hosting the s...
Forum: General Discussions
Last Post: OperaGX
2024-11-14, 09:33 PM
» Replies: 0
» Views: 74
Run time error 19: "File ...
Forum: Pawn Scripting
Last Post: Rexey
2024-11-14, 03:50 AM
» Replies: 0
» Views: 64
How to Compile Your Gamem...
Forum: Tutorials
Last Post: thelante
2024-11-13, 08:50 AM
» Replies: 3
» Views: 468
Modeller wanted
Forum: Development Updates
Last Post: acc.gangbeni
2024-11-11, 05:10 PM
» Replies: 9
» Views: 16,503
SA:MP forum offline
Forum: Portuguese/Portugu?s
Last Post: weslley_script
2024-11-09, 05:27 PM
» Replies: 7
» Views: 9,930

 
Lightbulb Gu?a b?sica de SA-MP y Pawn
Posted by: Ygzeb - 2019-08-02, 08:17 PM - Forum: Programaci?n - Replies (6)

GU?A B?SICA DE SA-MP Y PAWN

[Image: YPOK9Or.png]

INTRO:

Esta gu?a esta basada en diversas gu?as y en mi propia experiencia. Gu?a creada especialmente para nuevos scripters y usuarios a los que les gustar?a aprender sobre el lenguaje Pawn en SA-MP; explicando solo lo b?sico y c?mo empezar.

* Nota: es importante que el usuario tenga el mayor conocimiento posible del idioma ingl?s, dado que el lenguaje de programaci?n Pawn est? basado en este idioma.

Esta gu?a est? basada en una publicaci?n que hice para el foro?SA-MP a inicios del a?o 2015, si usted lee esto en otro tiempo es probable que algunos elementos hayan cambiado y/o actualizado.

Basado en:

Nicholas tutorial
Kwarde tutorial
Wiki SA-MP

Conocimiento propio.



?NDICE:

INICIANDO
? ?
Explicando cada archivo y carpeta (solo los b?sicos)

scriptfiles
plugins
pawno
npcmodes
include
gamemodes
filterscripts
announce.exe
samp-npc.exe
samp-server.exe
server.cfg

CONFIGURACI?N

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)

Funciones

SetPlayerPos(playerid, X, Y, Z);
TextDrawCreate(X, Y, text[])

Dialogs (men?s & otros)

ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
Dialog de cuadro (env?a un mensaje al jugador)
Dialog de texto (permite a los jugadores colocar texto en el dialog)
Dialog de lista (men?, muestra a los jugadores una lista de opciones)
Dialog de contrase?a (permite a los jugadores colocar texto en el dialog, sin revelar el texto)

CREANDO Y REMOVIENDO OBJETOS

Map editor (1 & 2)

Empezando
Creando objectos
Removiendo objectos

MTA editor

Empezando
Delux GTA Map Converter v2

Creando Objectos

Instalar Streamer



EMPIECE A PRACTICAR



INICIANDO:

Primero debe descargar el archivo SA-MP Windows Server desde SA-MP.com

Despu?s de descargarlo y descomprimirlo, veremos estos archivos...

Archivos y carpetas b?sicos:

scriptfiles, plugins, pawno, npcmodes, include, gamemodes, filterscripts, announce.exe, samp-npc.exe, samp-server.exe & server.cfg

Otros archivos:

Textos que incluyen t?rminos de servicio y una gu?a de configuraci?n (samp-license.txt & server-readme.txt respectivamente).


Explicando cada archivo y carpeta (solo los b?sicos):

scriptfiles: esta carpeta contiene informaci?n llamada dentro del script o logs producidos por el script. Normalmente es usada como base de datos.

plugins: esta carpeta contiene c?digos adicionales que dan m?s opciones en la programaci?n, usualmente programados en otros lenguajes de programaci?n. Esta gu?a no dar? informaci?n detallada sobre plugins debido a que es m?s avanzado.

pawno: contiene el programa b?sico para empezar a programar en SA-MP; tambi?n tiene la carpeta include que contiene los includes b?sicos de SA-MP para empezar nuestro script (funciones b?sicas de SA-MP). Tambi?n podemos crear nuestros propios includes y a?adirlos al script.

npcmodes: contiene informaci?n sobre NPCs (script & rec); esta gu?a no dar? informaci?n detallada sobre NPCs debido a que es m?s avanzado.

include: contiene c?digos que pueden ser incluidos en el script.

gamemodes: contiene los modos de juego b?sicos y si creamos uno debemos colocar aqu? tambi?n.

filterscripts: contiene c?digos adicionales, separados del gamemode, no est?n incluidos dentro de ?l y pueden ser llamados al usar comandos rcon.

announce.exe: este archivo nos permitir? mostrar nuestro servidor en la lista de Internet.

samp-npc.exe: nos permitir? usar NPCs.

samp-server.exe: con este archivo iniciamos el servidor.

server.cfg: configuraci?n del servidor.




CONFIGURACI?N:

Primero debemos abrir el archivo "server.cfg" y editar la configuraci?n del servidor.

Al abrirlo encontraremos:

Code:
echo Executing Server Config...
lanmode 0
rcon_password changeme
maxplayers 50
port 7777
hostname SA-MP 0.3 Server
gamemode0 grandlarc 1
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner
announce 0
query 1
chatlogging 0
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]

Puede editar la configuraci?n basado en esto:

Code:
echo Executing Server Config...
lanmode 0 (lan mode activada "1" o desactivada "0")
rcon_password changeme (la contrase?a que usar? al colocar "/Rcon login"; debe editar esto)?
maxplayers 50 (cantidad permitida de jugadores, slots)
port 7777 (el puerto que usar?; por ejemplo: 127.0.0.1:7777)
hostname SA-MP 0.3 Server (el nombre de su servidor)
gamemode0 grandlarc 1 (el nombre del gamemode que usar?, puede a?adir un gamemode si usted crea o descarga uno)
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner (los "filterscripts" que usar?)
announce 0 (servidor visible en la lista de Internet; "1" para activar y "0" para desactivar)
query 1 (informaci?n del servidor visible "1"; "0" no enviar? informaci?n del servidor a los jugadores externos)
chatlogging 0 (guardar conversaciones en el archivo server_log.txt; para guardarlas use "1", para no guardarlas use "0")
weburl www.sa-mp.com (p?gina web del servidor)
onfoot_rate 40 (no se explicar? en esta gu?a, es avanzado)
incar_rate 40 (no se explicar? en esta gu?a, es avanzado)
weapon_rate 40 (no se explicar? en esta gu?a, es avanzado)
stream_distance 300.0 (no se explicar? en esta gu?a, es avanzado)
stream_rate 1000 (no se explicar? en esta gu?a, es avanzado)
maxnpc 0 (m?ximo n?mero de NPCs que pueden entrar al servidor)
logtimeformat [%H:%M:%S]

Tambi?n puede leer m?s sobre el archivo server.cfg y su configuraci?n.

Ejemplo de configuraci?n (la gu?a est? basada en esta configuraci?n):

Code:
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 1
query 1
chatlogging 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]

PAWN SCRIPTING:

Despu?s de editar la configuraci?n empezaremos a programar el modo de juego.

En este caso usaremos un gamemode b?sico que pueden descargar aqu?.

Deben colocarlo dentro de la carpeta gamemodes.

Despu?s de hacer esto deben abrir la carpeta pawno, dentro de su servidor, y abrir el archivo "pawno.exe".

Presione "File/Open" (o simplemente CTRL O) y abra su gamemode, colocado dentro de la carpeta gamemodes.

Dentro tenemos esto:

Code:
#include <a_samp>

Este es el include b?sico de SA-MP, debe estar incluido en cada script que usted cree en el ?mbito de SA-MP.

Este es el mensaje que ser? mostrado en consola al abrir el archivo samp-server.exe:

Code:
main()
{
print("Script desarrollado por Ygzeb.");
}

El texto azul es el mensaje que ser? mostrado.

Puede editar el texto que ser? mostrado en consola al encender su servidor, simplemente cambiando el texto azul; por ejemplo:

Code:
main()
{
print("?Mi primer script!");
}

* Nota: Todos los c?digos deben tener llaves abiertas y cerradas al empezar y terminar la funci?n.

Ejemplo:

Llaves abiertas = Rojo
Llaves cerradas = Verde


main()
{
print("?Mi primer script!");
}


* Nota: ?Es muy importante que despu?s de realizar un cambio en el script presione F5! Esto actualizar? el archivo AMX y los cambios realizados quedar?n guardados ("si no hay error alguno", aunque en casos especiales hay errores de programaci?n que no figurar?n y afectar?n al servidor internamente). Si todo anda bien ver? algo parecido a esto:

[Image: Gobeslv.jpg]

De lo contrario significa que el script tiene errores, hizo algo mal y debe corregirlo.


Publics:

Los publics son funciones b?sicas que son llamadas mientras su servidor est? encendido, en momentos precisos.
SA-MP cuenta con publics b?sicos que son llamados en la mayor?a de servidores. Normalmente el nombre de un public describe cu?ndo se ejecuta el public.

Algunos publics son llamados en momentos especiales, por ejemplo al spawnear; puede a?adir una funci?n a ese momento en espec?fico.

Por ejemplo, si queremos cambiar la vida de los jugadores a 50 al spawnear, usar?amos algo como:

Code:
public OnPlayerSpawn(playerid)
{
? ?SetPlayerHealth(playerid, 50);
? ?return 1;
}

* Nota: no podemos usar publics id?nticos en un mismo script; por ejemplo dos publics OnPlayerSpawn. Si queremos a?adir una funci?n adicional debemos agregarla en el mismo public o en un filterscript. Bas?ndonos en el ejemplo anterior, a?adiremos un mensaje al spawnear:

Code:
public OnPlayerSpawn(playerid)
{
? ?SetPlayerHealth(playerid, 50);
? ?SendClientMessage(playerid, -1, "?Spawneaste!"); // Funci?n a?adida.
? ?return 1;
}

Algunos publics que son usados com?nmente:

public OnGameModeInit() - Llamado al iniciar el gamemode.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnGameModeInit

Estructura b?sica:

Code:
public OnGameModeInit()
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnGameModeInit()
{
? ? UsePlayerPedAnims(); // Permite a los jugadores correr como CJ.
? ? SetGameModeText("Blank"); // Nombre del modo, ser? mostrado en la lista de servidores.
? ? AddPlayerClass(115, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
? ? AddPlayerClass(122, 1958.3783, 1343.1572, 15.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, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
? ? return 1;
}

AddPlayerClass es una funci?n que permite a?adir personajes en la selecci?n de personaje; por ejemplo si queremos a?adir el personaje de Sweet, debemos a?adir esto en nuestro gamemode:

Code:
AddPlayerClass(270, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

El n?mero "270" el ID del personaje de Sweet.

public OnGameModeExit() - Llamado al finalizar el gamemode; no es obligatorio en el script (opcional en la mayor?a de casos).

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnGameModeExit

Estructura b?sica:

Code:
public OnGameModeExit()
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnGameModeExit()
{
? ? print("Mode ended."); // Mensaje a la consola.
? ? return 1;
}

public OnPlayerRequestClass(playerid, classid) - Llamado en la selecci?n de personaje.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerRequestClass

Estructura b?sica:

Code:
public OnPlayerRequestClass(playerid, classid)
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerRequestClass(playerid, classid)
{
? ? SetPlayerPos(playerid, 2294.2810, 558.2053, 7.7813); // Posici?n del personaje.
? ? SetPlayerCameraPos(playerid, 2294.3071, 560.6948, 8.7324); // Posici?n de la c?mara.
? ? SetPlayerCameraLookAt(playerid, 2294.2810, 558.2053, 7.7813); // Lugar a donde la c?mara se?ala.
? ? SetPlayerFacingAngle(playerid, 0);
? ? return 1;
}

SetPlayerFacingAngle cambia el ?ngulo hacia donde el personaje observa; su estructura es:

Code:
playerid = ID del jugador
0 = ?ngulo (en este caso norte).

? ? norte (0)
? ? ? ? ? ?|
(90) oeste-? ?-este (270)
? ? ? ? ? ?|
? ? ? ? sur (180)

Mayor informaci?n sobre SetPlayerFacingAngle.

public OnPlayerConnect(playerid) - Llamado cuando un jugador se conecta.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerConnect

Estructura b?sica:

Code:
public OnPlayerConnect(playerid)
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerConnect(playerid)
{
? ? PlayAudioStreamForPlayer(playerid, "http://s1.radio.ge/Music/AcDc/1980_Back_In_Black/06_Back_In_Black.mp3");? ?// Iniciar? la canci?n Back in Black, AC/DC
? ? return 1;
}

PlayAudioStreamForPlayer es una funci?n que reproduce un sonido externo al jugador. Su estructura es:

Code:
playerid = ID del jugador
"http://s1.radio.ge/Music/AcDc/1980_Back_In_Black/06_Back_In_Black.mp3" = link del audio

* Nota: el audio debe estar en un formato en espec?fico para funcionar, por ejemplo este link.

Puede encontrar m?sica en muchas p?ginas. Por ejemplo en esta web.

public OnPlayerSpawn(playerid) - Llamado despu?s de seleccionar personaje, al spawnear. Estas funciones afectar?n al jugador al spawnear.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerSpawn

Estructura b?sica:

Code:
public OnPlayerSpawn(playerid)
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerSpawn(playerid)
{
? ?SendClientMessage(playerid, -1, "?Spawn!"); // Env?a un mensaje al jugador.
? ?return 1;
}

SendClientMessage es una funci?n que env?a un mensaje al jugador; su estructura es:

Code:
playerid = ID del jugador
-1 = Color, -1 es blanco
"?Spawn!" = mensaje

Mayor informaci?n sobre SendClientMessage.

public OnPlayerDeath(playerid) - Llamado al morir. Esta funci?n afectar? al jugador al morir.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerDeath

Estructura b?sica:

Code:
public OnPlayerDeath(playerid)
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerDeath(playerid)
{
? ?GameTextForPlayer(playerid, "Asesinado", 5000, 2); // Env?a un mensaje en pantalla al jugador.
? ?return 1;
}

GameTextForPlayer env?a un mensaje en pantalla al jugador; su estructura es:

Code:
playerid = ID del jugador
"Asesinado" = mensaje
5000 = tiempo en mili-segundos; en este caso 5 segundos.
2 = tipo de mensaje

Mayor informaci?n sobre GameTextForPlayer.

public OnPlayerDisconnect(playerid, reason) - Llamado al desconectarse el jugador.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerDisconnect

Estructura b?sica:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? // Enviando un mensaje a todos que el jugador se desconect?.
? ? new String[64], // Variable asignada al mensaje. 64 es el n?mero de caracteres que usar? el mensaje (tal vez m?s que el mensaje).
? ? Nombre[MAX_PLAYER_NAME];? // Variable asignada al nombre del jugador; normalmente definida como MAX_PLAYER_NAME.
? ? GetPlayerName(playerid, Nombre, MAX_PLAYER_NAME); // Obteniendo el nombre del jugador (Nombre) y el n?mero de caracteres que usa, normalmente definido como MAX_PLAYER_NAME (definido por SA-MP por defecto).
? ? format(String, sizeof String, "%s sali?.", Nombre); // Aplicando un formato al mensaje.
? ? SendClientMessageToAll(-1, String); // Enviando un mensaje a todos los jugadores; String es el formato que tendr? el mensaje.
? ? return 1;
}

public OnPlayerText(playerid) - Llamado cuando el jugador env?a un mensaje (chat).

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerText

Estructura b?sica:

Code:
public OnPlayerText(playerid, text[])
{
? ? // Aqu? va el c?digo.
? ? return 1;
}

Ejemplo:

Code:
public OnPlayerText(playerid, text[])
{
? ? new Nombre[MAX_PLAYER_NAME], String[175];
? ? GetPlayerName(playerid, Nombre, sizeof(Nombre));
? ? format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Nombre, playerid, text); // Aplicando formato.
? ? SendClientMessageToAll(GetPlayerColor(playerid), String); // Enviando el mensaje con GetPlayerColor, que es el color actual del jugador.
? ? return 0; // Ignorando el texto por defecto, terminando la funci?n.
}

Esta funci?n es el formato aplicado a SendClientMessageToAll. Cuando sea enviado seguir? el formato:

Code:
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Name, playerid, text);?

Code:
%s y %d son valores asignados dependiendo del jugador.
%s es un valor textual (en este caso el nombre del jugador y el texto).
%d es un valor num?rico (ID del jugador).

Code:
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Name, playerid, text);?

Nombre, ID & texto son los valores asignados a %s, %d y %s.

public OnPlayerUpdate(playerid) - Llamado cada vez que el usuario env?a su estado al servidor.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/OnPlayerUpdate

Estructura b?sica:

Code:
public OnPlayerUpdate(playerid)
{
? ? // Aqu? va el c?digo.
? ? return 1; // Si retorna 0, el cliente no ser? actualizado para los dem?s jugadores (como si estuviese pausado).
}

Ejemplo:

Code:
public OnPlayerUpdate(playerid)
{
? ? if(GetPlayerWeapon(playerid) == 38) return Kick(playerid); // Expulsar? al jugador si usa una minigun.
? ? return 1;
}

"if" para detectar si una situaci?n en especial est? ocurriendo; en caso de ser as? el servidor ejecutar? una funci?n determinada.

Traduciendo esto a nuestro idioma, ser?a algo como:

?Si est? usando minigun, exp?lsalo!

* Nota: usar "if" en OnPlayerUpdate puede causar lag, esto es solo un ejemplo.

Usar la funci?n return con "Kick(playerid);" significa que la funci?n termina ah?. Si tiene otro c?digo bajo esta funci?n, no ser? ejecutado si esta funci?n es llamada.

Por ejemplo:

Code:
public OnPlayerUpdate(playerid)
{
? ? if(GetPlayerWeapon(playerid) == 38) return Kick(playerid);
? ? SendClientMessage(playerid, -1, "?Actualizado!"); // Esta funci?n no ser? ejecutada si el jugador est? usando minigun.
? ? return 1;
}


Funciones:

B?sicamente, la mayor?a de funciones (funciones nativas/b?sicas de SA-MP) describen lo que hacen en su nombre; puede encontrar muchas de ellas aqu?.

Algunas funciones b?sicas que son usadas mayormente:

SetPlayerPos(playerid, X, Y, Z); - Cambia la posici?n del jugador (X, Y & Z son los puntos donde mover? al jugador).

Informaci?n adicional: https://sampwiki.blast.hk/wiki/SetPlayerPos

Ejemplo:

Code:
SetPlayerPos(playerid, 0.0, 0.0, 3.0); // Cambia la posici?n del jugador al campo.

Puede guardar su posici?n actual usando /Save dentro del juego (comando por defecto de SA-MP). Despu?s de esto debe ir a "\GTA San Andreas User Files\SAMP" y abrir el archivo "savedpositions.txt". Dentro encontrar? algo parecido a:

Code:
AddPlayerClass(270, 700, 700, 5, 0, 0, 0, 0, 0, 0, 0);

Luego simplemente copie los valores en rojo:

Code:
AddPlayerClass(270, 700, 700, 5, 0, 0, 0, 0, 0, 0, 0);

* Nota: obviamente los valores no son rojos, solo es un ejemplo.

Luego pegue los valores dentro de la funci?n SetPlayerPos; as?:

Code:
SetPlayerPos(playerid, 700, 700, 5);

Tambi?n puede usar este sistema que lo programar? por usted.

TextDrawCreate(X, Y, text[]) - Crea un textdraw (X & Y son las coordenadas de la pantalla y "text" es el texto que mostrar?).

Informaci?n adicional: https://sampwiki.blast.hk/wiki/TextDrawCreate

Ejemplo de textdraw:

Code:
new Text:Textdraw0;

public OnGameModeInit()
{
? ? Textdraw0 = TextDrawCreate(240.0, 580.0, "SA-MP 0.3z"); // Esto crea un textdraw sin modificar.
? ? return 1;
}

Una forma sencilla de usar esta funci?n es con un Editor de Textdraw.

Para mostrar un textdraw al jugador debe usar la funci?n TextDrawShowForPlayer.

Ejemplo de uso (basado en el ejemplo anterior):

Code:
public OnPlayerConnect(playerid)
{
? ? TextDrawShowForPlayer(playerid, Textdraw0);
}

Para esconder el textdraw del jugador debe usar la funci?n TextDrawHideForPlayer.

Ejemplo:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? TextDrawHideForPlayer(playerid, Textdraw0);
? ? return 1;
}

Y para destruir el textdraw debe usar TextDrawDestroy.

Ejemplo:

Code:
public OnGameModeInit()
{
? ? TextDrawDestroy(Textdraw0);
? ? return 1;
}


Dialogs (men?s & otros):

ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]); - Muestra al jugador un dialog.

Informaci?n adicional: https://sampwiki.blast.hk/wiki/ShowPlayerDialog

* Nota: Todo dialog necesita un ID ?nico (dialogid); a no ser que no use dicho ID en el public OnDialogResponse (los dialogs de filterscripts e includes debe usar tambi?n un ID ?nico).

Hay cuatro tipos de dialogs:

Dialog de cuadro (env?a un mensaje al jugador):

[Image: Dialog_style_msgbox.png]

Ejemplo (con el bot?n de cancelar):

Code:
if(!strcmp(cmdtext, "/Ayuda", true))
{
? ? new Menu[187]; // N?mero de caracteres que usar? dentro del dialog (todos los caracteres).
? ? Menu[0]='\0'; // Variable del dialog, definida antes.
? ? strcat(Menu, "Este es el texto que ser? mostrado dentro del dialog. Puede a?adir otra\n", 73); // 73 es el n?mero de caracteres en esta l?nea.
? ? strcat(Menu, "l?nea usando el s?mbolo de la l?nea anterior (n). No necesita\n", 137); // 137 es el n?mero de caracteres en otras l?neas sumado a esta l?nea.
? ? strcat(Menu, "colocar el s?mbolo en la ?ltima l?nea del dialog.", 187); // Estos son todos los caracteres usados en el dialog.
? ? ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "Cancelar");
? ? return 1;
}

Cada l?nea tiene caracteres; la primera l?nea tiene 73 caracteres as? que ponemos 73 al final.

En la segunda y todas las l?neas posteriores debemos contar los caracteres de dicha l?nea sumado con los caracteres de las otras l?neas. En el caso de la segunda l?nea es 137 por lo que pondremos eso al final.

Ejemplo (sin el bot?n de cancelar):

Code:
if(!strcmp(cmdtext, "/Ayuda", true))
{
? ? new Menu[187]; // N?mero de caracteres que usar? dentro del dialog (todos los caracteres).
? ? Menu[0]='\0'; // Variable del dialog, definida antes.
? ? strcat(Menu, "Este es el texto que ser? mostrado dentro del dialog. Puede a?adir otra\n", 73); // strcat junta el string de Menu, sumado con el string del texto.
? ? strcat(Menu, "l?nea usando el s?mbolo de la l?nea anterior (n). No necesita\n", 137); // Todas las l?neas usan strcat.
? ? strcat(Menu, "colocar el s?mbolo en la ?ltima l?nea del dialog.", 187);
? ? ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", ""); // En lugar de cancelar, dejamos el segundo bot?n solo con "".
? ? return 1;
}

La funci?n strcat junta el string de Menu, sumado con el string del texto.

* Nota: Puede usar p?ginas para contar caracteres.

Cuando cuenta los caracteres solo debe tomar en cuenta los que est?n entre ""; por ejemplo:

Code:
if(!strcmp(cmdtext, "/Ayuda", true))
{
? ? new Menu[187];
? ? Menu[0]='\0';
? ? strcat(Menu, "Este es el texto que ser? mostrado dentro del dialog. Puede a?adir otra\n", 73);
? ? strcat(Menu, "l?nea usando el s?mbolo de la l?nea anterior (n). No necesita\n", 137);
? ? strcat(Menu, "colocar el s?mbolo en la ?ltima l?nea del dialog.", 187);
? ? ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "");
? ? return 1;
}

La \n tambi?n cuenta.

Tambi?n podemos a?adir una funci?n al presionar "Aceptar" o "Cancelar" dentro del public OnDialogResponse.

Por ejemplo:

Code:
if(!strcmp(cmdtext, "/Ayuda", true))
{
? ? new Menu[187];
? ? Menu[0]='\0';
? ? strcat(Menu, "Este es el texto que ser? mostrado dentro del dialog. Puede a?adir otra\n", 73);
? ? strcat(Menu, "l?nea usando el s?mbolo de la l?nea anterior (n). No necesita\n", 137);
? ? strcat(Menu, "colocar el s?mbolo en la ?ltima l?nea del dialog.", 187);
? ? ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "");
? ? return 1;
}

A?adimos un mensaje (la funci?n) dentro del public OnDialogResponse:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
? ? if(dialogid == 1) // El n?mero 1 es el n?mero de nuestro dialog anterior.
? ? {
? ? ? ? if(response) // Si presionaron 'Aceptar'.?
? ? ? ? {
? ? ? ? ? ? SendClientMessage(playerid, -1, "?Gracias por leer!");
? ? ? ? }
? ? return 1; // Cerrando dialog response del dialog # 1!
? ? }
return 1; // Cerrando public.
}

* Nota: Al usar OnDialogResponse cada dialog debe tener un n?mero. En este caso usamos el n?mero 1:

Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Ayuda de dialog", Menu, "Aceptar", "");
? ? return 1;
}

Dialog de texto (permite a los jugadores colocar texto en el dialog)

[Image: Dialog_style_input.png]

Ejemplo:

Code:
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Texto", "?Escriba un texto a todos los jugadores", "Aceptar", "Cancelar");

Despu?s de crear nuestro c?digo debemos crear una funci?n al c?digo; para ello usaremos public OnDialogResponse:

Ejemplo:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
? ? if(dialogid == 2)
? ? {
? ? ? ? if(!response) // Si presionaron 'Cancelar'.?
? ? ? ? {
? ? ? ? ? ? SendClientMessage(playerid, -1, "?Mensaje cancelado!");
? ? ? ? }
? ? ? ? else // Si presionaron 'Aceptar'.
? ? ? ? {
? ? ? ? ? ? new String[200], Nombre[MAX_PLAYER_NAME]; // Definiendo variables.
? ? ? ? ? ? GetPlayerName(playerid, Nombre, MAX_PLAYER_NAME); // Obteniendo el nombre del jugador (asignando un valor a la variable).
? ? ? ? ? ? format(String, sizeof(String), "[<!>] Anuncio de %s: %s", Nombre, inputtext); // Usando un formato para el mensaje.
? ? ? ? ? ? SendClientMessageToAll(-1, String);
? ? ? ? }
? ? return 1; // Cerrando respuesta del dialog # 2!
? ? }
return 1; // Cerrando public.
}

Dialog de lista (men?, muestra a los jugadores una lista de opciones):

[Image: Dialog_style_list.png]

Ejemplo (creando un men? de armas):

Code:
if(!strcmp(cmdtext, "/Weapon", true))
{
? ? ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Armas", "Desert Eagle\n AK-47\n Combat Shotgun", "Seleccionar", "Cerrar");
? ? return 1;
}

Code:
"Armas" = T?tulo de la lista
"Desert Eagle\n AK-47\n Combat Shotgun" = Lista.
"Seleccionar" = Seleccionar un ?tem (arma).
"Cerrar" = Cerrar lista.

El s?mbolo \n es usado para separar los elementos de la lista (en filas).

Para dar el arma usamos public OnDialogResponse:

Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
? ? if(dialogid == 3)
? ? {
? ? ? ? if(response) // Si presionaron 'Seleccionar' o dieron doble clic a un arma.
? ? ? ? {
? ? ? ? ? ? switch(listitem) // Creamos swith a todos los elementos de la lista; cada caso representa un elemento.
? ? ? ? ? ? {
? ? ? ? ? ? ? ? case 0:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 24, 14); // Dar un arma Desert Eagle con 14 balas.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 30, 120); // Dar un arma AK-47 con 120 balas.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 27, 28); // Dar un arma Combat Shotgun con 28 balas.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return 1; // Cerrando dialog response del dialog # 3!
? ? }
? ? return 1; // Cerrando public.
}

Estructura de la funci?n GivePlayerWeapon:

Code:
GivePlayerWeapon(playerid, weaponid, ammo);

Informaci?n adicional sobre la funci?n: https://sampwiki.blast.hk/wiki/GivePlayerWeapon


Dialog de contrase?a (permite a los jugadores colocar texto en el dialog, sin revelar el texto):

[Image: Dialog_style_password.png]

Tiene la misma estructura que "Dialog de contrase?a"; mayormente usado en sistemas de registro (lo cual es ligeramente avanzado para ser explicado en esta gu?a).

Si quiere ver c?mo crear sistemas de registro puede visitar:

TheChaoz, c?mo crear un sistema de registro.
Kush account system guide (Y_INI).
Lorenc_ account system guide (SQLite using rBits).





CREANDO Y REMOVIENDO OBJETOS:

Hay muchos programas para modificar el mapa del servidor; los m?s conocidos son:

Map editor 1 (ingl?s)
Map editor 2 (ingl?s)
MTA editor

Lista de objetos: https://sampwiki.blast.hk/wiki/Model_ID


Map editor (1 & 2):

Ambos tienen una estructura parecida; esta es una explicaci?n para ambos casos.

Empezando:

- Despu?s de descargarlo, debe abrir el archivo "editor.exe" y presionar el bot?n "LOAD".

- Cargar? el mapa del juego (GTA-SA); puede mover la c?mara moviendo el mouse mientras presiona clic derecho. Puede mover por el mapa con el scroll o usando las teclas "W, A, S y D" mientras presiona clic derecho.

Creando objetos:

- Mu?vase al lugar donde quiere a?adir el mapa, presione el bot?n "Objects" dentro del men? (el men? al lado derecho de la ventana).

- Presione "Ǘ" y busque el objeto que quiere a?adir (ID o nombre); luego haga doble clic en ?l y presione el bot?n "Add".

- Despu?s de hacerlo presione en el objeto mostrado en el lado derecho de la venta, luego presione "insert".

- Puede mover el objeto usando el panel "Movement".

- Despu?s de mapear puede obtener el c?digo y a?adirlo a su GM presionando "Show Code". Copa el c?digo y lo pega en OnGameModeInit.

Ejemplo:

Code:
public OnGameModeInit()
{
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // El objeto cargar? a su distancia por defecto (GTA-SA).
? ? return 1;
}

Informaci?n adicional: https://sampwiki.blast.hk/wiki/CreateObject

Removiendo objetos:

- Mu?vase alrededor del mapa y busque el objeto que desea borrar.

- Haga clic en ?l y presione la tecla "Supr".

- Despu?s de borrarlo presione "Show Code". Debe pegar el c?digo en public OnPlayerConnect.

Ejemplo:

Code:
public OnPlayerConnect(playerid)
{
? ? RemoveBuildingForPlayer(playerid, 3782, 1803.0859, -1294.2031, 34.3438, 0.25);
? ? return 1;
}

Informaci?n adicional: https://sampwiki.blast.hk/wiki/RemoveBuildingForPlayer


MTA editor:

Este programa es m?s sencillo de usar (para los nuevos) que el otro editor.

Puede descargarlo aqu?.

* Nota: El programa puede crear objetos pero no eliminarlos.

Empezando:

- Despu?s de descargarlo, abra el archivo MTA.exe

- Haga clic en el editor de mapas.

- Mu?vase por el mapa, use la c?mara y las teclas "W, A, S y D".

- Para crear objetos presione "F" y haga clic en el cubo (parte inferior):

[Image: uwz65v3.jpg]

- Busque el objeto y col?quelo en el mapa.

* Nota: Puede mover arriba y abajo haciendo clic en el objecto y usando las teclas "Avpag" y "Repag" (o tambi?n conocidas como "Page Down (pg dn)" y "Page Up (pg up)"). Para rotarlo use "Shift Scroll". Para cambiar el ?ngulo use "CTRL Avpag/Repag" o "CTRL Flechas".

- Para guardar el mapa use el bot?n de guardado:

[Image: bROE6FQ.jpg]

- Para obtener el c?digo use un convertidor de mapas MTA:

Delux GTA Map Converter v2 (2015)

Delux GTA Map Converter v2:

- En vez de IPL file format escoja PAWN Code for SA-MP. Busque el mapa dentro de la carpeta MTA; usualmente se encuentra dentro de \mods\deathmatch\resources.

- Copie el c?digo.


Creando Objetos:

Despu?s de obtener el c?digo de objeto, debe a?adirlo dentro de public OnGameModeInit o OnFilterScriptInit.

Ejemplo:

Code:
public OnGameModeInit()
{
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // El objeto cargar? a su distancia original.
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 250.0); //El objeto ser? visible a 250 unidades.
? ? return 1;
}

Sin embargo, SA-MP tiene un l?mite de 1000 objetos. Si quiere optimizar el script o hacerlo m?s r?pido, debe usar el plugin Streamer.

Instalaci?n de Streamer:

- Puede descargarlo desde el tema del plugin.

- Despu?s de descargarlo, pegue el archivo "streamer.so" o "streamer.dll" dentro de la carpeta plugins (o simplemente pegue la carpeta plugins contenida en la descarga dentro de la carpeta del servidor).

- Copie el include "streamer.inc" dentro de la carpeta includes, dentro de la carpeta pawno.

- Edite el archivo "server.cfg" dentro de la carpeta de su servidor y agregue esta l?nea si est? usando Windows:

Code:
plugins streamer.dll

Si usa Linux agregue:

Code:
plugins streamer.so

- Copie este c?digo dentro debajo de todos los includes (ejemplo de include: #include <a_samp>) de cada script que use el plugin streamer:

Code:
#include <streamer>

#define STREAMER_TYPE_OBJECT (0)
#define STREAMER_TYPE_PICKUP (1)
#define STREAMER_TYPE_CP (2)
#define STREAMER_TYPE_RACE_CP (3)
#define STREAMER_TYPE_MAP_ICON (4)
#define STREAMER_TYPE_3D_TEXT_LABEL (5)
#define STREAMER_TYPE_AREA (6)

#define STREAMER_AREA_TYPE_CIRCLE (0)
#define STREAMER_AREA_TYPE_CYLINDER (1)
#define STREAMER_AREA_TYPE_SPHERE (2)
#define STREAMER_AREA_TYPE_RECTANGLE (3)
#define STREAMER_AREA_TYPE_CUBOID (4)
#define STREAMER_AREA_TYPE_POLYGON (5)

#define STREAMER_OBJECT_TYPE_GLOBAL (0)
#define STREAMER_OBJECT_TYPE_PLAYER (1)
#define STREAMER_OBJECT_TYPE_DYNAMIC (2)

enum
{
? ? 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
}

* Nota: Este c?digo est? basado en la actualizaci?n del plugin Streamer, 2015 (v2.7.4).

- Despu?s de hacerlo edite el c?digo del objeto que desea a?adir. En vez de usar "CreateObject" use "CreateDynamicObject".

Ejemplo:

En vez de usar un c?digo normal...

Code:
public OnGameModeInit()
{
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
? ? return 1;
}

Use:

Code:
public OnGameModeInit()
{
? ? CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
? ? return 1;
}

* Nota: Puede editar m?s r?pido el c?digo "CreateObject" usando un bloc de notas (.txt). Pegue el c?digo dentro; y presione "CTRL R", busque "CreateObject" y lo reemplaza por "CreateDynamicObject" (use esto si el mapa es muy grande).

- Despu?s de hacer esto abra el archivo PWN donde quiere a?adir los objetos (usualmente dentro del gamemode) y pegue su c?digo.

Ejemplo:

Code:
public OnGameModeInit()
{
? ? CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
? ? return 1;
}

Informaci?n adicional sobre Streamer.




EMPIECE A PRACTICAR:

Ahora que sabe esto, usted puede practicar editando otros script o puede intentar crear su propio script.

?Una buena forma de empezar es editando otros gamemodes!

Si hay alg?n error en esta gu?a o algo deber?a ser a?adido, simplemente comente.

* Nota: esta es una peque?a gu?a comparada con toda la informaci?n b?sica de SA-MP que un nuevo scripter debe conocer; este tema ser? actualizado de acuerdo a las sugerencias de los usuarios y sus comentarios.




Cr?ditos de esta gu?a: Ygzeb (David Talledo)

Agradecimientos especiales a:

Kwarde que ayud? a actualizar algunos enlaces que estaban rotos (2021) :)

Complemento (2021) .- Es posible que algunos enlaces o im?genes simplemente no funcionen ahora o en el futuro; igualmente, es posible que sean reparados en el futuro o no. Sin embargo, espero que esta gu?a a?n sea de ayuda.


Lightbulb Basic SA-MP & Pawn Guide
Posted by: Ygzeb - 2019-08-02, 08:02 PM - Forum: Tutorials - Replies (8)

BASIC SA-MP? & PAWN GUIDE

[Image: YPOK9Or.png]

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, it explains just basic scripting and how to start.

* Note: this guide is based on the one I made for?SA-MP forum?in the first months of 2015; if you read this later, some elements may have changed or updated.

Based on:

Nicholas tutorial
Kwarde tutorial
Wiki SA-MP

Own knowledge.



INDEX:

STARTING
? ?
Explaining each file (basic 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, X, Y, Z);
TextDrawCreate(X, Y, text[])

Dialog Function (menus & others)

ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
Message box style (sends a message to the player)
Input style (allows players to input text into the dialog)
List style (menu, show the player a list of options)
Password style (allows players to input text into the dialog without revealing it)

CREATING AND REMOVING OBJECTS

Map editor (1 & 2)

Start using it
Creating objects
Removing objects

MTA map editor

Start using it
Delux GTA Map Converter v2

Creating Objects

Streamer installation



START PRACTICING



STARTING:

First we must download the SA-MP Windows Server from SA-MP.com

After doing this we will open the files contained in the download and after 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 (basic ones):

scriptfiles: this folder contains information called inside your script or logs created by your script, usually used as a database.

plugins: this folder contains additional codes that give more options in SA-MP programming, usually programmed in other languages. This guide will not give detailed information about plugins as they are more advanced.

pawno: contains the basic program to start scripting in SA-MP; also has the "include" folder that contains basic includes to start our script (SA-MP basic functions). We can also add our own includes and add them to our script.

npcmodes: this contains information about NPCs (script & rec); this guide will not give detailed information about NPCs as they are more advanced.

include: this contains codes that can be included inside your script.

gamemodes: contains basic gamemodes and we must place our gamemode if we create one.

filterscripts: contains additional codes apart from your gamemode, not included in it and can be called by using rcon commands.

announce.exe: this will allow us to show our server on Masterlist.

samp-npc.exe: this will allow us to use NPCs.

samp-server.exe: we start our server with this.

server.cfg: our server configuration.




CONFIGURATION:

First we must open the file "server.cfg" and edit our server configuration.

After opening it, you will find:

Code:
echo Executing Server Config...
lanmode 0
rcon_password changeme
maxplayers 50
port 7777
hostname SA-MP 0.3 Server
gamemode0 grandlarc 1
filterscripts gl_actions gl_realtime gl_property gl_mapicon ls_mall ls_elevator attachments skinchanger vspawner
announce 0
query 1
chatlogging 0
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]

You can edit your configuration based on this:

Code:
echo Executing Server Config...
lanmode 0?(lan mode on "1" or off "0")
rcon_password changeme?(the rcon password you will use "/Rcon login"; you must edit this)?
maxplayers 50?(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 name of your server)
gamemode0 grandlarc1?(name of the gamemode you will use, you 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; "1" to show it and "0" to hide it)
query 1 (information of the server visible "1", "0" will disable your server information to other players)
chatlogging 0 (save chat logs in server_log.txt "1", not saving it "0")
weburl www.sa-mp.com (website of your server)
onfoot_rate 40 (we will not explain this in this tutorial, advanced)
incar_rate 40 (we will not explain this in this tutorial, advanced)
weapon_rate 40 (we will not explain this in this tutorial, advanced)
stream_distance 300.0 (we will not explain this in this tutorial, advanced)
stream_rate 1000 (we will not explain this in this tutorial, advanced)
maxnpc 0 (number of NPCs that can join your server)
logtimeformat [%H:%M:%S]

You can also read more information about server.cfg?configuration.

Configuration example (this guide is based on this configuration):

Code:
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 1
query 1
chatlogging 1
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]



PAWN SCRIPTING:

After changing our configuration we will start scripting our gamemode.

In this case we will use a basic mode you can download here.

Put it inside 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 have this:

Code:
#include <a_samp>

This is the basic SA-MP include, it will be included in every script you create in SA-MP.

This message will be shown in console when we open our server with samp-server.exe:

Code:
main()
{
print("Blank mode developed by Ygzeb.");
}

The blue text is the message that will be shown.

You can 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 closing braces to start and end the function (all codes).

Example:

Opening braces = Red
Closing braces = Green

main()
{
print("My first mode!");
}


* Note: It is very important to press F5 after editing or creating a script! This will update the AMX file and all changes will be saved ("if there is not mistake", but in special cases may happen programming mistakes that will not figure in the compilation and will affect your server). If everything is okay you will see something like:

[Image: Gobeslv.jpg]

If not there is a mistake and you need to fix it.


Publics:

Publics are basic functions called while your server is running. SA-MP counts with basic publics called in most gamemodes. Most basic public names describe when the public is executed.

Some basic publics are called in special moments, for example while spawning; you can add a function to that moment.

Example; if we want to set players health to 50 when spawning it would be something like:

Code:
public OnPlayerSpawn(playerid)
{
? ?SetPlayerHealth(playerid, 50);
? ?return 1;
}

* Note: we can not use identical publics in the same script; for example two OnPlayerSpawn publics; if we want to add an extra function we must add it inside the same public or inside a filterscript. Base on the last example, we will add a message while spawning:

Code:
public OnPlayerSpawn(playerid)
{
? ?SetPlayerHealth(playerid, 50);
? ?SendClientMessage(playerid, -1, "You spawned!"); // Function added.
? ?return 1;
}

Here are some basic publics that are mostly used by scripters:

public OnGameModeInit() - Called when your mode starts.

Additional information: https://sampwiki.blast.hk/wiki/OnGameModeInit

Basic structure:

Code:
public OnGameModeInit()
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnGameModeInit()
{
? ? UsePlayerPedAnims(); // Allow players to run like CJ.
? ? SetGameModeText("Blank"); // Name of your mode; will be show in SA-MP list.
? ? AddPlayerClass(115, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
? ? AddPlayerClass(122, 1958.3783, 1343.1572, 15.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, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
? ? return 1;
}

AddPlayerClass is a function that adds skin options to class selection; for example if we want to add Sweet's Skin we should add this to our code:

Code:
AddPlayerClass(270, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

The number "270" is the skin ID of Sweet.

public OnGameModeExit() - Called when your mode ends; it is not necessary in all scripts (optional in most cases).

Additional information: https://sampwiki.blast.hk/wiki/OnGameModeExit

Basic structure:

Code:
public OnGameModeExit()
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnGameModeExit()
{
? ? print("Mode ended."); // Message to console (blue text).
? ? return 1;
}

public OnPlayerRequestClass(playerid, classid) - Called when you choose your skin.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerRequestClass

Basic structure:

Code:
public OnPlayerRequestClass(playerid, classid)
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnPlayerRequestClass(playerid, classid)
{
? ? SetPlayerPos(playerid, 2294.2810, 558.2053, 7.7813); // Skin 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:
playerid = ID of the player
0 = angle (in this case north).

? ? north (0)
? ? ? ? ? ?|
(90) west-? ?-east (270)
? ? ? ? ? ?|
? ? ? ? south (180)

More information about SetPlayerFacingAngle.

public OnPlayerConnect(playerid) - Called when a player connects.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerConnect

Basic structure:

Code:
public OnPlayerConnect(playerid)
{
? ? // Code here.
? ? return 1;
}

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 function that plays an audio stream for a player. It's basic structure is:

Code:
playerid = ID of the player
"http://s1.radio.ge/Music/AcDc/1980_Back_In_Black/06_Back_In_Black.mp3" = audio link

* Note: audio links must be in a specific format to be played; for example thislink.

You can find music in many websites. For example in this website.

public OnPlayerSpawn(playerid) - Used after class selection, while spawning. This are the functions that will affect you when spawning.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerSpawn

Basic structure:

Code:
public OnPlayerSpawn(playerid)
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnPlayerSpawn(playerid)
{
? ?SendClientMessage(playerid, -1, "You spawned!"); // Sends a message.
? ?return 1;
}

SendClientMessage is a function that sends a message to the player; it's structure is:

Code:
playerid = ID of the player
-1 = Color, -1 is white
"You spawned!" = message

More information about SendClientMessage.

public OnPlayerDeath(playerid) - Called when you die. This function will affect you when you die.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerDeath

Basic structure:

Code:
public OnPlayerDeath(playerid)
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnPlayerDeath(playerid)
{
? ?GameTextForPlayer(playerid, "Wasted", 5000, 2); // Screen message for player.
? ?return 1;
}

GameTextForPlayer is a function that sends a screen message to the player; it's structure is:

Code:
playerid = ID of the player
"Wasted" = message
5000 = time in milliseconds; in this case 5 seconds
2 = type of message

More information about GameTextForPlayer.

public OnPlayerDisconnect(playerid, reason) - Called when a player disconnects.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerDisconnect

Basic structure:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? // Sending a message to all players that a player disconnected.
? ? new String[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; usually defined as 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(String, sizeof String, "%s left the server.", Name); // Applying a format to our message.
? ? SendClientMessageToAll(-1, String); // Sending the message to all players; String is the format we used for this message.
? ? return 1;
}

public OnPlayerText(playerid) - Called when a player sends a message (chat).

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerText

Basic structure:

Code:
public OnPlayerText(playerid, text[])
{
? ? // Code here.
? ? return 1;
}

Example code:

Code:
public OnPlayerText(playerid, text[])
{
? ? new Name[MAX_PLAYER_NAME], String[175];
? ? GetPlayerName(playerid, Name, 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.
? ? return 0; // Ignoring the default text, ending the function.
}

This function is the format assigned to SendClientMessageToAll. When it is send, it will follow that format:

Code:
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Name, playerid, text);?

Code:
%s and %d are values assigned depending on the player.
%s is a letter value (in this case the player's name and the text).
%d is a numerical value (ID of the player).

Code:
format(String, sizeof(String), "%s [%d]: {FFFFFF}%s", Name, playerid, text);?

Name, playerid & text are the values assigned to %s, %d and %s.

public OnPlayerUpdate(playerid) - Called everytime a client/player updates the server with their status.

Additional information: https://sampwiki.blast.hk/wiki/OnPlayerUpdate

Basic structure:

Code:
public OnPlayerUpdate(playerid)
{
? ? // Code here.
? ? return 1; // If it returns 0 the client will not be updated to others (like paused).
}

Example code:

Code:
public OnPlayerUpdate(playerid)
{
? ? if(GetPlayerWeapon(playerid) == 38) return Kick(playerid); // Kicking the player if he is using minigun.
? ? return 1;
}

"if" is used to determine that if something is happening, the server will execute that function.

It would mean something like:

If he is using minigun, kick him!

* Note: using "if" in OnPlayerUpdate may cause lag, this is just an example.

Using return means that the function ends there, with "Kick(playerid);". If you have other code down 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 not be executed if the player is using a minigun.
? ? return 1;
}


Functions:

Basically, most functions names (native functions) describe what the function does; you can find many of them here.

Some basic functions that might be used in a basic gamemode:

SetPlayerPos(playerid, X, Y, Z); - Sets a player position (X, Y & Z are the place where the player will be moved).

Additional information: https://sampwiki.blast.hk/wiki/SetPlayerPos

Example code:

Code:
SetPlayerPos(playerid, 0.0, 0.0, 3.0); // Changes player's position to a farm.

You can save your current position by using the command /Save inside the game (default command by SA-MP). After using this you must go to "\GTA San Andreas User Files\SAMP" and then open the file "savedpositions.txt". There you 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);

* Note: obviously our values are not red, it is just for the example.

Then paste those values inside your SetPlayerPos function; like this:

Code:
SetPlayerPos(playerid, 700, 700, 5);

You can also use this system that will do it for you.

TextDrawCreate(X, Y, text[]) - Creates a textdraw (X & Y are the coords in the screen and "text" is the text that will be shown).

Additional information: https://sampwiki.blast.hk/wiki/TextDrawCreate

Example of textdraw:

Code:
new Text:Textdraw0;

public OnGameModeInit()
{
? ? 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 you should use the function TextDrawShowForPlayer.

Example of use (based on the last example):

Code:
public OnPlayerConnect(playerid)
{
? ? TextDrawShowForPlayer(playerid, Textdraw0);
}

To hide a textdraw to a player you must use the function TextDrawHideForPlayer.

Example:

Code:
public OnPlayerDisconnect(playerid, reason)
{
? ? TextDrawHideForPlayer(playerid, Textdraw0);
? ? return 1;
}

And to destroy a textdraw you use the function TextDrawDestroy.

Example:

Code:
public OnGameModeInit()
{
? ? TextDrawDestroy(Textdraw0);
? ? return 1;
}


Dialog Function (menus & others):

ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]); - Shows the player a dialog box.

Additional information: https://sampwiki.blast.hk/wiki/ShowPlayerDialog

* Note: Every dialog needs a unique "dialogid"; unless you do not use that ID inside the public OnDialogResponse (filterscripts and include dialogs must also use a unique dialogid).

There are 4 types of dialog:

Message box style (sends a message to the player):

[Image: Dialog_style_msgbox.png]

Example code (with cancel button):

Code:
if(!strcmp(cmdtext, "/Help", true))
{
? ? new Menu[202]; // This is the number of characters you are using inside your dialog (all characters).
? ? Menu[0]='\0'; // Variable of the dialog, defined before.
? ? strcat(Menu, "This is the text that will be shown inside your dialog. You can add another\n", 77); // 77 is the number of characters in this line.
? ? strcat(Menu, "line using the symbol shown in the upper line (n). 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, "Accept", "Cancel");
? ? return 1;
}

Every lines has characters; the first line has 77 characters, so we put 77 at the end.

In the second line we have to count the characters in that line plus the characters in all the lines before that line. In this case is 153; so we put 153 at the end.

Example code (without cancel button):

Code:
if(!strcmp(cmdtext, "/Help", true))
{
? ? new Menu[202];
? ? Menu[0]='\0';
? ? strcat(Menu, "This is the text that will be shown inside your dialog. You can add another\n", 77); // strcat? concatenates (joins together) our Menu string and our text.
? ? strcat(Menu, "line using the symbol shown in the upper line (n). You do not need to add\n", 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 leave the second botton just with "".
? ? return 1;
}

The function "strcat"? concatenates (joins together) our Menu string and our text.

* Note: You can use special websites to count characters.

When counting characters you just count the characters inside the ""; for example:

Code:
if(!strcmp(cmdtext, "/Help", true))
{
? ? new Menu[202];
? ? Menu[0]='\0';
? ? strcat(Menu, "This is the text that will be shown inside your dialog. You can add another\n", 77);
? ? strcat(Menu, "line using the symbol shown in the upper line (n). You do not need to add\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", "");
? ? return 1;
}

The \n character also counts.

We can also add a function when we press "Accept" or "Cancel" inside the public OnDialogResponse.

For example:

Code:
if(!strcmp(cmdtext, "/Help", true))
{
? ? new Menu[202];
? ? Menu[0]='\0';
? ? strcat(Menu, "This is the text that will be shown inside your dialog. You can add another\n", 77);
? ? strcat(Menu, "line using the symbol shown in the upper line (n). You do not need to add\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", "");
? ? return 1;
}

We add a message function inside the public OnDialogResponse:

Code:
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 # 1!
? ? }
return 1; // Closing the public.
}

* Note: When using OnDialogResponse every dialog needs a number. In this case we used number 1:

Code:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog Help", Menu, "Accept", "");
? ? return 1;
}

Input style (allows players to input text into the dialog):

[Image: Dialog_style_input.png]

Example code:

Code:
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Text", "Write a text for all players!", "Accept", "Cancel");

After creating our code we must create a function to that code; so we will 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 String[200], Name[MAX_PLAYER_NAME]; // Defining variables.
? ? ? ? ? ? GetPlayerName(playerid, Name, MAX_PLAYER_NAME); // Getting player's name.
? ? ? ? ? ? format(String, sizeof(String), "[<!>] Announce from %s: %s", Name, inputtext); // Using a format for the message.
? ? ? ? ? ? SendClientMessageToAll(-1, String);
? ? ? ? }
? ? return 1; // Closing dialog response from dialog # 2!
? ? }
return 1; // Closing the public.
}

List style (menu, show the player a list of options):

[Image: Dialog_style_list.png]

Example code (creating a weapon menu):

Code:
if(!strcmp(cmdtext, "/Weapon", true))
{
? ? ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Weapons", "Desert Eagle\n AK-47\n Combat Shotgun", "Select", "Close");
? ? return 1;
}

Code:
"Weapons" = Title of the list.
"Desert Eagle\n AK-47\n Combat Shotgun" = List.
"Select" = Choose a weapon.
"Close" = Close the list.

The \n symbol is used to separate the elements of the list.

To give the weapon we 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 list all the items; each case is a item from our dialog.
? ? ? ? ? ? {
? ? ? ? ? ? ? ? case 0:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 24, 14); // Give them a desert eagle with 14 bullets.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 30, 120); // Give them an AK-47 with 120 bullets.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? GivePlayerWeapon(playerid, 27, 28); // Give them a Combat Shotgun with 28 bullets.
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? return 1; // Ending the dialog #3.
? ? }
? ? return 1;
}

Structure of the function GivePlayerWeapon:

Code:
GivePlayerWeapon(playerid, weaponid, ammo);

Additional information about this function: https://sampwiki.blast.hk/wiki/GivePlayerWeapon

Password style (allows players to input text into the dialog without revealing it):

[Image: Dialog_style_password.png]

It has the same structure of "Input style"; mostly used in account systems (it is a bit advanced for this tutorial).

If you want to create an account system you can read this tutorials:

Kush account system 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 most 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 structure; so this is an explanation for both.

Start using it:

- After dowloading it, you must open the file "editor.exe" and press the button "LOAD".

- It will load the game map (GTA-SA); you can move your camera by moving your mouse while clicking the right mouse button. You can move around the map with the mouse scroll or with the keys "W, A, S & D" while pressing the right mouse button.

Creating objects:

- Move to the place where you want to add your mapping, then press the button "Objects" inside the menu (the menu on the right of the window).

- Press "Add" 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 move the object by using the "Movement" panel.

- After mapping you can get the code and add it to your GM by pressing "Show Code". Copy the code and paste it inside the public OnGameModeInit.

Example code:

Code:
public OnGameModeInit()
{
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object will render at it's default distance.
? ? return 1;
}

Additional information: https://sampwiki.blast.hk/wiki/CreateObject

Removing objects:

- Move around the map and search the object you want to delete.

- Click on it and press "Supr".

- After deleting the object press "Show Code". Paste the code inside the public OnPlayerConnect.

Example code:

Code:
public OnPlayerConnect(playerid)
{
? ? RemoveBuildingForPlayer(playerid, 3782, 1803.0859, -1294.2031, 34.3438, 0.25);
? ? return 1;
}

Additional information: https://sampwiki.blast.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 but not to delete them from the original map.

Start using it:

- After downloading it, open the file MTA.exe

- Click on the map editor.

- To move around the map use the camera and the keys "W, A, S & D".

- To create objects press "F" and click on the cube object (in the bottom):

[Image: uwz65v3.jpg]

- Search or select your object and place it on the map.

* Note: You can move it down and up by clicking on the object and using the keys "Page Down (pg dn)" and "Page Up (pg up)". To rotate it use "Shift Scroll". To change it's angle use "CTRL Page Down/Page Up" or "CTRL Arrow keys".

- To save your map press the save button:

[Image: bROE6FQ.jpg]

- To get the object code you can use a MTA converter:

Delux GTA Map Converter v2 (2015)

Delux GTA Map Converter v2:

- Instead of IPL file format choose PAWN Code for SA-MP. Search your map inside your MTA folder; it is usually inside \mods\deathmatch\resources.

- Copy your code.


Creating Objects:

After having the code of the object(s), you must add it inside the public OnGameModeInit or OnFilterScriptInit.

Example code:

Code:
public OnGameModeInit()
{
? ? CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object will 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;
}

But SA-MP has an object limit of 1000 objects. If you want to optimize your script or you want to add more objects you should use the plugin Streamer.

Streamer installation:

- Dowload it from the streamer plugin thread.

- After downloading it, paste the file "streamer.so" or "streamer.dll" inside the plugins folder (or just paste the plugins folder, the download one, inside your server folder).

- Copy the include "streamer.inc" inside your pawno includes folder.

- Edit the file "server.cfg" inside your server folder and add this line if you are using Windows:

Code:
plugins streamer.dll

If you are using Linux add:

Code:
plugins streamer.so

- Copy this code down all the includes (include example: #include <a_samp>), inside every script that uses streamer:

Code:
#include <streamer>

#define STREAMER_TYPE_OBJECT (0)
#define STREAMER_TYPE_PICKUP (1)
#define STREAMER_TYPE_CP (2)
#define STREAMER_TYPE_RACE_CP (3)
#define STREAMER_TYPE_MAP_ICON (4)
#define STREAMER_TYPE_3D_TEXT_LABEL (5)
#define STREAMER_TYPE_AREA (6)

#define STREAMER_AREA_TYPE_CIRCLE (0)
#define STREAMER_AREA_TYPE_CYLINDER (1)
#define STREAMER_AREA_TYPE_SPHERE (2)
#define STREAMER_AREA_TYPE_RECTANGLE (3)
#define STREAMER_AREA_TYPE_CUBOID (4)
#define STREAMER_AREA_TYPE_POLYGON (5)

#define STREAMER_OBJECT_TYPE_GLOBAL (0)
#define STREAMER_OBJECT_TYPE_PLAYER (1)
#define STREAMER_OBJECT_TYPE_DYNAMIC (2)

enum
{
? ? 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.7.4).

- After doing this edit the object code you have. Instead of using "CreateObject" use "CreateDynamicObject".

Example:

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;
}

Use this:

Code:
public OnGameModeInit()
{
? ? CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
? ? return 1;
}

* Note: You can edit your "CreateObject" code faster by using a ".txt" file. Paste the code inside of it; press "CTRL R", search "CreateObject" and replace it with "CreateDynamicObject" (use this if your map is very big).

- After doing this open the PWN file where you want to add the objects (usually inside the gamemode) and paste your code.

Example code:

Code:
public OnGameModeInit()
{
? ? CreateDynamicObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);
? ? return 1;
}

Additional information about Streamer plugin.




START PRACTICING:

Now you know this, you can practice by editing other scripts or you can try creating your own script.

A good way of starting is editing other gamemodes!

If there is any mistake in this guide or something should be added, just post it.

* Note: this is an small guide compared to all the basic information of SA-MP that a new scripter should know; this guide will be updated according to post suggestions on this thread.




Guide credits: Ygzeb (David Talledo)

Special thanks 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 now or in the future, they may be fixed or not. However, I hope this guide will still help people.


  MySQL pool size
Posted by: Expert* - 2019-08-02, 02:13 PM - Forum: Pawn Scripting - No Replies

Hi.

I have 4 connections to separate databases. What pool size could i set on?each of them if i have 4c 8t server dedicated to samp ??(?i'm not sure if server specs matters?)


Wink O'zbek tili | Uzbek language | Узбекский язык
Posted by: TamerlanJust - 2019-07-31, 06:15 PM - Forum: Other - Replies (3)

Hamma Turkiy xalqlarga va 15ta eski SSSR respublikalarga salom!!!


  Issues with the gamemode, no errors
Posted by: unix - 2019-07-31, 11:56 AM - Forum: Pawn Scripting - Replies (2)

Having an issue with the gamemode.



It runs for 10 - 12 hours and out of sudden it stops sending/receiving any data - shows that it is still online but players cannot connect it will just say connecting and later on will close the connection.



Could it be from DDoS attacks or from streamer_tickrate?



The compiled (.amx) gamemode is around 3.1MB I don't think it is eating too much ram or whatsoever.



Crashdetect does not show any error.


  Server crash OnPlayerConnect
Posted by: Sauron - 2019-07-25, 01:45 PM - Forum: Support - Replies (2)

Hello everyone!

I compiled the Col-Andreas Plugin yesterday. I needed to install some packages as cmake gave me an error. I used the readme.md file of ColAndreas to fix the missing packages. Before that, I did apt-get update. I guess it caused my problems now.


I use Debian Stretch as OS. I also got the crashdetect log and the term.log & the history.log of apt, dpkg.log. If you're able to help me, I would really appreciate it! I also have another question: Is there anywhere a good tutorial about crashdetect?

Maybe I only need to update a plugin. I'm not sure about that. If the server has a password, then it works but if not, then the server crashs OnPlayerConnect.

EDIT: It's not the script. I tried the default samp server files. The same problem happened!

Logs:

Code:
//history.log
Start-Date: 2019-07-25 ?03:06:08
Commandline: apt-get install libbulletcollision2.82:i386 libbulletdynamics2.82:i386 liblinearmath2.82:i386 libbulletsoftbody2.82:i386
Install: libbulletsoftbody2.82:i386 (2.82-r2704痻2), libc6:i386 (2.24-11痦ﶻ, automatic), gcc-6-base:i386 (6.3.0-18痦ﶻ, automatic), libbulletdynamics2.82:i386 (2.82-r2704痻2), libgcc1:i386 (1:6.3.0-18痦ﶻ, automatic), $
End-Date: 2019-07-25 ?03:06:09

//term.log
Log started: 2019-07-25 ?03:06:08
Vormals nicht ausgew?hltes Paket gcc-6-base:i386 wird gew?hlt.
(Lese Datenbank ... ^M(Lese Datenbank ... 5%^M(Lese Datenbank ... 10%^M(Lese Datenbank ... 15%^M(Lese Datenbank ... 20%^M(Lese Datenbank ... 25%^M(Lese Datenbank ... 30%^M(Lese Datenbank ... 35%^M(Lese Datenbank ... 40%^M(Lese Datenbank$
Vorbereitung zum Entpacken von .../0-gcc-6-base_6.3.0-18痦ﶻ_i386.deb ...
Entpacken von gcc-6-base:i386 (6.3.0-18痦ﶻ) ...
Vormals nicht ausgew?hltes Paket libgcc1:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../1-libgcc1_1%3a6.3.0-18痦ﶻ_i386.deb ...
Entpacken von libgcc1:i386 (1:6.3.0-18痦ﶻ) ...
Vormals nicht ausgew?hltes Paket libc6:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../2-libc6_2.24-11痦ﶻ_i386.deb ...
Entpacken von libc6:i386 (2.24-11痦ﶻ) ...
Ersetzen der Dateien im alten Paket libc6-i386 (2.24-11痦ﶻ) ...
Vormals nicht ausgew?hltes Paket libstdc:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../3-libstdc_6.3.0-18痦ﶻ_i386.deb ...
Entpacken von libstdc:i386 (6.3.0-18痦ﶻ) ...
Vormals nicht ausgew?hltes Paket liblinearmath2.82:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../4-liblinearmath2.82_2.82-r2704痻2_i386.deb ...
Entpacken von liblinearmath2.82:i386 (2.82-r2704痻2) ...
Vormals nicht ausgew?hltes Paket libbulletcollision2.82:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../5-libbulletcollision2.82_2.82-r2704痻2_i386.deb ...
Entpacken von libbulletcollision2.82:i386 (2.82-r2704痻2) ...
Vormals nicht ausgew?hltes Paket libbulletdynamics2.82:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../6-libbulletdynamics2.82_2.82-r2704痻2_i386.deb ...
Entpacken von libbulletdynamics2.82:i386 (2.82-r2704痻2) ...
Vormals nicht ausgew?hltes Paket libbulletsoftbody2.82:i386 wird gew?hlt.
Vorbereitung zum Entpacken von .../7-libbulletsoftbody2.82_2.82-r2704痻2_i386.deb ...
Entpacken von libbulletsoftbody2.82:i386 (2.82-r2704痻2) ...
gcc-6-base:i386 (6.3.0-18痦ﶻ) wird eingerichtet ...
Trigger f?r libc-bin (2.24-11痦ﶻ) werden verarbeitet ...
libc6:i386 (2.24-11痦ﶻ) wird eingerichtet ...
libgcc1:i386 (1:6.3.0-18痦ﶻ) wird eingerichtet ...

//SERVER-lOG
[13:05:15] [connection] 41.104.51.197:24247 requests connection cookie. -> Crash directly!

[13:05:16] [debug] Server crashed due to an unknown error
[13:05:16] [debug] Native backtrace:
[13:05:16] [debug] #0 f73288b6 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () in plugins/crashdetect.so
[13:05:16] [debug] #1 f7320120 in _ZN18CrashDetectHandler20PrintNativeBacktraceERSoRKN2os7ContextE () in plugins/crashdetect.so
[13:05:16] [debug] #2 f7320886 in _ZN18CrashDetectHandler20PrintNativeBacktraceERKN2os7ContextE () in plugins/crashdetect.so
[13:05:16] [debug] #3 f7320f96 in _ZN18CrashDetectHandler7OnCrashERKN2os7ContextE () in plugins/crashdetect.so
[13:05:16] [debug] #4 f7327f82 in ?? () in plugins/crashdetect.so
[13:05:16] [debug] #5 f772acb0 in __kernel_rt_sigreturn () in linux-gate.so.1
[13:05:16] [debug] #6 097d5ffe in ?? ()
[13:05:16] [debug] #7 080aef02 in ?? () in ./samp03svr
[13:05:16] [debug] #8 080aa13a in ?? () in ./samp03svr
[13:05:16] [debug] #9 f7368286 in __libc_start_main () in /lib/i386-linux-gnu/libc.so.6
[13:05:16] [debug] Registers:
[13:05:16] [debug] EAX: 000000ff EBX: f6521000 ECX: f2e00ff8 EDX: f2e0100d
[13:05:16] [debug] ESI: f2e00ff8 EDI: 08159cf3 EBP: ff8283e8 ESP: ff828388
[13:05:16] [debug] EIP: 097d5ffe EFLAGS: 00010292
[13:05:16] [debug] Stack:
[13:05:16] [debug] ESP퍍㓓䴴: ff8283e8 f65194d8 f2e00ff8 00083e38
[13:05:16] [debug] ESP퍍㓓䶴: f772aadb 097daf00 08159b76 08159cf3
[13:05:16] [debug] ESP퍍㓓临: ff8283e8 080aed4f f2e00ff8 097daf00
[13:05:16] [debug] ESP퍍㓓亴: ff828418 080aef02 097daf00 00000000
[13:05:16] [debug] ESP퍍㓓伴: 00000000 004c4b40 097ceb78 000493e3
[13:05:16] [debug] ESP퍍㓓䚴: 00000006 08159d0d 00000000 00000000
[13:05:16] [debug] ESP퍍㓓䜴: f76f1000 f76587e3 f76f2570 f77415f0
[13:05:16] [debug] ESP퍍㓓䞴: 00000096 0165893b 656d6167 65646f6d
[13:05:16] [debug] ESP퍍㓓崴: f76f25a0 f75fe429 f76f2504 f76f21a0
[13:05:16] [debug] ESP퍍㓓嶴: f7504e00 081a1980 080aa260 00000000
[13:05:16] [debug] ESP퍍㓓帴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓庴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓弴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓嚴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓圴: 0815065b 00000000 00000001 f7504000
[13:05:16] [debug] ESP퍍㓓垴: ff8285fc 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓洴: 00000001 f7504000 00000000 7fcf12ab
[13:05:16] [debug] ESP퍍㓓涴: 00000001 0804b4c0 00000000 f77415f0
[13:05:16] [debug] ESP퍍㓓渴: 00000000 0804b4e1 080a9420 00000001
[13:05:16] [debug] ESP퍍㓓溴: ff8285ec f7750920 00000001 ff8288a5
[13:05:16] [debug] ESP퍍㓓漴: ff828eb0 ff828ec3 ff828ecc ff828ee8
[13:05:16] [debug] ESP퍍㓓暴: ff828f49 ff828f59 ff828f61 ff828f6d
[13:05:16] [debug] ESP퍍㓓朴: 00000020 f772ac80 00000021 f772a000
[13:05:16] [debug] ESP퍍㓓枴: 00000011 00000064 00000003 08048034
[13:05:16] [debug] ESP퍍㓓紴: 00000007 f772c000 00000008 00000000
[13:05:16] [debug] ESP퍍㓓綴: 0000000c 000003e8 0000000d 000003eb
[13:05:16] [debug] ESP퍍㓓縴: 00000019 ff8286eb 0000001f ff828fec
[13:05:16] [debug] ESP퍍㓓纴: ff000000 e952a5da b5aa3d62 347fca39
[13:05:16] [debug] ESP퍍㓓缴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓皴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓眴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] ESP퍍㓓瞴: 00000000 00000000 00000000 00000000
[13:05:16] [debug] Loaded modules:
[13:05:16] [debug] 00000000 - 00187dc3 samp03svr
[13:05:16] [debug] f772a000 - f772ae2e linux-gate.so.1
[13:05:16] [debug] f7712000 - f77149c4 /lib/i386-linux-gnu/libdl.so.2
[13:05:16] [debug] f76f5000 - f771075b /lib/i386-linux-gnu/libpthread.so.0
[13:05:16] [debug] f757b000 - f76febbf /usr/lib/i386-linux-gnu/libstdc.so.6
[13:05:16] [debug] f7526000 - f757a120 /lib/i386-linux-gnu/libm.so.6
[13:05:16] [debug] f7508000 - f7524354 /lib/i386-linux-gnu/libgcc_s.so.1
[13:05:16] [debug] f7350000 - f750e73b /lib/i386-linux-gnu/libc.so.6
[13:05:16] [debug] f772c000 - f775006c /lib/ld-linux.so.2
[13:05:16] [debug] f7309000 - f734d3ac plugins/crashdetect.so
[13:05:16] [debug] f6f65000 - f730dac7 plugins/mysql_static.so
[13:05:16] [debug] f6f5c000 - f6f6347c /lib/i386-linux-gnu/librt.so.1
[13:05:16] [debug] f6549000 - f655a0d0 /lib/i386-linux-gnu/libnss_files.so.2
[13:05:16] [debug] f6143000 - f620139a plugins/streamer.so
[13:05:16] [debug] f6539000 - f65481d4 plugins/sscanf.so
[13:05:16] [debug] f6514000 - f6536fc5 plugins/SKY.so
[13:05:16] [debug] f5fda000 - f614ba60 plugins/pawnregex.so

//dpkg.log
2019-07-25 03:06:08 startup archives unpack
2019-07-25 03:06:08 install gcc-6-base:i386 <keine> 6.3.0-18痦ﶻ
2019-07-25 03:06:08 status half-installed gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:08 status unpacked gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:08 status unpacked gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:08 install libgcc1:i386 <keine> 1:6.3.0-18痦ﶻ
2019-07-25 03:06:08 status triggers-pending libc-bin:amd64 2.24-11痦ﶻ
2019-07-25 03:06:08 status half-installed libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:08 status unpacked libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:08 status unpacked libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:08 install libc6:i386 <keine> 2.24-11痦ﶻ
2019-07-25 03:06:08 status half-installed libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:08 status unpacked libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:08 status unpacked libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:09 install libstdc:i386 <keine> 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status half-installed libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status unpacked libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status unpacked libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 install liblinearmath2.82:i386 <keine> 2.82-r2704痻2
2019-07-25 03:06:09 status half-installed liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 install libbulletcollision2.82:i386 <keine> 2.82-r2704痻2
2019-07-25 03:06:09 status half-installed libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 install libbulletdynamics2.82:i386 <keine> 2.82-r2704痻2
2019-07-25 03:06:09 status half-installed libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 install libbulletsoftbody2.82:i386 <keine> 2.82-r2704痻2
2019-07-25 03:06:09 status half-installed libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status unpacked libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 startup packages configure
2019-07-25 03:06:09 configure gcc-6-base:i386 6.3.0-18痦ﶻ <keine>
2019-07-25 03:06:09 status unpacked gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status half-configured gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status installed gcc-6-base:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 trigproc libc-bin:amd64 2.24-11痦ﶻ <keine>
2019-07-25 03:06:09 status half-configured libc-bin:amd64 2.24-11痦ﶻ
2019-07-25 03:06:09 status installed libc-bin:amd64 2.24-11痦ﶻ
2019-07-25 03:06:09 configure libc6:i386 2.24-11痦ﶻ <keine>
2019-07-25 03:06:09 status triggers-pending libc-bin:amd64 2.24-11痦ﶻ
2019-07-25 03:06:09 status unpacked libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:09 status unpacked libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:09 status half-configured libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:09 status installed libc6:i386 2.24-11痦ﶻ
2019-07-25 03:06:09 configure libgcc1:i386 1:6.3.0-18痦ﶻ <keine>
2019-07-25 03:06:09 status unpacked libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:09 status half-configured libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:09 status installed libgcc1:i386 1:6.3.0-18痦ﶻ
2019-07-25 03:06:09 configure libstdc:i386 6.3.0-18痦ﶻ <keine>
2019-07-25 03:06:09 status unpacked libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status half-configured libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 status installed libstdc:i386 6.3.0-18痦ﶻ
2019-07-25 03:06:09 configure liblinearmath2.82:i386 2.82-r2704痻2 <keine>
2019-07-25 03:06:09 status unpacked liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status half-configured liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status installed liblinearmath2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 configure libbulletcollision2.82:i386 2.82-r2704痻2 <keine>
2019-07-25 03:06:09 status unpacked libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status half-configured libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status installed libbulletcollision2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 configure libbulletdynamics2.82:i386 2.82-r2704痻2 <keine>
2019-07-25 03:06:09 status unpacked libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status half-configured libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status installed libbulletdynamics2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 configure libbulletsoftbody2.82:i386 2.82-r2704痻2 <keine>
2019-07-25 03:06:09 status unpacked libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status half-configured libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 status installed libbulletsoftbody2.82:i386 2.82-r2704痻2
2019-07-25 03:06:09 trigproc libc-bin:amd64 2.24-11痦ﶻ <keine>
2019-07-25 03:06:09 status half-configured libc-bin:amd64 2.24-11痦ﶻ
2019-07-25 03:06:09 status installed libc-bin:amd64 2.24-11痦ﶻ


  Question about enumerators
Posted by: mouiz - 2019-07-25, 08:42 AM - Forum: Pawn Scripting - No Replies

EDIT: nvm, found the answer.


  [Showcase/Mapp] Mental hospital
Posted by: Apex - 2019-07-25, 07:42 AM - Forum: Videos and Screenshots - Replies (2)

My account on discord was Concorde#0687, this is a experiment mapp, it not have a server, just go to my library.



[Image: sa-mp-000.png]

[Image: sa-mp-001bd8d7b66d44a8388.png]

[Image: sa-mp-002.png]

[Image: sa-mp-003.png]

[Image: sa-mp-004.png]

[Image: sa-mp-005.png]

[Image: sa-mp-006.png]

[Image: sa-mp-007d44e5e1618fa26a3.png]

[Image: sa-mp-008.png]



I plan to follow it to the end with its maintenance cells, etc.


  y_hooks - multi level hooking problem
Posted by: Luciano - 2019-07-24, 09:02 PM - Forum: Pawn Scripting - Replies (2)

I have the following files:



Code:
====== gamemodes/mymode.pwn?======

#include <a_samp>

#include <YSI_Coding\y_hooks>

#include .\src\first.pwn



public OnGameModeInit()

{

? ??printf("mymode.pwn");

}





======?gamemodes/src/first.pwn?======

#include <YSI_Coding\y_hooks>

#include .\src\second.pwn



hook OnGameModeInit()

{

? ? printf("first.pwn");

}







======?gamemodes/src/second.pwn?======

#include <YSI_Coding\y_hooks>



hook OnGameModeInit()

{

? ? printf("second.pwn");

}





I'm getting this error:?
Code:
.\first.pwn(6) : error 021: symbol already defined: "@yH_OnGameModeInit@002"



Is it possible to use hooks like this and if yes, what is my mistake?


Big Grin Swedish
Posted by: fusez - 2019-07-23, 10:48 PM - Forum: Other - Replies (1)

[Image: xzzqrao.jpg]





This is the official Swedish thread



Say hej!