[FilterScript] MTA .map loader
#1

MTA .map loader
by mick88
This is an easy to use include that allows you to load objects directly from .map file without need to convert. The script can load not only objects but also vehicles. Pickups and checkpoints are not currently supported. The vehicles will load with all applied modifications (rims, nitrous, hydraulics, spoilers etc) and paintjobs.

Pastebin download: http://pastebin.com/xa7AJ6Nv
SSCANF2 plugin by ****** is required to use this filterscript!
available here: https://sampforum.blast.hk/showthread.php?tid=120356[/CENTER]

Changes in version 0.2:
  • Added support for SA-MP 0.3c objects
  • Added storing object/vehicle IDs
  • Added function to unload single map
  • This script is now an include
  • Added support for custom vehicle numberplates (SA-MP 0.3c only)
  • Added function to unload all current map files
  • Added function checking if map is loaded
  • Support for Incognito's streamer
Functions:
Код:
LoadMtaMap(file[], convert03c=false)
IsMapLoaded(file[])
UnloadMtaMap(file[])
UnloadAll()
Usage:
* Place mtamap.inc in pawno/include folder
* Put #include mtamap on top of your gamemode script
* place all your .map files in the scriptfiles folder
* Use LoadMtaMap("filename.map") anywhere in your script to load map.
* compile and run your script, the objects will be loaded from file. You can unload filterscript after map is loaded

example:
Код:
public OnGameModeInit()
{
    LoadMtaMap("LosSantos.map");
    LoadMtaMap("LasVenturas.map");
    LoadMtaMap("Island.map");
    LoadMtaMap("03ctest.map", true);
}
Support for Incognito's streamer
All you have to do is include streamer.inc before mtamap.inc nad put streamer in server.cfg. Script will detect it automatically and start using it. Default streaming distance is 300.0, you can change it in #define.

SA-MP 0.3c Support added
New version adds support for 0.3c objects and numberplaters. To convert object ids from MTA to 0.3c simply add true as second parameter in LoadMtaMap():
Код:
LoadMtaMap("03ctest.map", true);
The numberplates will load automatically. Script will work on either 0.3b or 0.3c without any changes.

MTA editor VS sa-mp server:
Reply
#2

Awesome gonna test this
Reply
#3

http://pastebin.com/WGjzs4Mw

Mirrored.

This would be good if this supported access to other folders except scriptfiles.

Maybe another command to convert it too?
Reply
#4

looks fine
gona test it after i sleep few hours lol

and question:
if we ig load objects/vehicles
will objects/vehicles stay there if server restarts?
Reply
#5

Quote:
Originally Posted by oттo
Посмотреть сообщение
and question:
if we ig load objects/vehicles
will objects/vehicles stay there if server restarts?
it's hard to tell, i didn't test it; if you gmx maybe the vehicles stay since they are created by FS not the GM, but if you shutdown the server and start it, everything will need to be loaded up again.

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
This would be good if this supported access to other folders except scriptfiles.

Maybe another command to convert it too?
samp doesn't support access to other folders afaik but you can try using '../../../maps/file.map' or simply get a plugin that allows it. The parameter you pass to the function is the file path so you can make it whatever you want like "maps/mymap.map" to access scriptfiles/maps/mymap.map file
Reply
#6

Please add function UnLoadMtaMap
Reply
#7

nice its really good i like this keep it up make more useful programs like this
Reply
#8

Quote:
Originally Posted by CrunkBankS
Посмотреть сообщение
Please add function UnLoadMtaMap
you need to destroy all items and then reload all other .map files that's the only way since the script doesn't keep track of spawned items. Maybe later I will work on the option to unload only objects from certain map.
Reply
#9

Thanks mick, i can always rely on you -Whatcha
Reply
#10

Quote:
Originally Posted by Jay_
Посмотреть сообщение
Nice idea. It would be nice however if this didn't require the sscanf plugin. As I understand, the PAWN version of sscanf supports delimiters in a similar sense so therefore I don't think it would be too hard to edit.
Yes but as far as I remember pawn sscanf crashes with long floats. Floats in mta map files have way more digits after comma than pawno ones. But I should try, maybe modify sscanf that would indeed be way better, I just didn't consider that since I've been using sscanf2 for a while now.
Reply
#11

C:\Documents and Settings\User\Desktop\Bulgarian Server 0.2.2\gamemodes\ecmn1.pwn(12 : fatal error 100: cannot read from file: "mtamap"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
please help
Reply
#12

Quote:
Originally Posted by boyan96
Посмотреть сообщение
C:\Documents and Settings\User\Desktop\Bulgarian Server 0.2.2\gamemodes\ecmn1.pwn(12 : fatal error 100: cannot read from file: "mtamap"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
please help
You need to copy the inc file to yout current pawno include directory.
Reply
#13

nice script

how safe is it to be loading and deleting maps with this if the server has around 20 players or more?
Reply
#14

Quote:
Originally Posted by Jumpman23
Посмотреть сообщение
nice script

how safe is it to be loading and deleting maps with this if the server has around 20 players or more?
I don't see any problem unless you mapped some islands or bridges then you shouldn't reload them when players are on top of them. My server has 52 player slots and I have to reload maps from time to time and there is no problems at all.
Reply
#15

Awesome ......
Reply
#16

mick88 thanks you very much sorry for my bad english
Reply
#17

is this only for mta? cuz it wont work for me...
Reply
#18

Quote:
Originally Posted by multinfs
Посмотреть сообщение
is this only for mta? cuz it wont work for me...
It's for samp thats why it's on SA-MP forums..
Reply
#19

This doesn't work with Incognitos plugin..

I do:

pawn Код:
#define ADD_OBJECT(%1)  CreateDynamicObject(%1)
But it won't load the objects..

EDIT:

Pffffff... nevermind, I wasn't loading the plugin ^_^
Reply
#20

Major update in the script. It is now an include and supports SA-MP 0.3c
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)