Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ||----------[Speedo^&Radar^]----------||
- //------------------------------------\\
- //-------- By BumbiS* ------------\\
- ||------------------------------------||
- */
- #include <a_samp>
- #include <float>
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define COLOR_YELLOW 0xDABB3EAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_GREEN 0x9EC73DAA
- #define COLOR_PURPLE 0xB370FCFF
- #define COLOR_GREY 0xAFAFAFAA
- ////////////////////////////////////////////////////////////////////
- new Speed[MAX_PLAYERS];
- new Text:Box[MAX_PLAYERS];
- new Text:Title[MAX_PLAYERS];
- new Text:Yellow1[MAX_PLAYERS];
- new Text:Vehicle[MAX_PLAYERS];
- new Text:Health[MAX_PLAYERS];
- new Text:Speedd[MAX_PLAYERS];
- new Text:Yellow2[MAX_PLAYERS];
- new SpeedoON[MAX_PLAYERS];
- new BigEar[MAX_PLAYERS];
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- forward ProxDetectorS(Float:radi, playerid, targetid);
- new VehicleNames[][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
- "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
- "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
- "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
- "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
- "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
- "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
- "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
- "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
- "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
- "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
- "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
- "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
- "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
- "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
- "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
- "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer"
- };
- forward Speedo();
- //----------------------------------------------------------------------------------------
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Speedo&Radar Filterscript by BumbiS* started!");
- print("--------------------------------------\n");
- SetTimer("Speedo", 180, 1);
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- Box[i] = TextDrawCreate(645.000000, 358.000000, "_");
- TextDrawBackgroundColor(Box[i], 255);
- TextDrawFont(Box[i], 1);
- TextDrawLetterSize(Box[i], 0.500000, 13.800002);
- TextDrawColor(Box[i], -1);
- TextDrawSetOutline(Box[i], 1);
- TextDrawSetProportional(Box[i], 1);
- TextDrawUseBox(Box[i], 1);
- TextDrawBoxColor(Box[i], 150);
- TextDrawTextSize(Box[i], 504.000000, 64.000000);
- Title[i] = TextDrawCreate(537.000000, 356.000000, "Speedometer");
- TextDrawBackgroundColor(Title[i], 255);
- TextDrawFont(Title[i], 1);
- TextDrawLetterSize(Title[i], 0.370000, 1.399999);
- TextDrawColor(Title[i], -1);
- TextDrawSetOutline(Title[i], 1);
- TextDrawSetProportional(Title[i], 1);
- Yellow1[i] = TextDrawCreate(698.000000, 370.000000, "_");
- TextDrawBackgroundColor(Yellow1[i], 255);
- TextDrawFont(Yellow1[i], 1);
- TextDrawLetterSize(Yellow1[i], 0.899999, 0.099999);
- TextDrawColor(Yellow1[i], -1);
- TextDrawSetOutline(Yellow1[i], 0);
- TextDrawSetProportional(Yellow1[i], 1);
- TextDrawSetShadow(Yellow1[i], 1);
- TextDrawUseBox(Yellow1[i], 1);
- TextDrawBoxColor(Yellow1[i], -65281);
- TextDrawTextSize(Yellow1[i], 504.000000, -1.000000);
- Vehicle[i] = TextDrawCreate(507.000000, 377.000000, " ");
- TextDrawBackgroundColor(Vehicle[i], 255);
- TextDrawFont(Vehicle[i], 1);
- TextDrawLetterSize(Vehicle[i], 0.329998, 1.200000);
- TextDrawColor(Vehicle[i], -1);
- TextDrawSetOutline(Vehicle[i], 1);
- TextDrawSetProportional(Vehicle[i], 1);
- Health[i] = TextDrawCreate(507.000000, 392.000000, " ");
- TextDrawBackgroundColor(Health[i], 255);
- TextDrawFont(Health[i], 1);
- TextDrawLetterSize(Health[i], 0.330000, 1.299999);
- TextDrawColor(Health[i], -1);
- TextDrawSetOutline(Health[i], 1);
- TextDrawSetProportional(Health[i], 1);
- Speedd[i] = TextDrawCreate(506.000000, 409.000000, " ");
- TextDrawBackgroundColor(Speedd[i], 255);
- TextDrawFont(Speedd[i], 1);
- TextDrawLetterSize(Speedd[i], 0.360000, 1.200000);
- TextDrawColor(Speedd[i], -1);
- TextDrawSetOutline(Speedd[i], 1);
- TextDrawSetProportional(Speedd[i], 1);
- Yellow2[i] = TextDrawCreate(628.000000, 358.000000, "_");
- TextDrawBackgroundColor(Yellow2[i], 255);
- TextDrawFont(Yellow2[i], 1);
- TextDrawLetterSize(Yellow2[i], 0.500000, 10.000000);
- TextDrawColor(Yellow2[i], -1);
- TextDrawSetOutline(Yellow2[i], 0);
- TextDrawSetProportional(Yellow2[i], 1);
- TextDrawSetShadow(Yellow2[i], 1);
- TextDrawUseBox(Yellow2[i], 1);
- TextDrawBoxColor(Yellow2[i], -65281);
- TextDrawTextSize(Yellow2[i], 619.000000, 12.000000);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- BigEar[playerid] = 0;
- return 1;
- }
- dcmd_radar(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerConnected(playerid))
- {
- new sendername[MAX_PLAYER_NAME];
- new giveplayer[MAX_PLAYER_NAME];
- new string[128];
- if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 288 || GetPlayerSkin(playerid) == 284)
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- sendername[strfind(sendername,"_")] = ' ';
- format(string, sizeof(string), "* %s takes out a speed radar and shoots it out.", sendername);
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SendClientMessage(playerid, COLOR_GREEN, "Nearest vehicles speed:");
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && i!=playerid)
- {
- if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
- {
- if (ProxDetectorS(30.0, playerid, i) && Speed[i] > 15)
- {
- GetPlayerName(i, giveplayer, sizeof(giveplayer));
- giveplayer[strfind(giveplayer,"_")] = ' ';
- format(string, sizeof(string), "Vehicle:%s Name:%s speed ~%dkm/h", VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400],giveplayer,Speed[i]);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- }
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "* You are not a cop!");
- return 1;
- }
- return 1;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(radar,5,cmdtext);
- return 0;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public Speedo()
- {
- new Float:Speedo_HP;
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- new vehicle = GetPlayerVehicleID(i);
- GetVehicleHealth(vehicle, Speedo_HP);
- new Float:X, Float:Y, Float:Z, Float:Sp;
- GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
- Sp = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0);
- Speed[i]=floatround(floatdiv(Sp, 0.75), floatround_floor);
- new str1[128],str2[128],str4[128];
- if(SpeedoON[i] == 0)
- {
- TextDrawShowForPlayer(i, Box[i]); TextDrawShowForPlayer(i, Title[i]); TextDrawShowForPlayer(i, Yellow1[i]); TextDrawShowForPlayer(i, Yellow2[i]);
- TextDrawShowForPlayer(i, Speedd[i]); TextDrawShowForPlayer(i, Vehicle[i]); TextDrawShowForPlayer(i, Health[i]);
- SpeedoON[i] = 1;
- }
- format(str1,sizeof(str1),"Vehicle: %s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
- TextDrawSetString(Vehicle[i], str1);
- format(str2,sizeof(str2),"Speed: %dmp/h",Speed[i]);
- TextDrawSetString(Speedd[i], str2);
- format(str4,sizeof(str4),"Health: %.2f", Speedo_HP);
- TextDrawSetString(Health[i], str4);
- }
- }
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(!IsPlayerInAnyVehicle(i))
- {
- TextDrawHideForPlayer(i, Box[i]); TextDrawHideForPlayer(i, Title[i]); TextDrawHideForPlayer(i, Yellow1[i]); TextDrawHideForPlayer(i, Health[i]);
- TextDrawHideForPlayer(i, Vehicle[i]); TextDrawHideForPlayer(i, Yellow2[i]); TextDrawHideForPlayer(i, Speedd[i]);
- SpeedoON[i] = 0;
- }
- }
- }
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- if(!BigEar[i])
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- }//not connected
- return 1;
- }
- public ProxDetectorS(Float:radi, playerid, targetid)
- {
- if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- GetPlayerPos(targetid, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement