Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SPEEDOMETER CREATED BY Atom (Scott_Atkins)
- // version 1.15
- // Copyright
- #include <a_samp>
- #define GasMax 100
- #define RunOutTime 30000
- #define RefuelWait 5000
- #define CAR_AMOUNT 700
- #define COLOR_SPEEDOBLUE 0x0098FFFF
- new Text:Atomspeedtanktext[MAX_PLAYERS];
- new Gas[CAR_AMOUNT];
- new Text: Atomkmph[MAX_PLAYERS];
- new Text: Atomkmphs;
- new Text: Atomvehiclename[MAX_PLAYERS];
- new Text: Atompowerline[MAX_PLAYERS];
- new Text: Atompowerlines;
- new Text: Atombox;
- forward UpdateSpeedo();
- forward CheckGas();
- forward Fillup();
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- forward AtomSpeedometer();
- forward IsABike(carid);
- new FORTIMER;
- new Float:Velocity [3];
- new gGas[MAX_PLAYERS];
- new NoFuel[MAX_PLAYERS];
- new Vehicles[212][]=
- {
- {"Landstalker"},
- {"Bravura"},
- {"Buffalo"},
- {"Linerunner"},
- {"Perrenial"},
- {"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"},
- {"Article Trailer"},
- {"Previon"},
- {"Coach"},
- {"Cabbie"},
- {"Stallion"},
- {"Rumpo"},
- {"RC Bandit"},
- {"Romero"},
- {"Packer"},
- {"Monster"},
- {"Admiral"},
- {"Squalo"},
- {"Seasparrow"},
- {"Pizzaboy"},
- {"Tram"},
- {"Article Trailer2"},
- {"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"},
- {"PD Maverick"},
- {"Boxville"},
- {"Benson"},
- {"Mesa"},
- {"RC Goblin"},
- {"Hotring Racer A"},
- {"Hotring Racer B"},
- {"Bloodring Banger"},
- {"Rancher"},
- {"Super GT"},
- {"Elegant"},
- {"Journey"},
- {"Bike"},
- {"MountainBike"},
- {"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 Flat"},
- {"Streak Carriage"},
- {"Kart"},{"Mower"},
- {"Dunerider"},
- {"Sweeper"},
- {"Broadway"},
- {"Tornado"},
- {"AT-400"},
- {"DFT-30"},
- {"Huntley"},
- {"Stafford"},
- {"BF-400"},
- {"Newsvan"},
- {"Tug"},
- {"Article Trailer 3"},
- {"Emperor"},
- {"Wayfarer"},
- {"Euros"},
- {"Mobile Hotdog"},
- {"Club"},
- {"Freight Carriage"},
- {"Trailer 3"},
- {"Andromada"},
- {"Dodo"},
- {"RC Cam"},
- {"Launch"},
- {"Police Car"},
- {"Police Car"},
- {"Police Car"},
- {"Police Ranger"},
- {"Picador"},
- {"SWAT Van"},
- {"Alpha"},
- {"Phoenix"},
- {"Glendale"},
- {"Sadler"},
- {"Luggage Trailer A"},
- {"Luggage Trailer B"},
- {"Stair Trailer"},
- {"Boxville"},
- {"Farm Plow"},
- {"Utility Trailer"}
- };
- public OnFilterScriptInit()
- {
- Atombox = TextDrawCreate(558.000000,375,"_");
- TextDrawLetterSize(Atombox,0.5,9.000000);
- TextDrawUseBox(Atombox,1);
- TextDrawBoxColor(Atombox,0x00000060);
- TextDrawTextSize(Atombox,650,450);
- Atomkmphs = TextDrawCreate(615.000000, 425.000000, "km/h");
- TextDrawBackgroundColor(Atomkmphs, 255);
- TextDrawFont(Atomkmphs, 3);
- TextDrawLetterSize(Atomkmphs, 0.200000, 1.000000);
- TextDrawColor(Atomkmphs, 0xFFFFFFFF);
- TextDrawSetOutline(Atomkmphs, 1);
- Atompowerlines = TextDrawCreate(559.500000,396.500000,"_");
- TextDrawUseBox(Atompowerlines,1);
- TextDrawBoxColor(Atompowerlines,0x000000ff);
- TextDrawTextSize(Atompowerlines,630.000000,1.000000);
- TextDrawAlignment(Atompowerlines,0);
- TextDrawBackgroundColor(Atompowerlines,0x000000ff);
- TextDrawFont(Atompowerlines,3);
- TextDrawLetterSize(Atompowerlines,0.199999,0.600000);
- TextDrawColor(Atompowerlines,0xffffffff);
- TextDrawSetOutline(Atompowerlines,1);
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- FORTIMER = SetTimer("AtomSpeedometer",300,1);
- Atompowerline[i] = TextDrawCreate(560.000000,397.000000,"_");
- TextDrawUseBox(Atompowerline[i],1);
- TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
- TextDrawAlignment(Atompowerline[i],0);
- TextDrawBackgroundColor(Atompowerline[i],0x000000ff);
- TextDrawFont(Atompowerline[i],3);
- TextDrawLetterSize(Atompowerline[i],1.000000,0.300000);
- TextDrawColor(Atompowerline[i],0xffffffff);
- TextDrawSetOutline(Atompowerline[i],1);
- Atomkmph[i] = TextDrawCreate(565.000000, 400.000000, "_");
- TextDrawBackgroundColor(Atomkmph[i], 255);
- TextDrawFont(Atomkmph[i], 3);
- TextDrawLetterSize(Atomkmph[i], 0.800000, 4.000000);
- TextDrawColor(Atomkmph[i], 0xFFFFFFFF);
- TextDrawSetOutline(Atomkmph[i], 1);
- Atomvehiclename[i] = TextDrawCreate(565.000000, 435.000000, "_");
- TextDrawBackgroundColor(Atomvehiclename[i], 255);
- TextDrawFont(Atomvehiclename[i], 2);
- TextDrawLetterSize(Atomvehiclename[i], 0.200000, 1.000000);
- TextDrawColor(Atomvehiclename[i], 0xFFFFFFFF);
- TextDrawSetOutline(Atomvehiclename[i], 1);
- Atomspeedtanktext[i] = TextDrawCreate(580.000000, 380.000000, "_");
- TextDrawBackgroundColor(Atomspeedtanktext[i], 255);
- TextDrawFont(Atomspeedtanktext[i], 3);
- TextDrawLetterSize(Atomspeedtanktext[i], 0.2500000, 1.000000);
- TextDrawColor(Atomspeedtanktext[i], 0xFFFFFFFF);
- TextDrawSetOutline(Atomspeedtanktext[i], 1);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- NoFuel[playerid] = 0;
- gGas[playerid] = 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- if(strcmp(cmd, "/exit", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(NoFuel[playerid] == 1)
- {
- TogglePlayerControllable(playerid, 1);
- RemovePlayerFromVehicle(playerid);
- NoFuel[playerid] = 0;
- }
- }
- return 1;
- }
- SendClientMessage(playerid, -1, "SERVER: Unknown command!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(FORTIMER);
- return 1;
- }
- public IsABike(carid)
- {
- if((carid >= 1 && carid <= 2)) // Unesi ID svojih bicikala
- {
- return 1;
- }
- return 0;
- }
- public AtomSpeedometer()
- {
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerInAnyVehicle(i))
- {
- new Float: health;
- new gasveh[16];
- new vehicle = GetPlayerVehicleID(i);
- GetVehicleHealth(GetPlayerVehicleID(i), health);
- if(health < 250)
- {
- TextDrawTextSize(Atompowerline[i],560.000000,0.000000); //gore
- }
- else if(health >= 1000)
- {
- TextDrawTextSize(Atompowerline[i],629.490000,0.000000); //69,49
- }
- else
- {
- TextDrawTextSize(Atompowerline[i],floatadd(560.0, floatdiv(health, 14.6000000)),0.000000);
- }
- if(Gas[vehicle] <= 1)
- {
- format(gasveh, sizeof(gasveh), "Prazno");
- TextDrawSetString(Atomspeedtanktext[i], gasveh);
- }
- else
- {
- format(gasveh, sizeof(gasveh), "%d%/100 L", Gas[vehicle]);
- TextDrawSetString(Atomspeedtanktext[i], gasveh);
- }
- TextDrawShowForPlayer(i, Atompowerline[i]);
- TextDrawShowForPlayer(i, Atompowerlines);
- TextDrawShowForPlayer(i, Atomkmph[i]);
- TextDrawShowForPlayer(i, Atomkmphs);
- TextDrawShowForPlayer(i, Atombox);
- TextDrawShowForPlayer(i, Atomvehiclename[i]);
- TextDrawShowForPlayer(i, Atomspeedtanktext[i]);
- }
- else
- {
- TextDrawHideForPlayer(i, Atompowerline[i]);
- TextDrawHideForPlayer(i, Atompowerlines);
- TextDrawHideForPlayer(i, Atomkmph[i]);
- TextDrawHideForPlayer(i, Atomkmphs);
- TextDrawHideForPlayer(i, Atombox);
- TextDrawHideForPlayer(i, Atomvehiclename[i]);
- TextDrawHideForPlayer(i, Atomspeedtanktext[i]);
- }
- }
- }
- }
- public OnPlayerUpdate(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new velocityAtom[64],speed = GetSpeed(playerid);
- format(velocityAtom,64,"%d", speed);
- TextDrawSetString(Atomkmph[playerid], velocityAtom);
- new modelAtom[16];
- format(modelAtom,16,"%s", Vehicles[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
- TextDrawSetString(Atomvehiclename[playerid], modelAtom);
- }
- return 1;
- }
- public CheckGas()
- {
- new string[256];
- for(new i = 0; i<MAX_PLAYERS; i++)
- {
- if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
- {
- new vehicle = GetPlayerVehicleID(i);
- if(Gas[vehicle] >= 1)
- {
- if(Gas[vehicle] <= 13)
- {
- PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
- if(gGas[i] == 0) {
- GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Spremnik goriva je skoro prazan",5000,3);
- }
- }
- if(gGas[i] == 1)
- {
- if(IsABike(vehicle))
- {
- format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~N/A");
- }
- else
- {
- format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~%d%/100 L",Gas[vehicle]);
- }
- GameTextForPlayer(i,string,20500,3);
- }
- Gas[vehicle]--;
- }
- else
- {
- NoFuel[i] = 1;
- TogglePlayerControllable(i, 0);
- GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Spremnik goriva je prazan",1500,3);
- }
- }
- }
- return 1;
- }
- stock GetSpeed ( playerid , mode = 1 )
- {
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment