Log in to reply
 

[TUTORIAL | C#.NET] Interaction Markers [w/ Teleport, Ring Marker, DisplayName & Blips]



  • So i made a little script only with teleports that i wanted, just to fill in a little my SPgame, so i just wanted to share the code i used, so more of you can customize your gta to your own way, this can easily be adapted to restore life, give money, etc, u only need to replace the teleport command for wahttever u waaaanttt ! have fun.
    alt text

      //so first we will create 2 Vectors for our teleports
    
     /* This is located in Franklins Rich House, on the right door of the garage ,
      go inside, you will find it at your left   */
      Vector3 marker1 = new Vector3(29.0000f, 538.6783f, 175f); 
     
       /* This is located at Groove Street facing the end of the street,
      it is at your right, in front of some garage door*/
      Vector3 marker2 = new Vector3(47.8523f, -1912.992f, 20.8000f);
    
     /*then we create some blips for our Teleports*/
        Blip bl = World.CreateBlip(marker1, 3f);
        bl.Color = BlipColor.Green;
        bl.Name = "Teleport to: Groove Street";
    
        Blip bl2 = World.CreateBlip(marker2, 3f);
        bl2.Color = BlipColor.Green;
        bl2.Name = "Teleport to: Franklins House";
    

    #/ on your OnTickEvent /#

    Tick += (o, e) =>
        {
           if (playerPed.IsAlive && playerPed.IsVisible && !playerPed.IsDead)
            {
                 //Draw the Yellow Ring Marker with Name at Groove Street
                World.DrawMarker(MarkerType.VerticalCylinder, marker2, Vector3.Zero, Vector3.Zero, new Vector3(1f, 1f, 2f), Color.Yellow);
                //Draw the 3D DisplayName for this marker
                 var tmpSFs = new Scaleform("PLAYER_NAME_02");
                 tmpSFs.CallFunction("SET_PLAYER_NAME", "Casa do Franklin");
                 tmpSFs.Render3D(marker2 + new Vector3(0f, 0f, 2f), new Vector3(1f, -141f, 1f), new Vector3(12, 6, 2));
    
                //Draw the Yellow Ring Marker at Franklins House
                 World.DrawMarker(MarkerType.VerticalCylinder, marker1, Vector3.Zero, Vector3.Zero, new Vector3(1f, 1f, 2f), Color.Yellow);
                 //Draw the 3D DisplayName for this marker
                 var tmpSF = new Scaleform("PLAYER_NAME_01");
                 tmpSF.CallFunction("SET_PLAYER_NAME", "Groove Street");
                 tmpSF.Render3D(marker1 + new Vector3(0f, 0f, 2f), new Vector3(1f, 66f, 1f), new Vector3(12, 6, 2));
              }
        }
    

    #/ Interaction with Marker in OnTickEvent for Controller/#

        /*if the player ped is in range of marker1 location display tooltip and waits for keyinput*/
        if (World.GetDistance(playerPed.Position, marker1) < 1.5000f)
                {
                    toolTip("Pressione ~INPUT_DETONATE~ para ir para 'Groove Street'");
                  
                        if (Game.IsControlPressed(2, GTA.Control.FrontendLeft))
                        {
                          try
                           {
                            //teleport to location
                             playerPed.Position = marker2 + new Vector3(1.5f, 1.5f, 0f);
                            }
                            catch { UI.Notify("ERRO! H"); }
                        }
                }
               
        /*if the player ped is in range of marker2 location display tooltip and waits for keyinput*/
                if (World.GetDistance(playerPed.Position, marker2) < 1.5000f)
                {
                    toolTip("Pressione ~INPUT_DETONATE~ para ir para 'Casa do Franklin'");
                      
                        if (Game.IsControlPressed(2, GTA.Control.FrontendLeft))
                        {
                            try
                            {
                               //teleport to location
                                playerPed.Position = marker1 - new Vector3(1.5f, 1.5f, 0f);
                             }
                                catch { UI.Notify("ERRO! H"); }
                          }
                 }
    

    #/ Interaction with Marker in OnKeyDown for KeyBoard/#

        /*if the player ped is in range of marker1 location display tooltip and waits for keyinput*/
        if (World.GetDistance(playerPed.Position, marker1) < 1.5000f)
                {
                    toolTip("Pressione ~INPUT_DETONATE~ para ir para 'Groove Street'");
                  
                        if (e.KeyCode == Keys.Z)
                        {
                          try
                           {
                            //teleport to location
                             playerPed.Position = marker2 + new Vector3(1.5f, 1.5f, 0f);
                            }
                            catch { UI.Notify("ERRO! H"); }
                        }
                }
               
        /*if the player ped is in range of marker2 location display tooltip and waits for keyinput*/
                if (World.GetDistance(playerPed.Position, marker2) < 1.5000f)
                {
                    toolTip("Pressione ~INPUT_DETONATE~ para ir para 'Casa do Franklin'");
                      
                        if (e.KeyCode == Keys.Z)
                        {
                            try
                            {
                               //teleport to location
                                playerPed.Position = marker1 - new Vector3(1.5f, 1.5f, 0f);
                             }
                                catch { UI.Notify("ERRO! H"); }
                          }
                 }          
    

    #/ for ToolTip // OPTIONAL/#

    void toolTip(string text)
    {
        Function.Call(Hash._SET_TEXT_COMPONENT_FORMAT, "STRING");
        Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, text);
        Function.Call(Hash._0x238FFE5C7B0498A6, 0, 0, 1, -1);
    }


  • Is there a way to remove the Markers?


  • MODERATOR

    @Reazer Just don't call them when you don't want them to appear.

    if(showMarkers == true)
    {
    World.DrawMarker(......)
    }
    

    When the showMarkers bool is not true, the markers will not be drawn.



  • Can someone explain to me how the code builds up, since it's kinda confusing to me at least, as I am quite new to this. If Anyone can that is?



  • This post is deleted!

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.