22.03.2012, 22:20
тla pessoal , pesso a ajudar de vocкs pra colocar meu velocimetro no canto da tela como mostra o print !
codigo do velocimetro:
Queria ele no canto da tela onde mostra a imagen algune poderia me enviar o codigo ?
codigo do velocimetro:
pawn Код:
#include <a_samp>
#define SLOTS 200
#define URL "B S L"
new Text:box[MAX_PLAYERS],Text:CAR[MAX_PLAYERS],Text:veiculo[MAX_PLAYERS],Text:kmh[MAX_PLAYERS];
new Text:hoehe[MAX_PLAYERS],Text:estado[MAX_PLAYERS],Text:url[MAX_PLAYERS];
new SpeedoON[MAX_PLAYERS];
new Float:sVehicle_X[MAX_VEHICLES], Float:sVehicle_Y[MAX_VEHICLES], Float:sVehicle_Z[MAX_VEHICLES];
enum OldSpeedoPos
{
Float:sX,
Float:sY,
Float:sZ
}
new SavePlayerPos[SLOTS][OldSpeedoPos];
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 SpeedoUpdate();
public OnFilterScriptInit()
{
print("************************************");
print("* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *");
print("* Version 1 *");
print("* Creator: xxxxxxxxxxxx *");
print("* Script by xx.tk *");
print("************************************");
SetTimer("SpeedoUpdate", 1000, 1);
for(new v=0; v<MAX_VEHICLES; v++)
{
SaveLastPosition(v);
}
for(new i=0; i<SLOTS; i++)
{
box[i] = TextDrawCreate(198.000000,396.000000,"_");
TextDrawUseBox(box[i],1);
TextDrawBoxColor(box[i],0x00000066);
TextDrawTextSize(box[i],438.000000,0.000000);
TextDrawAlignment(box[i],0);
TextDrawBackgroundColor(box[i],0x00000033);
TextDrawFont(box[i],3);
TextDrawLetterSize(box[i],1.000000,3.000000);
TextDrawColor(box[i],0xffffffff);
TextDrawSetOutline(box[i],1);
TextDrawSetProportional(box[i],1);
TextDrawSetShadow(box[i],1);
veiculo[i] = TextDrawCreate(198.000000,396.000000," ");
TextDrawAlignment(veiculo[i],0);
TextDrawBackgroundColor(veiculo[i],0x000000ff);
TextDrawFont(veiculo[i],1);
TextDrawLetterSize(veiculo[i],0.299999,1.000000);
TextDrawColor(veiculo[i],0xffffffff);
TextDrawSetOutline(veiculo[i],1);
TextDrawSetProportional(veiculo[i],1);
TextDrawSetShadow(veiculo[i],1);
kmh[i] = TextDrawCreate(345.000000,396.000000," ");
TextDrawAlignment(kmh[i],0);
TextDrawBackgroundColor(kmh[i],0x000000ff);
TextDrawFont(kmh[i],1);
TextDrawLetterSize(kmh[i],0.299999,1.000000);
TextDrawColor(kmh[i],0xffffffff);
TextDrawSetOutline(kmh[i],1);
TextDrawSetProportional(kmh[i],1);
TextDrawSetShadow(kmh[i],1);
hoehe[i] = TextDrawCreate(199.000000,408.000000," ");
TextDrawAlignment(hoehe[i],0);
TextDrawBackgroundColor(hoehe[i],0x000000ff);
TextDrawFont(hoehe[i],1);
TextDrawLetterSize(hoehe[i],0.299999,1.000000);
TextDrawColor(hoehe[i],0xffffffff);
TextDrawSetOutline(hoehe[i],1);
TextDrawSetProportional(hoehe[i],1);
TextDrawSetShadow(hoehe[i],1);
estado[i] = TextDrawCreate(345.000000,408.000000," ");
TextDrawAlignment(estado[i],0);
TextDrawBackgroundColor(estado[i],0x000000ff);
TextDrawFont(estado[i],1);
TextDrawLetterSize(estado[i],0.299999,1.000000);
TextDrawColor(estado[i],0xffffffff);
TextDrawSetOutline(estado[i],1);
TextDrawSetProportional(estado[i],1);
TextDrawSetShadow(estado[i],1);
url[i] = TextDrawCreate(295.000000,415.000000,"URL");
TextDrawAlignment(url[i],0);
TextDrawBackgroundColor(url[i],0x000000ff);
TextDrawFont(url[i],0);
TextDrawLetterSize(url[i],0.22,1.000000);
TextDrawColor(url[i],0xffffffff);
TextDrawSetOutline(url[i],1);
TextDrawSetProportional(url[i],1);
TextDrawSetShadow(url[i],1);
}
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public SpeedoUpdate()
{
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:PlayerSpeedDistance,value;
new Float:Speedo_HP;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
GetPlayerVehicleID(i);
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(Speedo_X,SavePlayerPos[i][sX])),2)+floatpower(floatabs(floatsub(Speedo_Y,SavePlayerPos[i][sY])),2)+floatpower(floatabs(floatsub(Speedo_Z,SavePlayerPos[i][sZ])),2));
value = floatround(PlayerSpeedDistance * 5000);
new str1[256],str2[256],str3[256],str4[256];
if(SpeedoON[i] == 0)
{
TextDrawShowForPlayer(i, box[i]); TextDrawShowForPlayer(i, CAR[i]); TextDrawShowForPlayer(i, veiculo[i]); TextDrawShowForPlayer(i, kmh[i]);
TextDrawShowForPlayer(i, hoehe[i]); TextDrawShowForPlayer(i, estado[i]); TextDrawShowForPlayer(i, url[i]);
SpeedoON[i] = 1;
}
new kmh_anzahl = floatround(value/1600);
format(str1,sizeof(str1),"veiculo: ~y~%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(veiculo[i], str1);
if(kmh_anzahl >= 150)
{
format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 100)
{
format(str2,sizeof(str2),"KM/H: ~y~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 50)
{
format(str2,sizeof(str2),"KM/H: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else
{
format(str2,sizeof(str2),"KM/H: ~b~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
format(str3,sizeof(str3),"altitude: ~g~%.1f", Speedo_Z);
TextDrawSetString(hoehe[i], str3);
if(Speedo_HP >= 551)
{
format(str4,sizeof(str4),"estado: ~g~%.2f", Speedo_HP);
TextDrawSetString(estado[i], str4);
}
else if(Speedo_HP >= 361)
{
format(str4,sizeof(str4),"estado: ~y~%.2f", Speedo_HP);
TextDrawSetString(estado[i], str4);
}
else
{
format(str4,sizeof(str4),"estado: ~r~%.2f", Speedo_HP);
TextDrawSetString(estado[i], str4);
}
TextDrawSetString(url[i], URL);
}
SavePlayerPos[i][sX] = Speedo_X, SavePlayerPos[i][sY] = Speedo_Y, SavePlayerPos[i][sZ] = Speedo_Z;
}
for(new i=0; i<SLOTS; i++)
{
if(!IsPlayerInAnyVehicle(i))
{
TextDrawHideForPlayer(i, box[i]); TextDrawHideForPlayer(i, CAR[i]); TextDrawHideForPlayer(i, veiculo[i]); TextDrawHideForPlayer(i, kmh[i]);
TextDrawHideForPlayer(i, hoehe[i]); TextDrawHideForPlayer(i, estado[i]); TextDrawHideForPlayer(i, url[i]);
SpeedoON[i] = 0;
}
}
}
public OnVehicleSpawn(vehicleid)
{
SaveLastPosition(vehicleid);
return 1;
}
stock GetDistanceToLastPoint(vehicleid)
{
new Float:x2, Float:y2, Float:z2, Float:output;
GetVehiclePos(vehicleid, x2, y2, z2);
output = floatsqroot(floatpower(floatabs(floatsub(x2, sVehicle_X[vehicleid])), 2)+floatpower(floatabs(floatsub(y2, sVehicle_Y[vehicleid])), 2)+floatpower(floatabs(floatsub(z2, sVehicle_Z[vehicleid])), 2));
return floatround(output);
}
stock SaveLastPosition(vehicleid)
{
new Float:SaveCoord_X, Float:SaveCoord_Y, Float:SaveCoord_Z;
GetVehiclePos(vehicleid, SaveCoord_X, SaveCoord_Y, SaveCoord_Z);
sVehicle_X[vehicleid]=SaveCoord_X;
sVehicle_Y[vehicleid]=SaveCoord_Y;
sVehicle_Z[vehicleid]=SaveCoord_Z;
}