26.10.2013, 17:45
Well here i am with a filterscript.
This filterScript shows a Speedometer with ModelID, VehicleID, Speed, And Model Name.
NOTE: It can be toggled by a player with /speedo.
Screenshot:
Code:
This filterScript shows a Speedometer with ModelID, VehicleID, Speed, And Model Name.
NOTE: It can be toggled by a player with /speedo.
Screenshot:
Code:
pawn Код:
#include <a_samp>
// Comment these defines to get rid of that function
#define SHOW_NAME
#define SHOW_VEHID
#define SHOW_MODELID
#define SHOW_SPEED
forward SpeedCheck();
new bool:SpeedoToggle[MAX_PLAYERS];
new Float:CurPos[4];
new Float:OldPos[4];
new vModels[][] =
{
"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", "Stratum", "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"
};
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/speedo", false, 7) == 0)
{
if(SpeedoToggle[playerid] == false)
{
SpeedoToggle[playerid] = true;
SendClientMessage(playerid, 0xFFFF00FF, "Speedo toggled on.");
}
else
{
SpeedoToggle[playerid] = false;
SendClientMessage(playerid, 0xFFFF00FF, "Speedo toggled off.");
}
return 1;
}
return 0;
}
public OnFilterScriptInit()
{
SetTimer("SpeedCheck", 1000, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
SpeedoToggle[playerid] = true;
return 1;
}
public SpeedCheck()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if((IsPlayerInAnyVehicle(i)) && (SpeedoToggle[i] == true))
{
GetVehiclePos(GetPlayerVehicleID(i), CurPos[1], CurPos[2], CurPos[3]);
new Float:A = OldPos[1] - CurPos[1];
if(A < 0.0) A = -A;
new Float:B = OldPos[2] - CurPos[2];
if(B < 0.0) B = -B;
new Float:C = OldPos[3] - CurPos[3];
if(C < 0.0) C = -C;
new Float:Speed = A + B + C;
Speed *= 2;
new VehName[128];
format(VehName, sizeof(VehName), "~n~~n~~n~~n~~n~~n~~n~~n~");
#if defined SHOW_NAME
{
format(VehName, sizeof(VehName), "%s~y~Name: %s~n~", VehName, vModels[GetVehicleModel(GetPlayerVehicleID(i))-400]);
}
#else
{
format(VehName, sizeof(VehName), "~n~%s", VehName);
}
#endif
#if defined SHOW_VEHID
{
format(VehName, sizeof(VehName), "%s~g~Vehicle ID: %i~n~", VehName, GetPlayerVehicleID(i));
}
#else
{
format(VehName, sizeof(VehName), "~n~%s", VehName);
}
#endif
#if defined SHOW_MODELID
{
format(VehName, sizeof(VehName), "%s~r~Model ID: %i~n~", VehName, GetVehicleModel(GetPlayerVehicleID(i)));
}
#else
{
format(VehName, sizeof(VehName), "~n~%s", VehName);
}
#endif
#if defined SHOW_SPEED
{
format(VehName, sizeof(VehName), "%s~b~Speed: %0.0f~n~", VehName, Speed);
}
#else
{
format(VehName, sizeof(VehName), "~n~%s", VehName);
}
#endif
GameTextForPlayer(i, VehName, 1000, 3);
GetVehiclePos(GetPlayerVehicleID(i), OldPos[1], OldPos[2], OldPos[3]);
}
}
return 1;
}