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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 7,203
» Latest member: aurelijus601
» Forum threads: 2,372
» Forum posts: 12,276

Full Statistics

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

Latest Threads
[Request] Linko Gaming Ro...
Forum: General Discussions
Last Post: JamesC
2025-06-20, 07:34 PM
» Replies: 0
» Views: 22
RevolutionX DM/Stunt/Race...
Forum: Advertisements
Last Post: DerekZ905
2025-06-18, 03:12 PM
» Replies: 0
» Views: 52
samp-cef
Forum: Questions and Suggestions
Last Post: jamespssamp
2025-06-18, 11:36 AM
» Replies: 0
» Views: 34
SA-MP Crash
Forum: General Discussions
Last Post: davidfreeman
2025-06-11, 04:58 AM
» Replies: 0
» Views: 172
Offering Pawn Scripting S...
Forum: Pawn Scripting
Last Post: Mido
2025-06-07, 01:30 PM
» Replies: 0
» Views: 265
How to make your GTA SA:M...
Forum: Tutorials
Last Post: NoxxeR
2025-06-07, 06:48 AM
» Replies: 3
» Views: 1,216
discord ban
Forum: Support
Last Post: NickS
2025-06-07, 06:23 AM
» Replies: 2
» Views: 493
Sons of silence Motorcycl...
Forum: Advertisements
Last Post: thongek.wpm
2025-06-03, 02:24 PM
» Replies: 0
» Views: 355
Empire Freeroam Roleplay ...
Forum: Advertisements
Last Post: krishgamer1964
2025-06-03, 11:25 AM
» Replies: 0
» Views: 419
Script[gamemodes/gamemode...
Forum: Pawn Scripting
Last Post: jeppe9821
2025-06-01, 09:27 AM
» Replies: 0
» Views: 396

 
  Map Zones - Let's end a decade of bad practices...
Posted by: kristo - 2019-04-15, 10:34 AM - Forum: Libraries - Replies (2)

SA-MP Map Zones



[Image: sampctl-samp--map--zones-2f2f2f.svg?style=for-the-badge]



This library does not bring anything gamechanging to the table, it?s created to stop a decade long era of bad practices regarding map zones. An array of ~350 zones dumped (or manually converted?) from the game has been around for such a long time, but in that time I?ve never seen a satisfactory API for them. Let?s look at an implementation from Emmet_?s South Central Roleplay.



PHP Code:
stock GetLocation(Float:fXFloat:fYFloat:fZ)

{

? ? 
enum e_ZoneData

? ? {

? ? ? ? 
e_ZoneName[32 char],

? ? ? ? 
Float:e_ZoneArea[6]

? ? };

? ? new const 
g_arrZoneData[][e_ZoneData] =

? ? {

? ? ? ? 
// ...

? ? };

? ? new

? ? ? ? 
name[32] = "San Andreas";



? ? for (new 
0!= sizeof(g_arrZoneData); )

? ? {

? ? ? ? if (

? ? ? ? ? ? (
fX >= g_arrZoneData[i][e_ZoneArea][0] && fX <= g_arrZoneData[i][e_ZoneArea][3]) &&

? ? ? ? ? ? (
fY >= g_arrZoneData[i][e_ZoneArea][1] && fY <= g_arrZoneData[i][e_ZoneArea][4]) &&

? ? ? ? ? ? (
fZ >= g_arrZoneData[i][e_ZoneArea][2] && fZ <= g_arrZoneData[i][e_ZoneArea][5]))

? ? ? ? {

? ? ? ? ? ? 
strunpack(nameg_arrZoneData[i][e_ZoneName]);



? ? ? ? ? ? break;

? ? ? ? }

? ? }

? ? return 
name;

}



stock GetPlayerLocation(playerid)

{

? ? new

? ? ? ? 
Float:fX,

? ? ? ? 
Float:fY,

? ? ? ? 
Float:fZ,

? ? ? ? 
string[32],

? ? ? ? 
id = -1;



? ? if ((
id House_Inside(playerid)) != -1)

? ? {

? ? ? ? 
fX HouseData[id][housePos][0];

? ? ? ? 
fY HouseData[id][housePos][1];

? ? ? ? 
fZ HouseData[id][housePos][2];

? ? }

? ? 
// ...

? ? else GetPlayerPos(playeridfXfYfZ);



? ? 
format(string32GetLocation(fXfYfZ));

? ? return 
string;





[Image: cyUdlu4.png]



If you didn?t get the reference, you should probably check out this repository. GetPlayerLocation most likely uses format to prevent this bug from occurring, but the risk is still there and arrays should never be returned in PAWN. Let?s take a look at another implementation that even I used a long time ago.



PHP Code:
stock GetPointZone(Float:xFloat:yFloat:zzone[] = "San Andreas"len sizeof(zone))

{

? ? for (new 
isizeof(Zones); ji)

? ? {

? ? ? ? if (
>= Zones[i][zArea][0] && <= Zones[i][zArea][3] && >= Zones[i][zArea][1] && <= Zones[i][zArea][4] && >= Zones[i][zArea][2] && <= Zones[i][zArea][5])

? ? ? ? {

? ? ? ? ? ? 
strunpack(zoneZones[i][zName], len);

? ? ? ? ? ? return 
1;

? ? ? ? }

? ? }

? ? return 
1;

}



stock GetPlayerZone(playeridzone[], len sizeof(zone))

{

? ? new 
Float:pos[3];

? ? 
GetPlayerPos(playeridpos[0], pos[1], pos[2]);



? ? for (new 
isizeof(Zones); ji)

? ? {

? ? ? ? if (
>= Zones[i][zArea][0] && <= Zones[i][zArea][3] && >= Zones[i][zArea][1] && <= Zones[i][zArea][4] && >= Zones[i][zArea][2] && <= Zones[i][zArea][5])

? ? ? ? {

? ? ? ? ? ? 
strunpack(zoneZones[i][zName], len);

? ? ? ? ? ? return 
1;

? ? ? ? }

? ? }

? ? return 
1;





First of all, what do we see? A lot of code repetition. That?s easy to fix in this case, but what if we also needed either the min/max position of the zone? We?d have to loop through the zones again or take a different approach. Which approach does this library take? Functions like GetMapZoneAtPoint and GetPlayerMapZone do not return the name of the zone, they return an identificator of it. The name or positions of the zone must be fetched using another function. In addition to that, I rebuilt the array of zones myself since the one used basically everywhere seems to be faulty according to this post.



Installation



Simply install to your project:



Code:
sampctl package install kristoisberg/samp-map-zones



Include in your code and begin using the library:



PHP Code:
#include <map-zones> 



Usage



Constants


  • INVALID_MAP_ZONE_ID = MapZone:-1


    • The return value of several functions when no map zone was matching the

      criteria.


  • MAX_MAP_ZONE_NAME = 27


    • The length of the longest map zone name including the null character.


  • MAX_MAP_ZONE_AREAS = 13


    • The most areas associated with a map zone.



Functions


  • MapZone:GetMapZoneAtPoint(Float:x, Float:y, Float:z)


    • Returns the ID of the map zone the point is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Alias: GetMapZoneAtPoint3D.


  • MapZone:GetPlayerMapZone(playerid)


    • Returns the ID of the map zone the player is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Alias: GetPlayerMapZone3D.


  • MapZone:GetVehicleMapZone(vehicleid)


    • Returns the ID of the map zone the vehicle is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Alias: GetVehicleMapZone3D.


  • MapZone:GetMapZoneAtPoint2D(Float:x, Float:y)


    • Returns the ID of the map zone the point is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Does not check the Z-coordinate.


  • MapZone:GetPlayerMapZone2D(playerid)


    • Returns the ID of the map zone the player is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Does not check the Z-coordinate.


  • MapZone:GetVehicleMapZone2D(vehicleid)


    • Returns the ID of the map zone the vehicle is in or INVALID_MAP_ZONE_ID if

      it isn?t in any. Does not check the Z-coordinate.


  • bool:IsValidMapZone(MapZone:id)


    • Returns true or false depending on if the map zone is valid or not.


  • bool:GetMapZoneName(MapZone:id, name[], size = sizeof(name))


    • Retrieves the name of the map zone. Returns true or false depending on

      if the map zone is valid or not.


  • bool:GetMapZoneSoundID(MapZone:id, &soundid)


    • Retrieves the sound ID of the map zone. Returns true or false depending

      on if the map zone is valid or not.


  • bool:GetMapZoneAreaCount(MapZone:id, &count)


    • Retrieves the count of areas associated with the map zone. Returns true or

      false depending on if the map zone is valid or not.


  • GetMapZoneAreaPos(MapZone:id, &Float:minX = 0.0, &Float:minY = 0.0, &Float:minZ = 0.0, &Float:maxX = 0.0, &Float:maxY = 0.0, &Float:maxZ = 0.0, start = 0)


    • Retrieves the coordinates of an area associated with the map zone. Returns

      the array index for the area or -1 if none were found. See the usage in

      in the examples section.


  • GetMapZoneCount()


    • Returns the count of map zones in the array. Could be used for iteration

      purposes.



Examples



Retrieving the location of a player



PHP Code:
CMD:whereami(playerid) {

? ? new 
MapZone:zone GetPlayerMapZone(playerid);



? ? if (
zone == INVALID_MAP_ZONE_ID) {

? ? ? ? return 
SendClientMessage(playerid0xFFFFFFFF"probably in the ocean, mate");

? ? }



? ? new 
name[MAX_MAP_ZONE_NAME], soundid;

? ? 
GetMapZoneName(zonename);

? ? 
GetMapZoneSoundID(zonesoundid);



? ? new 
string[128];

? ? 
format(stringsizeof(string), "you are in %s"name);



? ? 
SendClientMessage(playerid0xFFFFFFFFstring);

? ? 
PlayerPlaySound(playeridsoundid0.00.00.0);

? ? return 
1;





Iterating through areas associated with a map zone



PHP Code:
new zone ZONE_RICHMANindex = -1Float:minXFloat:minYFloat:minZFloat:maxXFloat:maxYFloat:maxZ;



while ((
index GetMapZoneAreaPos(zoneminXminYminZmaxXmaxYmaxZindex  1) != -1) {

? ? 
printf("%f %f %f %f %f %f"minXminYminZmaxXmaxYmaxZ);





Extending



PHP Code:
stock MapZone:GetPlayerOutsideMapZone(playerid) {

? ? new 
House:houseid GetPlayerHouseID(playerid), Float:xFloat:yFloat:z;



? ? if (
houseid != INVALID_HOUSE_ID) { // if the player is inside a house, get the exterior location of the house

? ? ? ? GetHouseExteriorPos(houseidxyz);

? ? } else if (!
GetPlayerPos(playeridxyz)) { // the player isn't connected, presuming that GetPlayerHouseID returns INVALID_HOUSE_ID in that case?

? ? ? ? return INVALID_MAP_ZONE_ID;

? ? }



? ? return 
GetMapZoneAtPoint(xyz);





Testing



To test, simply run the package:



Code:
sampctl package run


  Show Your Support and Spread the Word!
Posted by: Codeah - 2019-04-15, 10:31 AM - Forum: General Discussions - Replies (17)

Hello fellow OMPers



I have created a little "widget" that will let your players know about Open.MP.

If you're interested and planning on switching to Open.MP, put this on your site / discord server etc. !



[Image: widget-black.svg]



Code:
<a href="https://open.mp/"><img width="200" height="80" src="https://openmp.burgershot.gg/static/widget-black.svg"/></a>





[Image: widget.svg]



Code:
<a href="https://open.mp/"><img width="200" height="80" src="https://openmp.burgershot.gg/static/widget.svg"/></a>





[Image: widget-white.svg]



Code:
<a href="https://open.mp/"><img width="200" height="80" src="https://openmp.burgershot.gg/static/widget-white.svg"/></a>



Spread the word!


  SA:MP Discord Rich Presence plugin
Posted by: hual - 2019-04-15, 10:25 AM - Forum: Releases - Replies (15)

An ASI which adds support for Discord Rich Presence.



It features custom server logos. If you'd like your server added to the custom logos list, create an issue with a 512x512 logo attached and your server's IP address.



[Image: PqvWFbp.png]

[Image: CXh1hDT.png]

[Image: khG9OZe.png]



Download: https://github.com/Hual/samp-discord-plugin/releases

Source: https://github.com/Hual/samp-discord-plugin


Star Help me name my CnR server
Posted by: Codeah - 2019-04-15, 09:35 AM - Forum: General Discussions - Replies (22)

Coming up with names is hard. Perhaps you guys could help me out?



It's a CnR gamemode based in SF


  For those concerned:
Posted by: Archive - 2019-04-15, 09:31 AM - Forum: General Discussions - Replies (12)

Project essentially completed. While we couldn't archive the full SA-MP forum website without receiving IP bans,?https://forum.sa-mp.com/archive?has been fully archived, it is basic but it does have full functionality (the main website does display large threads in a different manner). Note: archive version of the forums (forum.sa-mp.com/archive) has the latest threads of sections on the latest pages. The main website has had 30 GB of data downloaded from it and over 1.2 million pages (including pastebins) with roughly at least another 2.5 million pages missing. What has been archived has been uploaded, including some pages from the archive website. This project went from the 14th to 19th April, so you can expect to see multiple archives from this duration.

This project was initiated because Kalcor threatened to delete the forum's last week (according to Y Less) and hasn't refuted this statement in the thread where Y Less' statement was posted.

You can find the archives on archive.org's WayBack Machine. https://archive.org/web/

Shoutout to the Archive Team for doing all of this.?https://archiveteam.org/

Over 40GB of data has been captured and millions of pages.


  Pawntools | Dialog and 3DTextLabel creator with preview!
Posted by: Romzes - 2019-04-15, 09:30 AM - Forum: Releases - Replies (15)




ABOUT

Pawntools is a page with tools to help to programming visual (front-end) in SA:MP.



PT have a basic tools created in jquery to a fast and comfortable preview, is a simple interpretation of the some SA:MP graphics.



PREVIEWS



[Image: 5RUX0NH.png]



CHARACTERISTICS



* The dialog creator stores the job in the URL, so you can save the url and then continue working on the dialogue, and even pass the url to a friend to see our work and even other person can collaborate.



Example: https://pawn.romzes.com/?q=dialogs&sub=DIALOG_STYLE_MSGBOX&titulo=Hello&mensaje=This%20dialog%20was%20created%20by%20Zume



* The dialog maker have three buttons, to add the backspaces: \n, \t and to add color. The buttons set the character or color in cursor pos.



* The dialog maker have a simply character count, this counter have a colored indicator string count.



* Show the output without problems:



Code:
static str[177];



format(str, sizeof(str), "%sHi, this message is intended to be long and you may notice the newline in the format to prevent errors in the code.\nEach line allow only 200 chars and ", str);

format(str, sizeof(str), "%sbefore jump to this line!", str);



ShowPlayerDialog(playerid, 21, DIALOG_STYLE_MSGBOX, "Hello", str, "Accept", "Cancel");



* in the image animated, shows how would our text in 3d image.



https://pawn.romzes.com/?q=label



DEVELOPERS



Zume and Romzes


  Medieval Progress Video #1
Posted by: dignity - 2019-04-15, 08:51 AM - Forum: Videos and Screenshots - Replies (9)

[Video: https://www.youtube.com/watch?v=nRaA9yZC7lE]


  [Suggestion] "Last X posts"
Posted by: DarkZero - 2019-04-15, 08:21 AM - Forum: Chat - Replies (7)

Something that already annoyed me in the official forums.

Can you guys please add something here where you can see the last X posts? Like this:



[Image: 687474703a2f2f696e7465726e6574626c6f6767...642e6a7067]



Would be cool.


  AFK System in O:MP
Posted by: Mark2 - 2019-04-15, 07:40 AM - Forum: Questions and Suggestions - Replies (9)

Will you add the AFK sys?in O:MP as it is added in SA-MP or delete as it make MTA?? I think you should remove this due bugs and lags. I hate the moments when players go AFK for avoiding different situations as crashing with another cars and etc.



As an alternative, I can offer to remake?AFK system by reducing its intervention in player synchronization with the server to zero, but at the same time having the opportunity to find out when player is?AFK by the?function or a callback (OnPlayerAFK) to further implement its own AFK system programmatically


Brick VisualTexture l Pawn - SA:MP
Posted by: MrHind - 2019-04-15, 07:29 AM - Forum: Programaci?n - Replies (35)

Actualmente me encuentro?creando una herramienta que puede ayudar a las personas que, en caso de no tener conexi?n a Internet, o por cualquier otro motivo, la utilicen para visualizar texturas, animaciones, objetos y otros tipos de cosas. Esta herramienta naci? gracias a la idea de un colega, el cual a decir verdad, a un 20/35% de personas en sa-mp les podr?a ayudar(o tal vez mas), me a tomado mas tiempo de lo debido, a que las personas que me ayudan, me han retrasado un poco el lanzamiento, por lo que posiblemente a final de Abril, este lanzando la primera versi?n, as? que, estar? dando noticias uo cualquier cosa, ya que en esta semana estar? trabajando en adaptaciones que tendr? dicho Software, hasta el momento el ?nico inconveniente que tengo, es el tema con los Sonidos de sa-mp, ya que estos poseen distintos nombres dentro de los archivos internos, y es dif?cil reconocer algunos, pero eso sera para una BETA muy futura.





Un saludo a todos.



[Video: https://www.youtube.com/watch?v=lcAMdltLgII]



Mas Info. [Invitaci?n Discord]

[Image: widget.png?style=banner2]