Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #cs ----------------------------------------------------------------------------
- AutoIt Version: 3.3.6.1
- Author: fabi202cool
- Script Function:
- MTA to PAWN Converter v0.9
- #ce ----------------------------------------------------------------------------
- #include <String.au3>
- #include <Array.au3>
- #include "Ordner.au3"
- #include <ButtonConstants.au3>
- #include <ComboConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <GuiEdit.au3>
- $Form1 = GUICreate("MTA Converter v0.9", 330, 244, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
- GUISetBkColor(0xFFFFFF)
- $Label1 = GUICtrlCreateLabel("MTA Converter", 16, 8, 298, 25)
- GUICtrlSetFont(-1, 12, 800, 0, "Blackoak Std")
- GUICtrlSetColor(-1, 0x0000FF)
- $Edit1 = GUICtrlCreateEdit("", 16, 48, 297, 145)
- GUICtrlSetData(-1, "Drop files here...")
- $Label2 = GUICtrlCreateLabel("by fabi202cool", 16, 24, 193, 19)
- GUICtrlSetFont(-1, 8, 800, 0, "Blackoak Std")
- GUICtrlSetColor(-1, 0x00FF00)
- $Combo1 = GUICtrlCreateCombo("Select File...", 16, 208, 161, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
- GUICtrlSetData(-1, "Select File...")
- $Button1 = GUICtrlCreateButton("Convert", 232, 206, 83, 25)
- GUISetState(@SW_SHOW)
- Const $WM_DROPFILES = 0x233
- GUIRegisterMsg($WM_DROPFILES, "On_WM_DROPFILES")
- Dim $ConvertLine[1]
- Global $object
- $RegPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Multi Theft Auto: San Andreas All\1.1","Last Run Location")
- $dateien = _ordner_rekursiv($RegPath & "\server\mods\deathmatch\resources", 1)
- For $i=1 To UBound($dateien)-1
- If StringRegExp($dateien[$i][1],".map")=0 Then
- $dateien[$i][0]=""
- EndIf
- Next
- For $i=1 To UBound($dateien)-1
- If $dateien[$i][0] <> "" Then
- GUICtrlSetData($Combo1,$dateien[$i][1])
- EndIf
- Next
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $Button1
- OpenCombo()
- EndSwitch
- WEnd
- Func OpenCombo()
- $map = GUICtrlRead($Combo1)
- if StringInStr($map,".map") Then
- OpenFile($RegPath & "\server\mods\deathmatch\resources\" & StringTrimRight(GUICtrlRead($Combo1),4) & "\" & $map)
- Else
- MsgBox(0,"Fehler","Es werden nur .map Dateien unterstützt.")
- EndIf
- EndFunc
- Func Object($line)
- $objectline=FileReadLine($FileOpen,$line)
- $Bezeichnung=_StringBetween($objectline,'id="','"')
- $ID=_StringBetween($objectline,'model="','"')
- $posX=_StringBetween($objectline,'posX="','"')
- $posY=_StringBetween($objectline,'posY="','"')
- $posZ=_StringBetween($objectline,'posZ="','"')
- $rotX=_StringBetween($objectline,'rotX="','"')
- $rotY=_StringBetween($objectline,'rotY="','"')
- $rotZ=_StringBetween($objectline,'rotZ="','"')
- $posX[0]=StringFormat("%f",$posX[0])
- $posY[0]=StringFormat("%f",$posY[0])
- $posZ[0]=StringFormat("%f",$posZ[0])
- $rotX[0]=StringFormat("%f",$rotX[0])
- $rotY[0]=StringFormat("%f",$rotY[0])
- $rotZ[0]=StringFormat("%f",$rotZ[0])
- $object &= "CreateObject("&$ID[0]&", "&$posX[0]&", "&$posY[0]&", "&$posZ[0]&", "&$rotX[0]&", "&$rotY[0]&", "&$rotZ[0]&"); //"&$Bezeichnung[0] & @CRLF
- EndFunc
- Func Vehicle($line)
- $objectline=FileReadLine($FileOpen,$line)
- $Bezeichnung=_StringBetween($objectline,'id="','"')
- $ID=_StringBetween($objectline,'model="','"')
- $posX=_StringBetween($objectline,'posX="','"')
- $posY=_StringBetween($objectline,'posY="','"')
- $posZ=_StringBetween($objectline,'posZ="','"')
- $rotZ=_StringBetween($objectline,'rotZ="','"')
- $posX[0]=StringFormat("%f",$posX[0])
- $posY[0]=StringFormat("%f",$posY[0])
- $posZ[0]=StringFormat("%f",$posZ[0])
- $rotZ[0]=StringFormat("%f",$rotZ[0])
- $object &= "AddStaticVehicleEx("&$ID[0]&", "&$posX[0]&", "&$posY[0]&", "&$posZ[0]&", "&$rotZ[0]&", -1, -1, 15); //"&$Bezeichnung[0] & @CRLF
- EndFunc
- Func OpenFile($Path)
- Global $FileOpen = FileOpen($Path)
- $FileCheck = FileReadLine($FileOpen,1)
- If StringRegExp($FileCheck,"<map")=1 Then
- For $i=1 To 999 Step 1
- $LineCheck = FileReadLine($FileOpen,$i)
- If StringRegExp($LineCheck,"<object")=1 Then
- Object($i)
- ElseIf StringRegExp($LineCheck,"<vehicle")=1 Then
- Vehicle($i)
- ElseIf StringRegExp($LineCheck,"</map>")=1 Then
- ExitLoop
- EndIf
- Next
- _GUICtrlEdit_SetText($Edit1,$object)
- ClipPut($object)
- Global $object=""
- EndIf
- EndFunc
- Func filter(ByRef $dFiles)
- For $i = 0 To UBound($dFiles)-1
- if StringInStr($dFiles[$i],".map") Then
- OpenFile($dFiles[$i])
- Else
- MsgBox(0,"Fehler","Es werden nur .map Dateien unterstützt.")
- EndIf
- Next
- EndFunc
- Func On_WM_DROPFILES($hWnd, $Msg, $wParam, $lParam)
- Local $tDrop, $i, $aRet, $iCount;
- $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "ptr", $wParam, "uint", -1, "ptr", 0, "uint", 0 )
- $iCount = $aRet[0]
- local $aDraggedFiles[$iCount];
- For $i = 0 To $iCount-1
- $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "ptr", $wParam, "uint", $i, "ptr", 0, "uint", 0)
- Local $tDrop = DllStructCreate("wchar[" & $aRet[0]+1 & "]")
- $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "ptr", $wParam, "uint", $i, "ptr", DllStructGetPtr($tDrop), "uint", $aRet[0]+1)
- $aDraggedFiles[$i] = DllStructGetData($tDrop, 1);
- Next
- DllCall("shell32.dll", "int", "DragFinish", "ptr", $wParam)
- filter($aDraggedFiles)
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement