Página 1 de 1

Custom Teleport (Criar comandos para se teletransportar)

Enviado: 04 Mai 2018, 01:17
por Israel
Atualizado
  • Mod recriado;
  • Adicionado menu com coordenadas salvas;
  • Alterado local do arquivo de dados para GTA User Files para melhor organização.


Este Mod pode ser resumido em comandos:

X+Y Teleporta para a marca vermelha no mapa;
SPOS Salva coordenadas com um nome personalizado;
RPOS Deleta coordenadas salvas;
COORDS Abre um menu com todas as coordenadas salvas.

Você tem 2 opções para se teletransportar para as coordenadas salvas:
  1. Abrir o menu e selecionar o local desejado;
  2. Simplesmente digitar o nome do local a qualquer momento.

Salvando coordenadas:
Imagem

Removendo coordenadas:
Imagem

Menu de coordenadas:
Imagem

DOWNLOAD
SourceAbrir

Código: Selecionar tudo

{$Cleo}
const
    NULL 0x00
    spacerep 15@
            
    VK_X 0x58
    VK_Y 0x59
    VK_BACK 0x08    
    VK_RETURN 0x0D
    VK_LEFT 0x25
    VK_RIGHT 0x27
    
    enter_vehicle 15
    sprint 16
    
    cheat_string 0x969110
    gta_user_dir_path 0x00C92368
        
    strlen 0x00826330 
    strcmp 0x008263C0      
end                                                    

0ADF: add_dynamic_GXT_entry "TH_HMSG" text "Use ~y~ENTER~s~ para confirmar.~n~Delete tudo para cancelar." // help msg
0ADF: add_dynamic_GXT_entry "CTTPHDR" text "Custom Teleport"

0AA7: call_function strlen num_params 1 pop 1 gta_user_dir_path -> 0@
0@ += 15
0AC8: 25@ = malloc 0@
0AD3: 25@ = format "%s/coords.dat" gta_user_dir_path
    
while true
    0AA2: 12@ = load_library "kernel32.dll"
    0AA4: 13@ = get_proc_address "GetPrivateProfileStringA" library 12@
    
    for 0@ = 0 to 1
        0AC6: 1@ = label @Buffer offset
        2@ = File.Open(25@, "r")
        0A8E: 3@ = 1@ + 0xA0 // pLinebuffer
        
        if 0@ == 1
        then
            0AC8: 8@ = malloc 7@
            0085: 9@ = 8@
            0A8C: write_memory 8@ size 7@ value NULL virtual_protect 0
        end
        
        while File.ReadString(2@, 3@, 80)
            for 4@ = 0 to 30
                0A8D: 5@ = read_memory 3@ size 1 virtual_protect 0
                
                if 5@ == 0x3D
                then
                    0A8F: 6@ = 80 - 4@
                    0A8C: write_memory 3@ size 6@ value NULL virtual_protect 0   
                end
                
                3@++
            end
            
            0A8E: 3@ = 1@ + 0xA0 // pLinebuffer
            0AA5: call_function 13@ num_params 6 pop 0 25@ 48 1@ "REMOVED" 3@ "Cheats"
            0AA7: call strcmp num_params 2 pop 2 1@ "REMOVED" -> 19@
            
            if 19@ <> 0
            jf continue

            if 0@ == 0
            then
                7@ += 30
            else                   
                0AD3: 8@ = format "%s" 3@
                0085: 10@ = 8@
                8@ += 30                               
            end                                                          
        end
        
        File.Close(2@)
    end
               
    while true
        wait 0   
                 
        for 11@ = 9@ to 10@ step 30
            if 0ADC:   test_cheat 11@
            then
                0AA5: call_function 13@ num_params 6 pop 0 25@ 48 1@ "REMOVED" 11@ "Cheats"                
                0AA7: call strcmp num_params 2 pop 2 1@ "REMOVED" -> 19@
                
                if 19@ <> 0
                then
                    0AD4: 33@ = scan_string 1@ format "%f %f %f" 14@ 16@ 17@                    
                    0AB1: call_scm_func @Teleport 3 14@ 16@ 17@
                end
            end
        end   
    
        // save coords
        if 0ADC:   test_cheat "sPos"
        then
            0AB1: call_scm_func @Input 1 0 -> 2@ 3@
                   
            if 3@ > 0
            then
                0AA4: 1@ = get_proc_address "WritePrivateProfileStringA" library 12@ 

                Actor.StorePos($Player_Actor, 3@, 4@, 5@)
        
                2@ += 0x50 // pMainbuffer
                0A8E: 6@ = 2@ + 0x50 // pLinebuffer        
                0AD3: 6@ = format "%f %f %f" 3@ 4@ 5@
                0AA5: call 1@ num_params 4 pop 0 25@ 6@ 2@ "Cheats"  
                
                2@ -= 0x50
                0A8C: write_memory 2@ size 0xF0 value NULL virtual_protect 0 // clear buffers
                0A8C: write_memory cheat_string size 30 value NULL virtual_protect 0
                
                0ACD: show_text_highpriority "~g~As coordenadas foram salvas." time 2000                 
            else
                0ACD: show_text_highpriority "~r~Cancelado." time 2000
            end
            
            8AB0:   not key_pressed VK_RETURN           
            jf break                        
        end
        
        // remove coords
        if 0ADC:   test_cheat "rPos"
        then
            0AB1: call_scm_func @Input 1 1 -> 2@ 3@                
                      
            if 3@ > 0
            then
                2@ += 0x50 // pMainbuffer
                0A8E: 19@ = 2@ + 0x50 // pLinebuffer
                
                0AA5: call_function 13@ num_params 6 pop 0 25@ 48 19@ "REMOVED" 2@ "Cheats"
                0AA7: call strcmp num_params 2 pop 2 19@ "REMOVED" -> 26@
                
                0AA4: 1@ = get_proc_address "WritePrivateProfileStringA" library 12@
                
                if 26@ <> 0
                then
                    0AA5: call 1@ num_params 4 pop 0 25@ "REMOVED" 2@ "Cheats"
                    0ACD: show_text_highpriority "~g~As coordenadas foram removidas." time 2000
                else
                    0ACD: show_text_highpriority "~r~Nao ha coordenadas salvas com este nome." time 2000    
                end
                
                2@ -= 0x50
                0A8C: write_memory 2@ size 0xF0 value NULL virtual_protect 0 // clear buffers
                0A8C: write_memory cheat_string size 30 value NULL virtual_protect 0                                                    
            else
                0ACD: show_text_highpriority "~r~Cancelado." time 2000
            end
            
            if 8AB0:   not key_pressed VK_RETURN           
            jf break  
        end
        
        if 0ADC:   test_cheat "Coords"
        then
            if 003B: 8@ == 9@
            then 0ACD: show_text_highpriority "~r~Nao ha coordenadas salvas!" time 2000
            else 0AB1: call_scm_func @Menu 4 9@ 10@ 13@ 25@           
            end
        end
             
        if and
        0AB0:   key_pressed VK_X
        0AB0:   key_pressed VK_Y
        then
            if 0AB6: store_target_marker_coords_to 20@ 21@ 22@
            then
                0AB1: call_scm_func @Teleport 3 20@ 21@ -100.0
            else
                0ACD: show_text_highpriority "~r~O mapa nao esta marcado!" time 2000    
            end
        end
    end
end

:Menu
0512: show_permanent_text_box 'WARDH3' // menu help text
Player.CanMove(0, false)

08D4: 7@ = create_panel_with_title 'CTTPHDR' position 29.0 145.0 width 186.0 columns 1 interactive 1 background 1 alignment 1
0085: 6@ = 0@

0A8F: 26@ = 1@ - 0@
26@ /= 30
26@ /= 10
26@++

for 30@ = 1 to 26@
    0AD3: 4@s = format "TTLC%d" 30@
    0AD3: 8@v = format "Cheats %d/%d" 30@ 26@
    0ADF: add_dynamic_GXT_entry 4@s text 8@v
end

9@ = 1
            
repeat        
    for 30@ = 0 to 9
        0A90: 31@ = 30@ * 2
        
        if 001D: 0@ > 1@
        then
            10@(31@,1i) = 0x4D4D5544
            11@(31@,1i) = 0x59
        else
            10@(31@,1i) = 0x50545443
            
            0A8E: 4@ = 30@ + 0x30
            0085: 11@(31@,1i) = 4@
    
            0AD3: 4@s = format "CTTP%d" 30@
            0ADF: add_dynamic_GXT_entry 4@s text 0@    
        end
        
        0@ += 30        
    end
    
    0AD3: 30@s = format "TTLC%d" 9@
    08DB: set_panel 7@ column 0 header 30@s data 10@s 12@s 14@s 16@s 18@s 20@s 22@s 24@s 26@s 28@s 'DUMMY' 'DUMMY'
    
    repeat
        wait 0
        
        if 00E1:   player 0 pressed_key sprint
        then
            0@ -= 300
            
            08D7: 9@ = panel 7@ active_row
            9@ *= 30
            
            005A: 0@ += 9@

            0AC6: 8@ = label @Buffer offset
            0AA5: call_function 2@ num_params 6 pop 0 3@ 48 8@ "REMOVED" 0@ "Cheats"
            
            0AD4: 33@ = scan_string 8@ format "%f %f %f" 14@ 16@ 17@                    
            0AB1: call_scm_func @Teleport 3 14@ 16@ 17@

            jump @Back
        end
        
        if 0AB0:   key_pressed VK_LEFT
        then
            0A8E: 25@ = 6@ + 300

            if 001D: 0@ > 25@
            then
                0@ -= 600
                9@--
                090E: set_panel 7@ active_row 0
            else 0085: 0@ = 6@
            end
                        
            while 0AB0:   key_pressed VK_LEFT
                wait 0
            end
            
            break
        end
        
        if and
        0AB0:   key_pressed VK_RIGHT
        801D: 0@ <= 1@
        then
            9@++
            090E: set_panel 7@ active_row 0
            
            while 0AB0:   key_pressed VK_RIGHT
                wait 0
            end    
            
            break
        end
        
        0ACD: show_text_highpriority "Use ~<~ e ~>~ para navegar entre as paginas." time 200      
    until 00E1:   player 0 pressed_key enter_vehicle
until 00E1:   player 0 pressed_key enter_vehicle

:Back
08DA: remove_panel 7@
03E6: remove_text_box
Player.CanMove(0, true)

0AB2: ret 0

:Input
Player.CanMove(0, false)
0512: show_text_box "TH_HMSG"
               
0AC6: 1@ = label @Buffer offset // pTempbuffer
0A8E: 25@ = 1@ + 0x50 // pMainbuffer
0A8C: write_memory 1@ size 0xF0 value NULL virtual_protect 0 // clear buffers
                                      
repeat
    wait 0
    
    0A8D: 2@ = read_memory cheat_string size 1 virtual_protect 0
        
    if 0AB0:   key_pressed 2@
    then                          
        0AB1: call_scm_func @KeyWait 1 key 2@
        
        if 2@ == 0x20 
        then         
            2@ = 0xFF // spaces do hide the text on the screen
            spacerep = true
        end
               
        if 4@ < 29 // max_length
        then
            0A8C: write_memory 1@ size 1 value 2@ virtual_protect 0
            1@++
            
            if spacerep == true
            then
                0A8C: write_memory 25@ size 1 value 0x20 virtual_protect 0
                spacerep = false
            else
                0A8C: write_memory 25@ size 1 value 2@ virtual_protect 0                
            end
            
            25@++                
        end           
    end
    
    0AC6: 3@ = label @Buffer offset
    0AA7: call_function strlen num_params 1 pop 1 3@ -> 4@
    
    if 0AB0:   key_pressed VK_BACK
    then
        if 4@ > 0
        then
            1@--
            25@--
            0A8C: write_memory 1@ size 1 value NULL virtual_protect 0                
            0A8C: write_memory 25@ size 1 value NULL virtual_protect 0            
        else
            Player.CanMove(0, 1)
            03E6: remove_text_box        
            0AB2: ret 2 3@ 4@
        end    
    end
    
    0AB1: call_scm_func @KeyWait 1 key VK_BACK
    
    if 0@ == 0
    then 0AD1: show_formatted_text_highpriority "~g~Cheat: ~s~%s" time 250 3@
    else 0AD1: show_formatted_text_highpriority "~r~Remove: ~s~%s" time 250 3@
    end
until 0AB0:   key_pressed VK_RETURN

Player.CanMove(0, 1)
03E6: remove_text_box

0AB2: ret 2 3@ 4@

:Teleport
fade 0 200 
wait 250
                     
04E4: refresh_game_renderer_at 0@ 1@ 
Camera.SetAtPos(0@, 1@, 2@)
2@ -= 1.0                    
Actor.PutAt($Player_Actor, 0@, 1@, 2@)
Camera.SetBehindPlayer()
                    
fade 1 200
0AB2: ret 0

:KeyWait
while 0AB0:   key_pressed 0@
    wait 0
end
    
0AB2: ret 0

:Buffer
hex
// temp buffer
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// main buffer
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// line buffer
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
end

Custom Teleport (Criar comandos para se teletransportar)

Enviado: 04 Mai 2018, 10:39
por Mike
Parecido com alguns servidores do samp que você pode LV pra ir pra las venturas SF pra ir pra san fierro. Simplesmente perfeito.  😁

Re: Custom Teleport (Criar comandos para se teletransportar)

Enviado: 07 Set 2019, 13:28
por Israel
Atualizado
  • Mod recriado;
  • Adicionado menu com coordenadas salvas;
  • Alterado local do arquivo de dados para GTA User Files para melhor organização.

Re: Custom Teleport (Criar comandos para se teletransportar)

Enviado: 07 Set 2019, 13:48
por R4F43L
Muito bom