#1 11-08-2010 09:52

Vance
Registered: 11-08-2010
Posts: 4

[Req|Help] Police Radar

I am new to CLEO scripting, but have known and used CLEO before. After searching and finding nothing, I have come to see if someone could help me with this. To the point...

I want to make a "Police Radar" with CLEO. The point of it would be to detect the Model ID of a police car within a 3 to 5 block radius. If one is found then a textdraw would show saying that a cruiser was near.

In my search thru Opcodes I found 056C which is "actor $PLAYER_ACTOR driving_police_car"
I don't know if that could be used to detect the car.
Also found 0186 which is the "create_marker_above_car" Opcode.

I couldn't find out how to detect a radius around the player though.

Of course proper respect and credits would be made if someone built the whole thing for me. I also don't mind if someone points me in the right direction to get this done.
Thank you in advance.

Offline

#2 11-08-2010 12:54

Sw[ee]t
From: Нижний Новгород
Registered: 16-02-2009
Posts: 686
Website

Re: [Req|Help] Police Radar

Hai thar!
That opcode what you found "056C" is checks "is player driving poilce vehicle?". This is not what you need.

actor.storepos($PLAYER_ACTOR, 0@, 1@, 2@)
actor.storepos($PLAYER_ACTOR, 2@, 3@, 4@)
0@ += 50.0
2@ -= 50.0
1@ += 25.0
3@ -= 25.0
0327: 4@ = get_random_car_with_model #COPCARLA in_rectangle_cornerA 0@ 1@ cornerB 2@ 3@
if
  4@ <> -1
then
if
  056E: car 4@ defined
then
// car is founded paste here textdraw opcodes to mark the car
...
end
end

This is just example of using 0327 opcode which finds a car in rectangle that you're set. Hope it helps! smile

Offline

#3 12-08-2010 01:34

Vance
Registered: 11-08-2010
Posts: 4

Re: [Req|Help] Police Radar

Thanks for the quick reply.

Here is what I got so far and it crashes on start up.

{$CLEO .cs}
//---------------MAIN------------------

:POLCAR
actor.storepos($PLAYER_ACTOR, 0@, 1@, 2@)
actor.storepos($PLAYER_ACTOR, 2@, 3@, 4@)
0@ += 50.0
2@ -= 50.0
1@ += 25.0
3@ -= 25.0
0327: 4@ = get_random_car_with_model #COPCARLA in_rectangle_cornerA 0@ 1@ cornerB 2@ 3@
if
  4@ <> -1
then
if
  056E: car 4@ defined
then
03E5: 4@ = show_text_box ‘POL_MPL’
end
end

I'm using the GXT hook for the text draw and the FXT is this

#  Format:
#  <GXT ENTRY><SPACE><TEXT>
#

POL_MPL !!ALERT!!

Mind helping me with this one?


-Edit-
Also I can't seem to find the .cs in the cleo folder after I compile.

Last edited by Vance (12-08-2010 01:37)

Offline

#4 12-08-2010 06:30

Sw[ee]t
From: Нижний Новгород
Registered: 16-02-2009
Posts: 686
Website

Re: [Req|Help] Police Radar

03E5 opcode is with one parametr, a string.

03E5: show_text_box 'POL_MPL'

Also, if you using non-standart name for you FXT file, use 054C opcode to set gxt file as default gxt-table.

054C: use_GXT_table 'your filename here'

Offline

#5 12-08-2010 08:32

Vance
Registered: 11-08-2010
Posts: 4

Re: [Req|Help] Police Radar

Everytime I compile 03E5 with one param. it will give an error that there is not enough params. but when I add the 4@ = it will compile.

Offline

#6 13-08-2010 15:31

Silent
Registered: 08-05-2010
Posts: 29

Re: [Req|Help] Police Radar

Sw[ee]t wrote:

Also, if you using non-standart name for you FXT file, use 054C opcode to set gxt file as default gxt-table.

054C: use_GXT_table 'your filename here'

No, it isn't requested for FXT's ;P

if
  4@ <> -1
then
if
  056E: car 4@ defined
then

Both checks in fact do the same action, so you can remove '4@ <> -1' smile

Offline

#7 14-08-2010 07:19

angeloelibz24
Registered: 18-06-2009
Posts: 22

Re: [Req|Help] Police Radar

I want to ask if it is also possible to have a police radar that can detect police peds as well.

Offline

#8 14-08-2010 09:26

Sw[ee]t
From: Нижний Новгород
Registered: 16-02-2009
Posts: 686
Website

Re: [Req|Help] Police Radar

SilentPL wrote:

Both checks in fact do the same action, so you can remove '4@ <> -1' smile

Its for reliability.

Offline

Board footer

Powered by FluxBB