Resource icon

CLEO Release Police Detector 0.3.7

CLEO related
Status
Not open for further replies.

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
this mod will help you to know when some police car is near you so you can for example slow down if you drive fast on roleplay servers, its very useful for RP, it will also draw text on your player skin "Police is near" to help you react faster, on police cars it will show it distance from you 

here you can see https://s33.postimg.cc/46xs6sgv3/sa-mp-181.png

[attachment=5571]

type  /copdetect  for on&off
 

Attachments

  • Police Detector.cs
    19.8 KB · Views: 479

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
nice one, I made similar thing for skins (army/police), it had text drawing functions from mgfunctions plugin so it won't work but you could check it out if you planned to update this mod with skins/etc

[attachment=5582]

it has functions like this: 
0665: get_actor 0@ model_to 1@
if 0AB1: call_scm_func @police_skin_check 1 skin 1@
if 0AB1: call_scm_func @army_skin_check 1 skin 1@
 

Attachments

  • policeView.cs
    23 KB · Views: 85

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
monday said:
nice one, I made similar thing for skins (army/police), it had text drawing functions from mgfunctions plugin so it won't work but you could check it out if you planned to update this mod with skins/etc



it has functions like this: 
0665: get_actor 0@ model_to 1@
if 0AB1: call_scm_func @police_skin_check 1 skin 1@
if 0AB1: call_scm_func @army_skin_check 1 skin 1@

nice, i've already made something similar draw line to players with police skins 

Code:
    if 
    19@ == 1 
        then           
        for 31@ = 0 to 1000 /// samp max players             
            if 0B20: samp 30@ = actor_handle_by_samp_player_id 31@
                then   
                00A0: store_actor 30@ position_to 29@ 28@ 27@
                if 00C2:   sphere_onscreen 29@ 28@ 27@  radius 0.0
                    then
                    0B37: samp 12@ = get_player_color 31@
                    0665: get_actor 30@ model_to 13@
                    if or 
                    13@ == 280 
                    13@ == 306
                    13@ == 282
                    13@ == 283
                    13@ == 304
                    13@ == 285
                    13@ == 309
                    13@ == 265
                    then
                    Actor.StorePos($PLAYER_ACTOR, 26@, 25@, 24@)
                    0B55: convert_3D_coords 29@ 28@ 27@ to_screen 23@ 22@
                    0B55: convert_3D_coords 26@ 25@ 24@ to_screen 21@ 20@                                        
                    0B68: render draw_line_point1 23@ 22@ point2 21@ 20@ width 2 color 12@                                                                                        
                end   
            end
        end
    end 
end
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
this 1k loop would cause little little freezes / lag wouldnt it?
how about just use ForAll Peds by opcode.exe and samp.getplayeridbyactorhandle thing?
This would be better and you wont have to loop through 1k id's and works for streamed only..
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
0x32789 said:
this 1k loop would cause little little freezes / lag wouldnt it?
how about just use ForAll Peds by opcode.exe and samp.getplayeridbyactorhandle thing?
This would be better and you wont have to loop through 1k id's and works for streamed only..

but samp.getplayeridbyactorhandle is a 1k loop already... 
 

keek21

Active member
Joined
Feb 27, 2016
Messages
55
Reaction score
0
never seen anything like this before, but this is epic.

Now I can go to them and trying to pull them :x
 

Jayco

Active member
Joined
Feb 7, 2015
Messages
52
Reaction score
2
nice mod, usefull for rp server :lmao:
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
Garret said:
this is epic, alexa, play despacito

Code:
void renderPoliceDetector()
{

	traceLastFunc("renderPoliceDetector()");

	if (gta_menu_active())
		return;

	if (cheat_state->_generic.cheat_panic_enabled)
		return;

	// Exit this function and enable samp nametags, if panic key


	if (!g_dwSAMP_Addr || !g_SAMP || !g_Players)
		return;


	// don't run if the CGameSA doesn't exist
	if (!pGameInterface)
		return;

	// don't run if we don't exist
	if (isBadPtr_GTA_pPed(pPedSelf))
		return;

	for (int i = 0; i < SAMP_MAX_VEHICLES; i++)
	{
		actor_info * playerr = actor_info_get(ACTOR_SELF, NULL);
		vehicle_info *vehicle = getGTAVehicleFromSAMPVehicleID(i);

		if (!vehicle)
			continue;

		D3DXVECTOR3 vehicle_pos, player_pos, screenposs, vscreenposs;

		CVector mySpinePoss, Vec;

		CPed *pPedSelf = pGameInterface->GetPools()->GetPed((DWORD*)playerr);

		CVehicle *pVeh = pGameInterface->GetPools()->GetVehicle((DWORD*)vehicle);

		pPedSelf->GetBonePosition(BONE_SPINE1, &mySpinePoss);

		Vec.fX = vehicle->base.matrix[12];
		Vec.fY = vehicle->base.matrix[13];
		Vec.fZ = vehicle->base.matrix[14];

		float * f_pos = &playerr->base.matrix[4 * 3];
		player_pos.x = f_pos[0];
		player_pos.y = f_pos[1];
		player_pos.z = f_pos[2];
		CalcScreenCoors(&player_pos, &screenposs);

		float * f_poss = &vehicle->base.matrix[4 * 3];
		vehicle_pos.x = f_poss[0];
		vehicle_pos.y = f_poss[1];
		vehicle_pos.z = f_poss[2];
		CalcScreenCoors(&vehicle_pos, &vscreenposs);

		if (screenposs.z < 1.f)
			continue;

		if (vscreenposs.z < 1.f)
			continue;

		if (bPoliceDetector)
		{


			if (vehicle->base.model_alt_id == 597
				|| vehicle->base.model_alt_id == 526
				|| vehicle->base.model_alt_id == 598
				|| vehicle->base.model_alt_id == 599
				|| vehicle->base.model_alt_id == 601
				|| vehicle->base.model_alt_id == 528
				|| vehicle->base.model_alt_id == 523
				|| vehicle->base.model_alt_id == 497
				|| vehicle->base.model_alt_id == 427
				)
			{
				char szMsg[512];
				sprintf(szMsg, "Police Car %.0f m.", GetDistance(D3DXVECTOR3(vehicle_pos.x, vehicle_pos.y, vehicle_pos.z)));
				pD3DFont_sampStuff->PrintShadow(vscreenposs.x, vscreenposs.y - 20, COLOR_BLUE(255), szMsg);
				pD3DFont_sampStuff->PrintShadow(screenposs.x, screenposs.y - 20, COLOR_WHITE(255), "Police is Near");
				render->DrawLine(CVecToD3DXVEC(mySpinePoss), CVecToD3DXVEC(Vec), COLOR_BLUE_V2(255));
			}

		}

	}

}
 
Status
Not open for further replies.
Top