Quantcast

Jump to content

» «
Photo

[.NET] A Couple More Questions

1 reply to this topic
OfficerJohnson
  • OfficerJohnson

    Crackhead

  • Members
  • Joined: 07 Jan 2018
  • United-States

#1

Posted A week ago

Hello all. Getting right to it.

What I'd like answered:
1) Natives required to take control of another PED or entity
2) drawing the mouse cursor to the screen
3) Allowing the mouse to read input, such as clicks, while using a mod

Okay, so the for the first one, I've been looking at a script that allows you to take control of another Ped in the world. Unfortunately, it's very old and I don't think it works anymore. I want to know how I can do this and the natives involved so I can start tinkering with it.

Next, I've been playing around with a few scripts by Eddlm. Specifically advanced bodyguards and RTS Mode. I love how both of them give you access to click on stuff and do things. I'd really like to know how I can do this so once again I can start playing around with the concept. Again, this is allowing the mouse cursor to be visible and allowing its input (like mouse clicks) to be read by my script.

And for an added bonus, I'd like to know how this can be done in regards to raycasting. Thanks to everyone who replies. It helps tremendously.

Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#2

Posted 5 days ago

1. The first step is to clear all tasks: ped.Tasks.ClearAllImmediately();

2. Use this function: _SHOW_CURSOR_THIS_FRAME

3. Just check if the mouse has been clicked then get the mouse coords. This is how NativeUI gets the coords:

public static bool IsMouseInBounds(Point topLeft, Size boxSize)
{
	var res = GetScreenResolutionMaintainRatio();

	int mouseX = (int)Math.Round(Function.Call<float>(Hash.GET_CONTROL_NORMAL, 0, (int)Control.CursorX) * res.Width);
	int mouseY = (int)Math.Round(Function.Call<float>(Hash.GET_CONTROL_NORMAL, 0, (int)Control.CursorY) * res.Height);

	return (mouseX >= topLeft.X && mouseX <= topLeft.X + boxSize.Width) 
			&& (mouseY > topLeft.Y && mouseY < topLeft.Y + boxSize.Height);
}
  • nm710 and OfficerJohnson like this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users