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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,708
» Latest member: a.s.aromal2006
» Forum threads: 2,356
» Forum posts: 12,303

Full Statistics

Online Users
There are currently 300 online users.
» 0 Member(s) | 297 Guest(s)
Baidu, Bing, Google

Latest Threads
Client issue with object
Forum: Support
Last Post: TheDoctor
2025-11-15, 08:00 PM
» Replies: 0
» Views: 66
San Andreas Police Pursui...
Forum: Advertisements
Last Post: BriBri
2025-11-15, 12:06 AM
» Replies: 0
» Views: 66
[Include] OpenGate (Abrir...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-11-13, 06:49 PM
» Replies: 0
» Views: 59
OpenGate (Open Proximity ...
Forum: Libraries
Last Post: Crazy_ArKzX
2025-11-13, 06:46 PM
» Replies: 0
» Views: 77
LS City Hall
Forum: Maps
Last Post: cosminupgaming
2025-11-12, 04:22 PM
» Replies: 3
» Views: 2,701
Crime Base
Forum: Maps
Last Post: cosminupgaming
2025-11-12, 04:19 PM
» Replies: 2
» Views: 1,269
GTA SA-MP Scripting: Issu...
Forum: General Discussions
Last Post: williamrhein
2025-11-12, 10:16 AM
» Replies: 0
» Views: 90
is it worth creating a se...
Forum: General Discussions
Last Post: cosminupgaming
2025-11-11, 05:30 PM
» Replies: 13
» Views: 18,421
Looking for an English De...
Forum: General Discussions
Last Post: cosminupgaming
2025-11-11, 05:21 PM
» Replies: 2
» Views: 2,844
Awakeninga an old server.
Forum: Support
Last Post: drwnrbbt
2025-11-11, 02:26 PM
» Replies: 0
» Views: 80

 
  [GUIA] Uso Enum
Posted by: Markski - 2019-04-16, 03:59 PM - Forum: Programaci?n - Replies (4)

Es com?n ver en ciertos scripts o partes de c?digo que se publican en foros, gente que no utiliza el Enum, o que lo utiliza mal, ya sea por ignorancia o porque jamas se lo han explicado bien.
Por eso traigo esta peque?a guia que deberia explicar de manera rapida y simple que es un Enum, y como se usa.

Enumeraciones.


Las enumeraciones son un sistema muy ?til para representar largos grupos de datos, y modificarlos de manera simple y r?pida. Se pueden utilizar para reemplazar grandes grupos de constantes definidas o para crear nuevos "tags".

Sin embargo, el uso mas com?n y el que se vera en esta gu?a, es para representar espacios en un array/vector de datos.

Definiendo un Enum

Comencemos con algo muy normal, variables para un usuario. Comensemos por crear un Enumerador, llamado "InfoJugador", con cada tipo de dato que queremos guardar sobre un jugador.


PHP Code:
enum InfoJugador {
?? ?
idUsuario,
?? ?
Bool:estaLogeado,
?? ?
dinero,
?? ?
drogas,
?? ?
skin,
?? ?
rango,
?? ?
banco,
?? ?
aceptaPM,
?? ?
vehiculo,
?? ?
Float:velocidad,
?? ?
Float:altura,
?? ?
fps,
?? ?
clanID,
?? ?
asesinatos,
?? ?
muertes


...Obviamente, un servidor real tendra muchas mas variables de jugador que estas, pero como ejemplo, va a servir. Pueden ver que dentro del enum definimos varios diferentes tipos de datos, en este caso Integer, Float y un Booleano. Tranquilamente podriamos tener string y cualquier tipo mas si quisieramos, ya que al hacer enums los contenidos de un arreglo no estan limitados a un solo tipo de dato, pero por ahora, con estos nos alcanzara.

Utilizando un Enum

Para utilizar ese enumerador, simplemente tenemos que definirlo dentro de un arreglo. En este caso, vamos a crear un arreglo de dos dimensiones que contendra toda la informaci?n para cada jugador.

PHP Code:
new Jugador[MAX_PLAYERS][InfoJugador]; 

Pueden ver que la primera dimensi?n de nuestro arreglo es la cantidad de espacios/slots que tiene el servidor o "MAX_PLAYERS", mientras la segunda dimensi?n es el Enum que creamos anteriormente. De esta manera se le asigna a cada playerid, cada una de las variables que colocamos en el Enumerador.

Ahora acceder a una variable de usuario es tan simple como utilizar Jugador[playerid][NombreElemento], donde NombreElemento es cualquiera de los elementos definidos dentro del Enum.

Ya se puede ver una de las principales ventajas que tiene sobre crear cada variable de manera individual (ejemplo "dinero[playerid];"), siendo esta que ahora se tiene una manera estandarizada de agregar y acceder a cada valor.

Inicializando un Enum

Cuando el servidor inicia, y cada vez que un nuevo jugador se conecta, obviamente no vamos a querer que tengan datos basura o datos del jugador que anteriormente tenia la misma ID. Para esto es necesario inicializar el Enumerador con datos por defecto.

PHP Code:
InicializarJugador(playerid) {
?? ?
Jugador[playerid][idUsuario] = -1;
?? ?
Jugador[playerid][estaLogeado] = false
?? ?Jugador[playerid][dinero] = 0;
?? ?
Jugador[playerid][drogas] = 0;
?? ?
Jugador[playerid][skin] = 0;
?? ?
Jugador[playerid][rango] = 0;
?? ?
Jugador[playerid][banco] = 0;
?? ?
Jugador[playerid][aceptaPM] = 1;
?? ?
Jugador[playerid][vehiculo] = -1;
?? ?
Jugador[playerid][velocidad] = 0.0;
?? ?
Jugador[playerid][altura] = 0.0;
?? ?
Jugador[playerid][fps] = -1;
?? ?
Jugador[playerid][clanID] = -1;
?? ?
Jugador[playerid][asesinatos] = 0;
?? ?
Jugador[playerid][muertes] = 0;


Si bien en esta situaci?n se podria utilizar un iterador que recorra todos los elementos de InfoJugador, no es recomendable ya que claramente no todos los espacios tendran el mismo valor de inicio.

Obviamente, varios de esos datos van a ser cambiados por tu sistema de usuario cada vez que un usuario se Logee o Registre, pero es ideal de todas maneras tener un estado limpio para evitar problemas. La funci?n de arriba, InicializarJugador(), deberia idealmente ejecutarse sobre cada jugador que se conecte en OnPlayerConnect() .

IMPORTANTE: Tener en cuenta que las variables van a seguir existiendo una vez que un jugador se conecte y no se conecta otro para reemplazar su ID. Si tienen iteradores de MAX_PLAYERS, no solo chequeen que esten logeados en el sistema de usuario, tambien chequeen IsPlayerConnected(playerid) !!

Conclusi?n

Utilizar Enumeradores es una manera muy rapida y sensilla de almacenar y organizar grupos de datos para ciertas cosas dadas, como pueden ser jugadores, casas y negocios entre muchas otras cosas. Provee una manera estandarizada de acceder y definir datos, al mismo tiempo que ayuda a separar variables relacionadas a ciertos componentes del servidor de otras.

Es importante aclarar, por supuesto, esta no es la "manera correcta" de guardar variables de usuario/casa/etc. No existe tal cosa como la manera correcta y suprema.
Existen muchas maneras y cada una es mejor dependiendo de como escribas y organizes tu GM. Aqui yo solo les muestro una m?s.

Espero les haya sido de ayuda.


  TextDraw String Width
Posted by: kristo - 2019-04-16, 03:45 PM - Forum: Libraries - Replies (2)

SA-MP TextDraw String Width

[Image: sampctl-samp--td--string--width-2f2f2f.s...-the-badge]

About two years ago an user called Alcatrik came up with a concept of calculating the width of textdraw strings in this thread. In those two years a few functions using this concept appeared in that thread, but all of them had major flaws. The first one by Crayder didn?t include the first 32 characters of the ASCII table. The next one by Freaksten fixed that flaw, but neither of the functions also didn?t take into account that there are four different textdraw fonts and just used the first array in fonts.dat.

About two or three months ago I needed a correct version of that function so I started digging into the data in fonts.dat. The first discovery I made is that fonts 2 and 3 are actually subfonts of fonts 0 and 1 (fun fact: you can actually access the characters of fonts 2 and 3 from fonts 0 and 1 by using values larger than 175 as characters). I manually reassembled the data into four arrays, but soon after that I temporarily abandoned the project I collected this data for.

A few days ago I mentioned the data I had collected and Y_Less sent me a repository that contained a function that generated the same dataset automatically. I decided to compare the two datasets and found out that they had different widths for 16 characters, which I re-measured manually. Both got about half of the 16 widths right and half of them wrong.

Another mistake that all existing functions did was presuming that characters 1-31 are always rendered as regular whitespace. In reality, the widths of the invisible characters differed in font 2 and the characters in font 3 actually have two different widths. One of them is the visual width: most of the characters don?t actually render as whitespace, instead of this you see either one or two stripes with varying widths. The other width is the ?physical? width, which is either 0 (the stripes overlap with the next character or two) or a relatively large number, up to 255.

Now, after multiple days of work that contained manually reassembling data, manually measuring almost 100 characters and a lot more, this library is ready. What could it be used for? I personally needed this to calculate the width of buttons based on their strings. The previously mentioned repository uses code similar to this to achieve full colouring of textdraws. A few more usages can be found from the original topic explaining the concept.

Installation

Simply install to your project:

Code:
sampctl package install kristoisberg/samp-td-string-width

Include in your code and begin using the library:

PHP Code:
#include <td-string-width> 

Usage
  • GetTextDrawCharacterWidth(character, font, bool:proportional = true)
    • Returns the width of a single character.
  • GetTextDrawStringWidth(const string[], font, outline = 0, bool:proportional = true)
    • Finds the longest line in the string and returns the width of it. Skips everything between ~ characters except ~n~, which indicates the start of a new line. Odd number of ~ characters returns the width of ?Error: unmatched tilde?.
  • GetTextDrawLineWidth(const string[], font, outline = 0, bool:proportional = true)
    • Works just like GetTextDrawStringWidth, but presumes that the string only contains one line. Skips ~n~ just like everything else between ~ characters.
Testing

To test, simply run the package:

Code:
sampctl package run


Photo House with 0
Posted by: Rafael_Rosse - 2019-04-16, 03:29 PM - Forum: Videos and Screenshots - No Replies

Retekstur houses with 0 and buying furniture arrangement



[Image: gGjXXpmHo4Q.jpg]

[Image: uEveMib2PZM.jpg]

[Image: IaR5iTzRa3I.jpg]

[Image: IaR5iTzRa3I.jpg]

[Image: 3h1sVahsWSo.jpg]

[Image: 2RDXQsfKsUg.jpg]

[Image: XEF62qhQUzk.jpg]

[Image: nnRDPSSrd1M.jpg]

[Image: WSrILvu_3VA.jpg]

[Image: pPLx5Ku1k0g.jpg]

On my project Constant rp


  ?Cual Gta es tu Favorito?
Posted by: Rawnker - 2019-04-16, 03:06 PM - Forum: Discusi?n GTA SA Multijugador - Replies (16)

?Cual es el Grand Theft Auto (GTA) que m?s te gusta y porque?

A mi el que m?s me gusta es el GTA VC por su ambientaci?n e interesante historia


  MV_Autodeploy - Use git to your advantage to auto-update your sa-mp server
Posted by: michael@belgium - 2019-04-16, 02:26 PM - Forum: Releases - Replies (1)

Information



So this is a mix of files/release that will make your developing easier (well, in my opinion). By doing one git command your server will update automaticly on your vps/dedicated server.?

Just the fact that you don't need to upload new .amx every time and need to edit your /updates command ... or like people saying "what's new?"?



This is all not needed anymore!



It works like this; you push your update to your remote, bitbucket will send info to your vps saying the script is updated, your vps will update the gamemode files, your database will get updated and later your server will check if there's a new commit hash than before. If yes, the samp server will automaticly update/restart



Functions



Code:
OnServerUpdateDetected(id, hash[], shorthash[], message[])

OnUpcomingUpdateDetected(updateid, hash[], shorthash[], message[])

OnServerIssueCreated(issueid, title[], priority[], kind[])

OnServerIssueStatusChange(issueid, title[], oldstatus[], newstatus[])

OnServerTagCreated(updateid, linkedtohash[], tagname[])



MV_AutoDeployInit(MySQL:sqlCon)

MV_AutoDeployExit()

MV_GetServerVersion()



Installation



Code on github



[Image: 68747470733a2f2f7075752e73682f774b3873752e6a7067]



Copied from original samp forums


  Nederlandse muziek
Posted by: Codeah - 2019-04-16, 02:14 PM - Forum: Dutch/Nederlands - Replies (9)

Ik woon al een paar jaar in het buitenland, maar alle muziek die ik zie op YouTube Trending is echt pijnlijk om naar te luisteren.



Bestaat er nog goede Nederlandse muziek? Als dat zo is, post het dan hieronder.


  News open.mp Russia
Posted by: Nikita228 - 2019-04-16, 01:36 PM - Forum: Russian/??????? - Replies (1)

Russian-speaking community, we will publish news related to open.mp



Link - https://vk.com/openmpnews


  Screen Colour Fader
Posted by: kristo - 2019-04-16, 12:12 PM - Forum: Libraries - No Replies

SA-MP Screen Colour Fader



[Image: sampctl-samp--screen--colour--fader-2f2f...-the-badge]



This library lets you add colour filters to players? screens and fade between them. Until today I was using a modified version of Joe Staff?s fader include, but since it was using a separate argument for each part of an RGBA colour and the original was outdated in general, I decided to create my own. Here?s what I came up with.



Installation



Simply install to your project:



Code:
sampctl package install kristoisberg/samp-screen-colour-fader



Include in your code and begin using the library:



PHP Code:
#include <screen-colour-fader> 



Functions



PHP Code:
native SetPlayerScreenColour(playeridcolour); 



Will set the player?s screen colour to the specified colour. Can be used during a fade, but the fade will continue after the current step is finished. Returns 1 if the specified player is connected or 0 if not.



PHP Code:
native GetPlayerScreenColour(playerid); 



Can be used during a fade. Returns the current colour of the player?s screen if the player is connected or 0x00000000 if not.



PHP Code:
native FadePlayerScreenColour(playeridcolourtimesteps); 



Fades the player?s screen from the current colour to the colour specified in the function. time specifies the duration of the fade and steps specifies the amount of steps made during the fade. Returns 1 if the specified player is connected and the values of time and steps are valid or 0 if not.



PHP Code:
native StopPlayerScreenColourFade(playerid); 



Stops the ongoing fade. The colour of the player?s screen will remain as it is at the time of the function call. Returns 1 if the specified player is connected and has an ongoing fade or 0 if not.



Callbacks



PHP Code:
forward public OnScreenColourFadeComplete(playerid); 



Notes


  • Both for the functions and the callback, the American spelling (color instead of colour) is also supported.


Example



The following piece of code (also available in test.pwn) fades the player?s screen to red and back to transparent five times.



PHP Code:
new bool:reversecounter;



public 
OnPlayerConnect(playerid) {

? ?
SetPlayerScreenColour(playerid0x00000000);

? ?
FadePlayerScreenColour(playerid0xFF0000AA100025);

? ?return 
1;

}





public 
OnScreenColourFadeComplete(playerid) {

? ?if (
流⺞힫 == 10) {

? ? ? ?return 
1;

? ?}



? ?
FadePlayerScreenColour(playeridreverse 0xFF0000AA 0x00000000100050);



? ?
reverse = !reverse;



? ?return 
1;





Testing



To test, simply run the package:



Code:
sampctl package run



And connect to localhost:7777 to test.


  PAWN Colour Manipulation
Posted by: kristo - 2019-04-16, 12:09 PM - Forum: Libraries - Replies (3)

PAWN Colour Manipulation



[Image: sampctl-pawn--colour--manipulation-2f2f2...-the-badge]



This library provides a number of easy-to-use colour manipulation functions for PAWN.



Installation



Simply install to your project:



Code:
sampctl package install kristoisberg/pawn-colour-manipulation



Include in your code and begin using the library:



PHP Code:
#include <colour-manipulation> 



Testing



To test, simply run the package:



Code:
sampctl package run



There is also a separate test script (samp-grayscale-bitmap) that unfortunately doesn?t work yet due to a bug in samp-bitmapper.



Functions



PHP Code:
GetColourComponents(colour, &Float:r, &Float:g, &Float:b, &Float:1.0ColourMode:mode COLOUR_MODE_RGBA



Extracts the RGB(A) components from a colour code.



PHP Code:
Float:GetColourComponent(colourColourComponent:componentColourMode:mode COLOUR_MODE_RGBA



Extracts an individual colour component from a colour code and returns it.



PHP Code:
SetColourComponent(colourColourComponent:componentFloat:valueColourMode:mode COLOUR_MODE_RGBA



Modifies an individual component of an existing colour and returns the new colour.



PHP Code:
GetColourCode(Float:rFloat:gFloat:bFloat:1.0ColourMode:mode COLOUR_MODE_RGBA



Creates a colour code from RGB(A) components.



PHP Code:
ConvertColour(colourColourMode:fromColourMode:toFloat:alpha 1.0



Converts a colour from one colour mode to another. Alpha should be specified when converting from RGB, otherwise 0xFF (fully non-transparent) is used.



PHP Code:
InterpolateColours(colour1colour2Float:amountColourMode:mode COLOUR_MODE_RGBA



Interpolates two colours. amount must be in the range 0.0 - 1.0. The larger amount is, the closer the returned colour is to colour2.



PHP Code:
Float:GetColourBrightness(colourColourMode:mode COLOUR_MODE_RGBA



Returns the brightness of a colour.



PHP Code:
DarkenColour(colourFloat:amountColourMode:mode COLOUR_MODE_RGBA



Darkens a colour by interpolating it with the black colour.



PHP Code:
LightenColour(colourFloat:amountColourMode:mode COLOUR_MODE_RGBA



Lightens a colour by interpolating it with the white colour.



PHP Code:
GrayscaleColour(colourColourMode:mode COLOUR_MODE_RGBA



Returns the grayscale equivalent of a colour.



PHP Code:
Float:GetColourComponentFractValue(value



Converts a binary colour component value to a fractional value.



PHP Code:
GetColourComponentBinaryValue(Float:value



Converts a fractional colour component value to a binary value.



PHP Code:
Float:AddColourComponentGammaCor(Float:value



Adds sRGB gamma correction to a colour component.



PHP Code:
Float:RemoveColourComponentGammaCor(Float:value



Removes the sRGB gamma correction from a colour component.



Definitions



Colour modes



COLOUR_MODE_RGBA - The most common colour format in SA-MP: used by SendClientMessage, textdraws, etc.



COLOUR_MODE_ARGB- Colour format used by SetObjectMaterial, SetObjectMaterialText and SetPlayerAttachedObject.



COLOUR_MODE_RGB - Colour format used by embedded colours, probably the most common colour format outside of SA-MP, most notably in webpages.



Colour components



COLOUR_COMPONENT_R - Red



COLOUR_COMPONENT_G - Green



COLOUR_COMPONENT_B - Blue



COLOUR_COMPONENT_A - Alpha



Notes



Both British and American spellings (color/colour, gray/grey) are supported for everything noted above.


  Send your burger pics
Posted by: kristo - 2019-04-16, 12:06 PM - Forum: Chat - Replies (11)

.