Jump to content
  • 0

Problema radar


MrAndrei

Question

Problema intalnita (descriere): Salut Am facut sistemul de "startradar" pentru departamentul LSPD, insa, cand trec pe langa un PD cu radar on nu se intampla nimic. 
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): 

CMD:startradar(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
		if(PlayerInfo[playerid][pMember] != 1) return SCM(playerid,COLOR_WHITE,"{FFB870}You are not a officer.");
		if(OnDuty[playerid] != 1) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}You are not on Duty.");
		new tmpcar = GetPlayerVehicleID(playerid),
			ccar = IsPlayerInAnyVehicle(playerid);
		if(ccar && IsACopCar(tmpcar) || ccar && IsANgCar(tmpcar) || ccar && IsAFbiCar(tmpcar))
		{
			if(Radaron[playerid] == 1) return SCM(playerid,COLOR_WHITE,"{FFB870}You have active radar.");
			new viteza,string[128];
			if(sscanf(params, "d",viteza)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Syntax: /startradar <Speed Limit>");
			if(viteza > 200 || viteza < 40) return SCM(playerid,COLOR_WHITE,"{FFB870}Invalid speed limit(200-40).");
			Radaron[playerid] = 1;
			Radarlimit[playerid] = viteza;
			TogglePlayerControllable(playerid, 0);
			format(string,sizeof(string),"{FFFF00}You have activated the radar, speed limit is: %d KM/H.",viteza);
			SCM(playerid,COLOR_WHITE,string);
			return 1;
		}
		else return SCM(playerid,COLOR_WHITE,"{FFB870}You are not in a cop car.");
	}
	return 1;
}
CMD:startradar(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
		if(PlayerInfo[playerid][pMember] != 1) return SCM(playerid,COLOR_WHITE,"{FFB870}You are not a officer.");
		if(OnDuty[playerid] != 1) return SendClientMessage(playerid,COLOR_WHITE, "{FFB870}You are not on Duty.");
		new tmpcar = GetPlayerVehicleID(playerid),
			ccar = IsPlayerInAnyVehicle(playerid);
		if(ccar && IsACopCar(tmpcar) || ccar && IsANgCar(tmpcar) || ccar && IsAFbiCar(tmpcar))
		{
			if(Radaron[playerid] == 1) return SCM(playerid,COLOR_WHITE,"{FFB870}You have active radar.");
			new viteza,string[128];
			if(sscanf(params, "d",viteza)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Syntax: /startradar <Speed Limit>");
			if(viteza > 200 || viteza < 40) return SCM(playerid,COLOR_WHITE,"{FFB870}Invalid speed limit(200-40).");
			Radaron[playerid] = 1;
			Radarlimit[playerid] = viteza;
			TogglePlayerControllable(playerid, 0);
			format(string,sizeof(string),"{FFFF00}You have activated the radar, speed limit is: %d KM/H.",viteza);
			SCM(playerid,COLOR_WHITE,string);
			return 1;
		}
		else return SCM(playerid,COLOR_WHITE,"{FFB870}You are not in a cop car.");
	}
	return 1;
}

 

 

public CustomPickups()
{
	new Float:oldposx, Float:oldposy, Float:oldposz;
	new string[564];
	foreach(Player,i)
	{
		GetPlayerPos(i, oldposx, oldposy, oldposz);
	    if(Radaron[i] == 1)
	    {
	        foreach(Player, o)
 			{
 			    if(IsPlayerInRangeOfPoint(o, 30.0, oldposx, oldposy, oldposz) && GetPlayerState(o) == PLAYER_STATE_DRIVER && OnDuty[o] == 0)
			    {
					new viteza = Carspeed(o);
				    if(viteza > Radarlimit[i])
			        {
				        new nameradar[25],nameradar1[25];
				        GetPlayerName(o,nameradar,sizeof(nameradar));
				        GetPlayerName(i,nameradar1,sizeof(nameradar1));
				        format(string, sizeof(string), "{f03337}%s[ID:%d] is driving with %d km/h, Location: %s, Radar Limit: %d km/h!", nameradar,o,viteza,GetPlayerZone(o),Radarlimit[i]);
						SCM(i,COLOR_WHITE,string);
						format(string, sizeof(string), "{f03337}You were caught by %s radar with %d km/h, Radar Limit: %d km/h.",nameradar1,viteza,Radarlimit[i]);
    					SCM(o,COLOR_WHITE,string);
    					return 1;
					}
				}
			}
		}
	}
	return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da,dar nu am reusit.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

 

stock Carspeed(playerid,mode = 1)
{
    new Float:Velocity [3];
    GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , Velocity [ 0 ] , Velocity [ 1 ] , Velocity [ 2 ] ) ;
    return IsPlayerInAnyVehicle ( playerid ) ? floatround ( ( ( floatsqroot ( ( ( Velocity [ 0 ] * Velocity [ 0 ] ) + ( Velocity [ 1 ] * Velocity [ 1 ] ) + ( Velocity [ 2 ] * Velocity [ 2 ] ) ) ) * ( !mode ? 105.0 : 170.0 ) ) ) * 1 ) : 0;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.