Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 794 online users. » 0 Member(s) | 791 Guest(s) Bing, Applebot, Google
|
Latest Threads |
Adding new vehicles and s...
Forum: Programming
Last Post: __.A.__
Yesterday, 07:47 PM
» Replies: 0
» Views: 47
|
Zona América del Sur Free...
Forum: Advertisements
Last Post: kevinberriosflores
Yesterday, 02:16 PM
» Replies: 1
» Views: 69
|
Busco copia de gamemode S...
Forum: Spanish/Espa?ol
Last Post: briancristaldo2021
2025-09-11, 11:14 AM
» Replies: 0
» Views: 58
|
[Tutorial] Registrando o ...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-09-09, 08:36 PM
» Replies: 0
» Views: 202
|
San Andreas Police Pursui...
Forum: Advertisements
Last Post: BriBri
2025-09-08, 10:09 PM
» Replies: 1
» Views: 292
|
Problem with plugins load...
Forum: Support
Last Post: MrKacu13
2025-09-08, 07:15 PM
» Replies: 9
» Views: 346
|
Compilation error
Forum: Pawn Scripting
Last Post: MrKacu13
2025-09-07, 07:18 AM
» Replies: 6
» Views: 346
|
Need help, problem when i...
Forum: Programming
Last Post: nonickowned
2025-09-06, 06:21 PM
» Replies: 0
» Views: 144
|
Transfer server from SAMP...
Forum: Support
Last Post: MrKacu13
2025-09-06, 04:03 PM
» Replies: 1
» Views: 235
|
Not relevant anymore
Forum: Questions and Suggestions
Last Post: peti
2025-09-05, 02:00 PM
» Replies: 0
» Views: 193
|
|
|
sudo command |
Posted by: Nao - 2019-08-14, 01:59 AM - Forum: Filterscripts
- Replies (1)
|
 |
It just an simple filterscript that can execute any command to target and pretending that he use that command (like minecraft)
But you must careful about what are you want to execute the command or else you'll get caught XD
PHP Code: #define FILTERSCRIPT
// forwards
forward start_sudo(playerid, targetid, const args[]);
// basic include
#include <a_samp>
#include <sscanf2>
#include <izcmd>
// defines
#define printmsg(%0) SendClientMessage(playerid,-1,%0)
#define printmsgEx(%0,%1) SendClientMessage(%1,-1,%0)
// our public stuff
public OnFilterScriptInit()
{
? ?print("sudo command by 0x1E4");
? ?print("USAGE: /sudo [your target] [argument]");
? ?return 1;
}
public OnFilterScriptExit()
{
? ?print("sudo command unloaded, byee");
? ?return 1;
}
// and this is my sudo core!
public start_sudo(playerid, targetid, const args[])
{
? ?// checking is string is empty and return 0, because if empty string got executed on CallRemoteFunction it crashes the server.
? ?if (!args[0])
? ?{
? ? ? ?print("[SUDO ERROR]: string is empty!");
? ? ? ?return 0;
? ?}
? ?// declarate our variable.
? ?new command[12], idx, index;
? ?// extract our sudo command so the script know what to execute.
? ?format(command, sizeof(command), "%s", ReturnCommand(playerid, args));
? ?format(command, sizeof(command), "cmd_%s", command[1]);
? ?// putting all intreger stuff into index and idx, because i want to increment the value and checking if my remote function is returning 0.
? ?index = GetPVarInt(playerid, "extracted_cmd");
? ?idx = CallRemoteFunction(command, "is", targetid, args[﨩�]);
? ?// then delete the "extracted_cmd" because we don't need it anymore. Oh by the way you may notice why i should
? ?// use DeletePVar instead setting them to 0 right ?, Yeah because instead recreating the "player variable" again i will chose to set them to 0
? ?// so i can use it later.
? ?SetPVarInt(playerid, "extracted_cmd", 0);
? ?// checking if my remote function is returning 0, and user will not confused wtf is going on.
? ?if (!idx)
? ?{
? ? ? ?print("[SUDO ERROR]: are you sure, you are using zcmd command?! or the command is invalid");
? ? ? ?printmsg("Your command failed to execute, please see server log for more details.");
? ? ? ?return 0;
? ?}
? ?// and if my remote function isn't returning 0, let user know.
? ?printmsg("Successfully running the command!");
? ?return 1;
}
// why you use "stock" function instead just make them like this :P
// and also i don't wanna abuse the "stock" function like vince said.
ReturnCommand(playerid, const string[])
{
? ?// declarate our variable
? ?new extracted[24], index;
? ?// find the space and put them on index variable.
? ?index = strfind(string, " ", true);
? ?// set to player variable (this is why ReturnCommand seems awkward with using playerid)
? ?// and extract the string using strmid with index value that i got from strfind.
? ?SetPVarInt(playerid, "extracted_cmd", index);
? ?strmid(extracted, string, 0, index);
? ?// return the string. ?
? ?return extracted;
}
// this is normal command.
CMD:sudo(playerid, const sudo_thing[])
{
? ?if(IsPlayerAdmin(playerid))
? ? ? ?return printmsg("You are not RCON administrator.");
? ?new urtarget = INVALID_PLAYER_ID, argument[128];
? ?if (sscanf(sudo_thing, "us[128]", urtarget, argument))
? ? ? ?return printmsg("/sudo [your target] [argument]");
? ?if (!IsPlayerConnected(urtarget) || urtarget == INVALID_PLAYER_ID)
? ? ? ?return printmsg("Invalid target parameter.");
? ?if (urtarget == playerid)
? ? ? ?return printmsg("you cannot sudoing yourself."); ? ?
? ?printmsg("trying to executing command!"); ? ?
? ?start_sudo(playerid, urtarget, argument);
? ?return 1;
}
|
|
|
Ol?! |
Posted by: Hamon - 2019-08-11, 06:25 PM - Forum: Portuguese/Portugu?s
- No Replies
|
 |
Ol?, meu nome ? Hamon, e estou a procura de um desenvolvedor que tenha interesse em um projeto relacionado a Roleplay! Caso tenha interesse para mais informa??es me procure por MP!
|
|
|
ChatBreaker include - Updated to v1.3. |
Posted by: Logan - 2019-08-09, 12:46 PM - Forum: Libraries
- Replies (8)
|
 |
Greetings dear Burgershot members.
Intro
I made this simple, yet effective?include a few months ago for server I was scripting, so since it's very simple to implement and since you don't have to touch your code to break your SendClientMessage/SendClientMessageToAll chat lines in two lines, I decided to share it with you. I hope you like it!
How to install it/implement it?
It depends if you're using modular/non-modular style of coding on your gamemode. If you're using modular, just #include it into your main gamemode file. Else, just paste it somewhere on top of your script where you defined public functions/stocks/etc.?
How it works/what does it do?
Very simple. It breaks strings passed into SCM/SCMToAll longer than 100 chars. You can find out the rest by looking at the code. "Uniqueness" of it is that it never breaks string in the middle of the word, always before/after, or as you can say it, space is the signal for breaking.
Download:
Updates:
08/2020 - v1.1. - Added support for breaking/passing embedded colors in next chat line/row.
03/2021 - v1.3 - Reduced memory consumption and implemented y_va.?Now on github & supported as a sampctl package, repository created.
Best regards, Logan.
|
|
|
Function "Player Collisions" |
Posted by: PANZEHIR - 2019-08-05, 11:44 PM - Forum: Questions and Suggestions
- Replies (2)
|
 |
Hello,
I dont know if this was suggested, did not find any thread, so im going to suggest it. How about add special function called "Player Collisions"? this is like the "Vehicle Collisions" which got added in 2015. With the "Player Collisions" function you will not be stuck at stairs/doors while playing certain minigames, also you will be able to walk?through players... but shoots from weapons will take damage still.
|
|
|
Adjusted skins list for open.mp |
Posted by: Caledonite - 2019-08-05, 05:30 PM - Forum: Questions and Suggestions
- Replies (1)
|
 |
Hi!
I thought it was a little bit absurd that SA-MP doesn't contain some skins that are present in the gta3.img files and?most of "special" skins have only one and same movement?animation, so I thought if it was customized a little bit, then it might be better opinion as well.
I went ahead and made a list of those skins, which seems to be more reliable and better use for everyone. It is totally up to the developers of open.mp, if they wish to stick to SA-MP's own skin list or take inspiration (or rather use this) from the custom one.
https://pastebin.com/U3tw80Q6
|
|
|
invalid connection handle |
Posted by: IdontMIss - 2019-08-04, 06:58 PM - Forum: Pawn Scripting
- Replies (2)
|
 |
I started scripting a fresh new TDM script from 0 and I wanted to try out the bcyrpt hashing alg and everything went fine I created a register/login system but when I wanted to test it next things happend:
myScript:
Code: public OnPlayerConnect(playerid) {
?? ?new query[256];
?? ?mysql_format(SQL, query, sizeof query, "SELECT * FROM `players` WHERE `name`='%e' LIMIT 1", GetPlayerNameEx(playerid)); // 9
??? mysql_pquery(SQL, query, "OnAccountCheck", "i", playerid); // 10
??? #if defined reg_OnPlayerConnect
??????? return reg_OnPlayerConnect(playerid);
??? #else
??????? return true;
??? #endif
}
#if defined _ALS_OnPlayerConnect
??? #undef OnPlayerConnect
#else
??? #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect reg_OnPlayerConnect
#if defined reg_OnPlayerConnect
??? forward reg_OnPlayerConnect(playerid);
#endif
The errors I get in mysql
Code: [INFO] changed log level from 'warning, error' to 'debug, info, warning, error'
[DEBUG] CThreadedConnection::WorkerFunc(this=0x41ea020, connection=0x41ea020)
[DEBUG] mysql_format(111, 0x0307AF98, 256, "SELECT * FROM `players` WHERE `name` = '%e'") (modules/register.pwn:10)
[ERROR] mysql_format: invalid connection handle '111' (modules/register.pwn:10)
[DEBUG] mysql_pquery(111, "", "OnAccountCheck", "i") (modules/register.pwn:11)
[ERROR] mysql_pquery: invalid connection handle '111' (modules/register.pwn:11)
[DEBUG] mysql_pquery: return value: '0' (modules/register.pwn:11)
EDIT: I use R41-4 and this happens after OnGameModeInit, and my connection is successful
|
|
|
argument type mismatch (argument 4) |
Posted by: Polygon - 2019-08-04, 05:42 PM - Forum: Support
- Replies (2)
|
 |
So I'm using the community complier stdlib easyDialog, but for some reason I got an error at line 95...
Code: ShowPlayerDialog(playerid, 32700, style, caption, string, button1, button2);
...in easyDialog.inc (argument type mismatch (argument 4)). easyDialog is const corrected, and stdlib aswell, what could be the problem? I tried with older version of the complier, also other version of stdlib but it just doesn't work.
|
|
|
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
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:
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]](http://i.imgur.com/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]](http://wiki.sa-mp.com/wroot/images2/a/a1/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]](http://wiki.sa-mp.com/wroot/images2/d/d5/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]](http://wiki.sa-mp.com/wroot/images2/b/b1/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]](http://wiki.sa-mp.com/wroot/images2/f/f8/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]](http://i.imgur.com/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]](http://i.imgur.com/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:
- 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.
|
|
|
|