Jump to content
gangrenn

"DRAW_COLOURED_CYLINDER" issues

Recommended Posts

Hey

 

This isn't LCPDFR API related, but more C# related.

 

I want to draw a coloured cylinder, and then when the player walks in, do things, but i have 2 problems:

1) the cylinder appear then disappear immediately.

2) even if the cylinder disappear, i try and walk where it's supposed to be, but nothing happens.

 

I do not have any errors, but everything after the part where i draw a coloured cylinder, do not work, after some research it came to my attention, that i have to add this native function into a loop in order for it, to works, but when i do that (in a while): my game freeze and crash ...

Here is a part of the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTA;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing;
using System.IO;
using System.Reflection;

double 1_x = -271.885, 1_y = 1542.18, 1_z = 20.4199;
GTA.Native.Function.Call("DRAW_COLOURED_CYLINDER", 1_x, 1_y, 1_z, -2, 0.80000000, 255, 0, 0, 0);

if (Player.Character.Position.DistanceTo(new Vector3(-271.885f, 1542.18f, 20.4199f)) < 1.0f)
                    {

                        user_choice = 1;
                        GTA.Native.Function.Call("FORCE_LOADING_SCREEN", true);
                        Wait(6000);
                        GTA.Native.Function.Call("CLEAR_AREA",1_x,1_y, 1_z, 50f);
                        GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", true);
                        spawn();
                        GTA.Native.Function.Call("FORCE_LOADING_SCREEN", false);
                        GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", false);
                        //do that and that
                    }

Thanks.

Share this post


Link to post
Share on other sites

Hello gangrenn,

 

you're right, you have to put it in a loop. However you mustn't use a while loop as that will never return and thus the game freezes (as you have experienced). You have to put it into your Tick function and call it every Tick in order to be visible. I'll see if I can add our class for the arrow to the API so you have an easy to use class which fires an event once the player is standing in the arrow and draws itself.

 

LMS


Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...