SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Tools and Files

Reply
 
Thread Tools Display Modes
Old 12/03/2017, 10:17 PM   #1
faxxe
Big Clucker
 
faxxe's Avatar
 
Join Date: Nov 2009
Location: Brasilia
Posts: 86
Reputation: 14
Default Simple Offlince Object Converter (Beta)

Ahoy



Right now i finished the first version of my small and tiny offline object converter for SA:MP/MTA:SA, because my favourite map converter convertffs.com is dead.

The purpose of this program was to create a simple object converter for myself but now i want to share it, maybe its useful for someone

Another reason is the huge amount of objects i want to convert and the conversion by using online converters takes a huge amount of time due to the upload/download speed of the client.

Its meant to be a commandline tool because i love simple stuff and i love SSH/CMD so why not?

Most online converters were not able to convert more than 5000 objects because they stop working or you get some connection timeout because of the slow upload.


So i decided to create a small C based converter by using fscanf and sscanf to parse the values out of the input and convert it into the desired output.


My tool is available for Linux and Windows at the moment, a Mac OSX version is not planned.
Note! This program is in Beta state so it may contain bugs, please report them if you encounter any malfunction.


You can report bugs via E-Mail: webmaster@knogleinsi.de or by replying in this topic.

I did not pay attention of efficieny because even with 100.000 objects in worst case, meaning MTA:SA to SA:MP the average time for a conversion is around 1.6 seconds.

The execution time of this program is O(3n) in best case and O(6n) in the worst case (MTA:SA (XML) to SA:MP CreateObject)


The goal is to support features like the conversion of Vehicles,Peds/Actors, Pickups and more, like the MapConverter Plugin you can find in here.

I also want to cover more types of objects.

And the most important reason: I dont want to spent all my time, uploading and converting it somewhere.



Readme




Code:
        Copyright (C) 2017 Fabian Druschke (Knogle)
    ​
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    ​
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    ​
        You should have received a copy of the GNU General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/
    ​
    ​
    ​
    ​
    Compiler settings:
    ​
    Linux: gcc simpleconverter.c
    Windows MinGW: gcc simpleconverter.c
    ​
    ​
    Usage:
    ​
    Linux: ./a.out foo.map
    ​
    Windows: a foo.map
    ​
    Output file output.txt will be written into the same directory.

​






Running it..


Filename is converter.exe and the parameter the input filename.


(You can also use a batch file to execute it)

converter.exe objects.map


Now you choose the input objecttype and the desired output.
Now the conversion is done! Simple, isnt it?

Done!





I did not use any XML Parser because for this simple use, because it would be way to difficult in to implement it in C!


Example input:



XML-Map
Code:
     <object id="object (des_ebrigroad07) (1)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1135.2" posY="-866.29999" posZ="62.5" rotX="0" rotY="0" rotZ="314"></object>
        <object id="object (des_ebrigroad07) (2)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1135.3" posY="-866.20001" posZ="72.7" rotX="0" rotY="0" rotZ="313.995"></object>
        <object id="object (des_ebrigroad07) (3)" breakable="true" interior="0" alpha="255" model="16358" doublesided="false" scale="1" dimension="0" posX="-1140.6" posY="-871.40002" posZ="66.1" rotX="90" rotY="0" rotZ="313.995"></object>

​


Output:



PAWN-Code

Code:
    CreateObject(16358,-1135.199951,-866.299988,62.500000,0.000000,0.000000,314.000000);// (des_ebrigroad07)
    CreateObject(16358,-1135.300049,-866.200012,72.699997,0.000000,0.000000,313.994995);// (des_ebrigroad07)
    CreateObject(16358,-1140.599976,-871.400024,66.099998,90.000000,0.000000,313.994995);// (des_ebrigroad07)

I hope its useful for someone, like written in the license I will publish updates weekly in this topic and refresh the github repository.




Download:


https://github.com/Knogle/SimpleConverter​


Source only:


http://pastebin.com/LAMxv5hi​
__________________
"Wisdom and virtue are like the two wheels of a cart."
--Japanese Proverb
faxxe is offline   Reply With Quote
Old 18/04/2017, 09:19 PM   #2
faxxe
Big Clucker
 
faxxe's Avatar
 
Join Date: Nov 2009
Location: Brasilia
Posts: 86
Reputation: 14
Default Re: Simple Offlince Object Converter (Beta)

Updated. MTA_SA Objects are now fully supported
__________________
"Wisdom and virtue are like the two wheels of a cart."
--Japanese Proverb
faxxe is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Converter JaKe Elite Scripting Help 1 28/05/2012 09:41 AM
mta object/vehicle converter hadzx Help Archive 7 04/02/2011 04:29 PM
Object converter for samp 0.3b Fab10 Help Archive 3 19/09/2010 03:25 PM
[FilterScript] [FS]APP Converter time 1.0 Beta Phoenix_Br Filterscripts 3 23/04/2010 01:18 PM


All times are GMT. The time now is 12:08 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.