14.10.2011, 12:58
eu criei um velocimetro ele buga quando o outro player entra
EX: o velo dele da conflito com o meu
como arrumar isso?
EX: o velo dele da conflito com o meu
como arrumar isso?
/*
Filterscript generated using Zamaroht's TextDraw Editor Version 1.0.
Designed for SA-MP 0.3a.
Time and Date: 2011-9-29 @ 19:44:2
Instructions:
1- Compile this file using the compiler provided with the sa-mp server package.
2- Copy the .amx file to the filterscripts directory.
3- Add the filterscripts in the server.cfg file (more info here:
https://sampwiki.blast.hk/wiki/Server.cf...3.02928649
4- Run the server!
Disclaimer:
You have full rights over this file. You can distribute it, modify it, and
change it as much as you want, without having to give any special credits.
*/
#include <a_samp>
static Float:poskm [3];
new veiculos[][] ={
"Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
"Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
"Taxi","Washington","Bobcat","Mr 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","ZR3 50","Walton","Regina","Comet","BMX",
"Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
"Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa",
"RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
"Journey","Bike","Mountain Bike","Beagle","Cropdust","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 A","Monster B","Uranus",
"Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
"Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
"BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
"Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
"Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
"Stair Trailer","Boxville","Farm Plow","Utility Trailer" };
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
new Text:Textdraw6;
new Text:Textdraw7;
new Text:Textdraw8;
new Text:Textdraw9;
new Text:Textdraw10;
new Text:Textdraw11;
new Text:Textdraw12;
new Text:Textdraw13;
public OnFilterScriptInit()
{
print("Textdraw file generated by");
print(" Zamaroht's textdraw editor was loaded.");
// Create the textdraws:
Textdraw0 = TextDrawCreate(145.000000, 373.000000, " ");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 3);
TextDrawLetterSize(Textdraw0, 0.270000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
Textdraw1 = TextDrawCreate(414.000000, 353.000000, "_");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.500000, 7.799995);
TextDrawColor(Textdraw1, 102);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
TextDrawUseBox(Textdraw1, 1);
TextDrawBoxColor(Textdraw1, 102);
TextDrawTextSize(Textdraw1, 141.000000, 0.000000);
Textdraw2 = TextDrawCreate(308.000000, 373.000000, " ");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 3);
TextDrawLetterSize(Textdraw2, 0.270000, 1.000000);
TextDrawColor(Textdraw2, -1);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
Textdraw3 = TextDrawCreate(180.000000, 354.000000, "~p~B~g~r~y~a~r~s~b~i~y~l ~r~A~p~M~b~D ~y~G~p~a~r~m~b~e~g~s ~r~R~p~P~b~G V0.1");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 3);
TextDrawLetterSize(Textdraw3, 0.409999, 1.000000);
TextDrawColor(Textdraw3, -1);
TextDrawSetOutline(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
Textdraw4 = TextDrawCreate(414.000000, 370.000000, "_");
TextDrawBackgroundColor(Textdraw4, 255);
TextDrawFont(Textdraw4, 1);
TextDrawLetterSize(Textdraw4, 1.279999, -0.200000);
TextDrawColor(Textdraw4, -1);
TextDrawSetOutline(Textdraw4, 0);
TextDrawSetProportional(Textdraw4, 1);
TextDrawSetShadow(Textdraw4, 1);
TextDrawUseBox(Textdraw4, 1);
TextDrawBoxColor(Textdraw4, 255);
TextDrawTextSize(Textdraw4, 141.000000, 0.000000);
Textdraw5 = TextDrawCreate(414.000000, 352.000000, "_");
TextDrawBackgroundColor(Textdraw5, 255);
TextDrawFont(Textdraw5, 1);
TextDrawLetterSize(Textdraw5, 1.279999, -0.300000);
TextDrawColor(Textdraw5, -1);
TextDrawSetOutline(Textdraw5, 0);
TextDrawSetProportional(Textdraw5, 1);
TextDrawSetShadow(Textdraw5, 1);
TextDrawUseBox(Textdraw5, 1);
TextDrawBoxColor(Textdraw5, 255);
TextDrawTextSize(Textdraw5, 141.000000, 0.000000);
Textdraw6 = TextDrawCreate(414.000000, 426.000000, "_");
TextDrawBackgroundColor(Textdraw6, 255);
TextDrawFont(Textdraw6, 1);
TextDrawLetterSize(Textdraw6, 1.279999, -0.300000);
TextDrawColor(Textdraw6, -1);
TextDrawSetOutline(Textdraw6, 0);
TextDrawSetProportional(Textdraw6, 1);
TextDrawSetShadow(Textdraw6, 1);
TextDrawUseBox(Textdraw6, 1);
TextDrawBoxColor(Textdraw6, 255);
TextDrawTextSize(Textdraw6, 141.000000, 0.000000);
Textdraw7 = TextDrawCreate(145.000000, 391.000000, " ");
TextDrawBackgroundColor(Textdraw7, 255);
TextDrawFont(Textdraw7, 3);
TextDrawLetterSize(Textdraw7, 0.270000, 1.000000);
TextDrawColor(Textdraw7, -1);
TextDrawSetOutline(Textdraw7, 1);
TextDrawSetProportional(Textdraw7, 1);
Textdraw8 = TextDrawCreate(293.000000, 406.000000, "~r~A~p~M~b~D");
TextDrawBackgroundColor(Textdraw8, 255);
TextDrawFont(Textdraw8, 0);
TextDrawLetterSize(Textdraw8, 0.609999, 1.399999);
TextDrawColor(Textdraw8, -1);
TextDrawSetOutline(Textdraw8, 1);
TextDrawSetProportional(Textdraw8, 1);
Textdraw9 = TextDrawCreate(233.000000, 408.000000, "~r~]");
TextDrawBackgroundColor(Textdraw9, 255);
TextDrawFont(Textdraw9, 0);
TextDrawLetterSize(Textdraw9, 0.500000, 1.000000);
TextDrawColor(Textdraw9, -1);
TextDrawSetOutline(Textdraw9, 1);
TextDrawSetProportional(Textdraw9, 1);
Textdraw10 = TextDrawCreate(145.000000, 409.000000, " ");
TextDrawBackgroundColor(Textdraw10, 255);
TextDrawFont(Textdraw10, 3);
TextDrawLetterSize(Textdraw10, 0.270000, 1.000000);
TextDrawColor(Textdraw10, -1);
TextDrawSetOutline(Textdraw10, 1);
TextDrawSetProportional(Textdraw10, 1);
Textdraw11 = TextDrawCreate(308.000000, 392.000000, " ");
TextDrawBackgroundColor(Textdraw11, 255);
TextDrawFont(Textdraw11, 3);
TextDrawLetterSize(Textdraw11, 0.270000, 1.000000);
TextDrawColor(Textdraw11, -1);
TextDrawSetOutline(Textdraw11, 1);
TextDrawSetProportional(Textdraw11, 1);
Textdraw12 = TextDrawCreate(267.000000, 378.000000, "~p~]");
TextDrawBackgroundColor(Textdraw12, 255);
TextDrawFont(Textdraw12, 0);
TextDrawLetterSize(Textdraw12, 0.500000, 1.000000);
TextDrawColor(Textdraw12, -1);
TextDrawSetOutline(Textdraw12, 1);
TextDrawSetProportional(Textdraw12, 1);
Textdraw13 = TextDrawCreate(352.000000, 408.000000, "~b~]");
TextDrawBackgroundColor(Textdraw13, 255);
TextDrawFont(Textdraw13, 0);
TextDrawLetterSize(Textdraw13, 0.500000, 1.000000);
TextDrawColor(Textdraw13, -1);
TextDrawSetOutline(Textdraw13, 1);
TextDrawSetProportional(Textdraw13, 1);
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);
TextDrawHideForAll(Textdraw1);
TextDrawDestroy(Textdraw1);
TextDrawHideForAll(Textdraw2);
TextDrawDestroy(Textdraw2);
TextDrawHideForAll(Textdraw3);
TextDrawDestroy(Textdraw3);
TextDrawHideForAll(Textdraw4);
TextDrawDestroy(Textdraw4);
TextDrawHideForAll(Textdraw5);
TextDrawDestroy(Textdraw5);
TextDrawHideForAll(Textdraw6);
TextDrawDestroy(Textdraw6);
TextDrawHideForAll(Textdraw7);
TextDrawDestroy(Textdraw7);
TextDrawHideForAll(Textdraw8);
TextDrawDestroy(Textdraw8);
TextDrawHideForAll(Textdraw9);
TextDrawDestroy(Textdraw9);
TextDrawHideForAll(Textdraw10);
TextDrawDestroy(Textdraw10);
TextDrawHideForAll(Textdraw11);
TextDrawDestroy(Textdraw11);
TextDrawHideForAll(Textdraw12);
TextDrawDestroy(Textdraw12);
TextDrawHideForAll(Textdraw13);
TextDrawDestroy(Textdraw13);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
Speed(playerid);
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw4);
TextDrawHideForPlayer(playerid, Textdraw5);
TextDrawHideForPlayer(playerid, Textdraw6);
TextDrawHideForPlayer(playerid, Textdraw7);
TextDrawHideForPlayer(playerid, Textdraw8);
TextDrawHideForPlayer(playerid, Textdraw9);
TextDrawHideForPlayer(playerid, Textdraw10);
TextDrawHideForPlayer(playerid, Textdraw11);
TextDrawHideForPlayer(playerid, Textdraw12);
TextDrawHideForPlayer(playerid, Textdraw13);
}
return 1;
}
Speed(playerid);
public Speed(playerid)
{
new MySpeed[48];
new MyCar[48];
new MyAltitude[48];
new MyGas[48];
new MyHealh[48];
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:Speedo_HP;
GetVehicleHealth(GetPlayerVehicleID(playerid), Speedo_HP);
GetPlayerPos(playerid, Speedo_X, Speedo_Y, Speedo_Z);
format(MySpeed,sizeof(MySpeed),"~>~~p~Velocidade~b~: ~b~%d ~y~km/h",GetSpeed(playerid));
format(MyCar,sizeof(MyCar),"~>~~p~Veiculo~b~: ~y~%s",veiculos[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
format(MyAltitude,sizeof(MyAltitude),"~>~~p~Altitude~b~: ~y~%.2f",Speedo_Z);
format(MyGas,sizeof(MyGas),"~>~~p~Gasolina~b~: ~y~100");
format(MyHealh,sizeof(MyHealh),"~>~~p~Lataria~b~: ~y~%.2f",Speedo_HP);
TextDrawSetString(Textdraw0, MySpeed);
TextDrawSetString(Textdraw2, MyCar);
TextDrawSetString(Textdraw7, MyAltitude);
TextDrawSetString(Textdraw11, MyGas);
TextDrawSetString(Textdraw10, MyHealh);
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw5);
TextDrawShowForPlayer(playerid, Textdraw6);
TextDrawShowForPlayer(playerid, Textdraw7);
TextDrawShowForPlayer(playerid, Textdraw8);
TextDrawShowForPlayer(playerid, Textdraw9);
TextDrawShowForPlayer(playerid, Textdraw10);
TextDrawShowForPlayer(playerid, Textdraw11);
TextDrawShowForPlayer(playerid, Textdraw12);
TextDrawShowForPlayer(playerid, Textdraw13);
SetTimerEx("Speed",1,0,"i",playerid);
}
stock
GetSpeed ( playerid , mode = 1 )
{
GetVehicleVelocity ( GetPlayerVehicleID ( playerid ) , poskm [ 0 ] , poskm [ 1 ] , poskm [ 2 ] ) ;
return IsPlayerInAnyVehicle ( playerid ) ? floatround ( ( ( floatsqroot ( ( ( poskm [ 0 ] * poskm [ 0 ] ) + ( poskm [ 1 ] * poskm [ 1 ] ) + ( poskm [ 2 ] * poskm [ 2 ] ) ) ) * ( !mode ? 105.0 : 170.0 ) ) ) * 1 ) : 0;
}
stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3;
return floatround(ST[3]);
}