Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SPEEDOMETER CREATED BY Atom (Scott_Walker)
- // version 2.0
- // Copyright
- #include <a_samp>
- #define GasMax 100 // Kapacitet rezervoara
- #define RunOutTime 12000 // Tajmer goriva
- #define RefuelWait 8000 // Tajmer punjenja goriva
- #define CAR_AMOUNT 1000 // Kolicina vozila na serveru
- #define D_FuelStation 4564 // 4564 definira dijalog
- #define SCM SendClientMessage // kratica
- #define SCMTA SendClientMessageToAll // kratica
- #define GPN GetPlayerName // kratica
- #define SPD ShowPlayerDialog // kratica
- #define DSL DIALOG_STYLE_LIST // kratica
- #define DSI DIALOG_STYLE_INPUT // kratica
- #define DSM DIALOG_STYLE_MSGBOX // kratica
- #define COLOR_SPEEDOBLUE 0x0098FFFF // plava boja za snagu vozila
- #define COLOR_SPEEDOGREEN 0x32CD32FF // zelena boja za gorivo
- #define COLOR_RED 0xCC0000FF // crvena boja za TOTALKU
- ////////////////////////////////////////////////////////////////////////////////
- // Varijable
- ////////////////////////////////////////////////////////////////////////////////
- new Gas[CAR_AMOUNT];
- new Text: Atomspeedtankline[MAX_PLAYERS];
- new Text: Atomkmph[MAX_PLAYERS];
- new Text: Atomkmphs;
- new Text: Atomvehiclename[MAX_PLAYERS];
- new Text: Atompowerline[MAX_PLAYERS];
- new Text: Atompowerlines;
- new Text: Atompowerlinestext;
- new Text: Atomspeedtankstext;
- new Text: Atomspeedtank;
- new Text: Atombox;
- new FORTIMER;
- new Float:Velocity [3];
- new gGas[MAX_PLAYERS];
- new NoFuel[MAX_PLAYERS];
- new totaledveh[MAX_VEHICLES];
- new refueling[MAX_PLAYERS];
- new checkgastimer;
- new stoppedvehtimer;
- new FuelStation[MAX_PLAYERS];
- new MoneyForFuel[MAX_PLAYERS];
- new totaled[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"}
- };
- ////////////////////////////////////////////////////////////////////////////////
- // Forwardi
- ////////////////////////////////////////////////////////////////////////////////
- forward CheckGas(playerid);
- forward Fillup();
- forward AtomSpeedometer(playerid);
- forward IsAtGasStation(playerid);
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- ////////////////////////////////////////////////////////////////////////////////
- // Publici
- ////////////////////////////////////////////////////////////////////////////////
- public OnFilterScriptInit()
- {
- FORTIMER = SetTimer("AtomSpeedometer",400,1);
- checkgastimer = SetTimer("CheckGas", RunOutTime, 1);
- stoppedvehtimer = SetTimer("StoppedVehicle", RunOutTime, 1);
- SetTimer("Speed",1500,1);
- /////////////////////////////////////////////////////////////////
- // Textdrawi
- /////////////////////////////////////////////////////////////////
- Atombox = TextDrawCreate(558.000000,365,"_");
- 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);
- Atomspeedtankstext = TextDrawCreate(561.500000,365.000000,"gorivo");
- TextDrawBackgroundColor(Atomspeedtankstext, 255);
- TextDrawFont(Atomspeedtankstext, 3);
- TextDrawLetterSize(Atomspeedtankstext, 0.200000, 1.000000);
- TextDrawColor(Atomspeedtankstext, 0xFFFFFFFF);
- TextDrawSetOutline(Atomspeedtankstext, 1);
- Atompowerlinestext = TextDrawCreate(561.500000,385.000000,"snaga vozila");
- TextDrawBackgroundColor(Atompowerlinestext, 255);
- TextDrawFont(Atompowerlinestext, 3);
- TextDrawLetterSize(Atompowerlinestext, 0.200000, 1.000000);
- TextDrawColor(Atompowerlinestext, 0xFFFFFFFF);
- TextDrawSetOutline(Atompowerlinestext, 1);
- Atompowerlines = TextDrawCreate(559.500000,396.500000,"_");
- TextDrawUseBox(Atompowerlines,1);
- TextDrawBoxColor(Atompowerlines,0x000000ff);
- TextDrawTextSize(Atompowerlines,635.500000,1.000000);
- TextDrawAlignment(Atompowerlines,0);
- TextDrawBackgroundColor(Atompowerlines,0x000000ff);
- TextDrawFont(Atompowerlines,3);
- TextDrawLetterSize(Atompowerlines,0.199999,0.600000);
- TextDrawColor(Atompowerlines,0xffffffff);
- TextDrawSetOutline(Atompowerlines,1);
- Atomspeedtank = TextDrawCreate(559.500000,376.500000,"_");
- TextDrawUseBox(Atomspeedtank,1);
- TextDrawBoxColor(Atomspeedtank,0x000000ff);
- TextDrawTextSize(Atomspeedtank,635.500000,1.000000);
- TextDrawAlignment(Atomspeedtank,0);
- TextDrawBackgroundColor(Atomspeedtank,0x000000ff);
- TextDrawFont(Atomspeedtank,3);
- TextDrawLetterSize(Atomspeedtank,0.199999,0.600000);
- TextDrawColor(Atomspeedtank,0xffffffff);
- TextDrawSetOutline(Atomspeedtank,1);
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- Atompowerline[i] = TextDrawCreate(560.000000,397.500000,"_");
- 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.3);
- TextDrawColor(Atompowerline[i],0xffffffff);
- TextDrawSetOutline(Atompowerline[i],1);
- Atomspeedtankline[i] = TextDrawCreate(560.000000,377.50000,"_");
- TextDrawUseBox(Atomspeedtankline[i],1);
- TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
- TextDrawAlignment(Atomspeedtankline[i],0);
- TextDrawBackgroundColor(Atomspeedtankline[i],0x000000ff);
- TextDrawFont(Atomspeedtankline[i],3);
- TextDrawLetterSize(Atomspeedtankline[i],1.000000,0.3);
- TextDrawColor(Atomspeedtankline[i],0xffffffff);
- TextDrawSetOutline(Atomspeedtankline[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);
- }
- /////////////////////////////////////////////////////////////////////////////
- for(new v=0;v<CAR_AMOUNT;v++)
- {
- Gas[v] = GasMax;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(v,engine,lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, objective); // Samo je motor promjenjen u 1
- }
- print("\n--------------------------------------");
- print(" Speedometer by Atom ucitano");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- return 1;
- }
- public OnGameModeExit()
- {
- KillTimer(checkgastimer);
- KillTimer(stoppedvehtimer);
- KillTimer(FORTIMER);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- gGas[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/fill", cmdtext, true, 10))
- {
- new string[128];
- new engine, lights, alarm, doors, bonnet, boot, objective;
- if(IsPlayerConnected(playerid))
- {
- if(IsAtGasStation(playerid))
- {
- new vehicle = GetPlayerVehicleID(playerid);
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Bike(vehicle))
- {
- if(Gas[vehicle] <= 99)
- {
- MoneyForFuel[playerid] = GasMax - Gas[vehicle];
- format(string, sizeof(string),"{C9FFAB}Unesite cijenu za koju zelite napuniti vozilo.\nMaksimalna cijena za gorivo iznosi %d.", MoneyForFuel[playerid]);
- SPD(playerid,D_FuelStation,DSI,"Punjenje rezervoara",string,"Odaberi","Odustani");
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
- }
- else
- {
- GameTextForPlayer(playerid,"~g~~n~~n~~n~~n~~n~Rezervoar je pun.",3000,3);
- }
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"{C3C3C3}Niste na benzinskoj pumpi.");
- }
- }
- else SCM(playerid, -1, "{FFAF00}Komanda /napuni ne postoji.");
- return 1;
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new vehicle = GetPlayerVehicleID(playerid);
- new engine, lights, alarm, doors, bonnet, boot, objective;
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(newkeys == KEY_NO)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Bike(vehicle))
- {
- new Float: health;
- GetVehicleHealth(vehicle, health);
- GetVehicleParamsEx(vehicle,engine,lights, alarm, doors, bonnet, boot, objective);
- if(engine == 0)
- {
- if(health <= 350)
- {
- SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Nemozete upaliti vozilo jer je previse osteceno.");
- }
- else if(Gas[vehicle] < 3)
- {
- SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Nemozete upaliti vozilo jer je rezervoar prazan.");
- }
- else
- {
- SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Upalili ste motor vozila.");
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- else
- {
- SendClientMessage(playerid,-1,"{F3FF02}Obavijest{FFFFFF}: Ugasili ste motor vozila.");
- SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- }
- }
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new string[2048];
- new engine, lights, alarm, doors, bonnet, boot, objective;
- new vehicle = GetPlayerVehicleID(playerid);
- new money = GetPlayerMoney(playerid);
- switch(dialogid)
- {
- case D_FuelStation:
- {
- if(response)
- {
- MoneyForFuel[playerid] = GasMax - Gas[vehicle];
- if(strval(inputtext) > 0 && strval(inputtext) <= MoneyForFuel[playerid])
- {
- if(money > MoneyForFuel[playerid])
- {
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
- GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~Rezervoar se puni...",3000,3);
- SetTimer("Fillup",RefuelWait,0);
- refueling[playerid] = 1;
- FuelStation[playerid] = strval(inputtext);
- }
- else
- {
- format(string,sizeof(string),"{C9FFAB}Nemate dovoljno novca, treba vam %d$",MoneyForFuel[playerid]);
- SCM(playerid,-1,string);
- }
- }
- else
- {
- format(string, sizeof(string),"{C9FFAB}Unijeli ste preveliku cifru.\n\nUnesite cijenu za koju zelite napuniti vozilo.\nMaksimalna cijena za gorivo iznosi %d.", MoneyForFuel[playerid]);
- SPD(playerid,D_FuelStation,DSI,"Punjenje rezervoara",string,"Odaberi","Odustani");
- }
- }
- else
- {
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public Fillup()
- {
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- new string[128];
- new vehicle = GetPlayerVehicleID(i);
- if(refueling[i] == 1)
- {
- Gas[vehicle] += FuelStation[i];
- format(string,sizeof(string),"{C9FFAB}Vase vozilo je napunjeno sa gorivom, cijena: %d$",FuelStation[i]);
- SCM(i,-1,string);
- GivePlayerMoney(i, - FuelStation[i]);
- refueling[i] = 0;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- return 1;
- }
- public CheckGas(playerid)
- {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- new vehicle = GetPlayerVehicleID(i);
- if(GetPlayerState(i) == PLAYER_STATE_DRIVER && Bike(vehicle))
- {
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(engine == 1)
- {
- if(Gas[vehicle] >= 5)
- {
- if(Gas[vehicle] <= 13)
- {
- PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
- if(gGas[i] == 0)
- {
- GameTextForPlayer(i,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Rezerva",5000,3);
- }
- }
- Gas[vehicle]--;
- }
- else
- {
- NoFuel[i] = 1;
- SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective); // ONLY the engine param was changed (to 1)
- GameTextForPlayer(i,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Rezerva",1500,3);
- }
- }
- }
- }
- return 1;
- }
- public AtomSpeedometer(playerid)
- {
- for(new i=0; i<GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerInAnyVehicle(i))
- {
- new vehicle = GetPlayerVehicleID(i);
- if(GetPlayerState(i) == PLAYER_STATE_DRIVER && Bike(vehicle))
- {
- new Float: health;
- GetVehicleHealth(GetPlayerVehicleID(i), health);
- if(health <= 350)
- {
- if(IsPlayerAdmin(i))
- {
- TextDrawTextSize(Atompowerline[i],578.750000,0.000000);
- SetVehicleHealth(vehicle,1000);
- RepairVehicle(vehicle);
- }
- else
- {
- TextDrawTextSize(Atompowerline[i],578.750000,0.000000);
- GameTextForPlayer(i,"~w~pritisnite tipku~n~~r~F / enter~n~~w~da napustite vozilo~n~~n~~n~~n~~n~~n~~n~~r~TOTALKA",5000,3);
- SetVehicleHealth(vehicle,350);
- TextDrawBoxColor(Atompowerline[i],COLOR_RED);
- totaled[i] = 1;
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, objective); // ugasen motor
- totaledveh[vehicle] = 1;
- }
- }
- else if(health >= 1000)
- {
- TextDrawTextSize(Atompowerline[i],635.00000,0.000000);
- TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
- }
- else
- {
- TextDrawBoxColor(Atompowerline[i],COLOR_SPEEDOBLUE);
- TextDrawTextSize(Atompowerline[i],floatadd(560.0, floatdiv(health, 13.333333)),0.000000);
- }
- if(Gas[vehicle] <= 13)
- {
- TextDrawTextSize(Atomspeedtankline[i],560.000000,0.000000);
- TextDrawBoxColor(Atomspeedtankline[i],COLOR_RED);
- }
- else if(Gas[vehicle] >= 100)
- {
- TextDrawTextSize(Atomspeedtankline[i],635.00000,0.000000);
- TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
- }
- else
- {
- TextDrawTextSize(Atomspeedtankline[i],floatadd(560.0, floatdiv(Gas[vehicle], 1.3333333333)),0.000000);
- TextDrawBoxColor(Atomspeedtankline[i],COLOR_SPEEDOGREEN);
- }
- new velocityAtom[64],speed = GetSpeed(i);
- format(velocityAtom,64,"%d", speed);
- TextDrawSetString(Atomkmph[i], velocityAtom);
- new modelAtom[16];
- format(modelAtom,16,"%s", Vehicles[GetVehicleModel(GetPlayerVehicleID(i)) - 400]);
- TextDrawSetString(Atomvehiclename[i], modelAtom);
- TextDrawShowForPlayer(i, Atompowerline[i]);
- TextDrawShowForPlayer(i, Atompowerlines);
- TextDrawShowForPlayer(i, Atomkmph[i]);
- TextDrawShowForPlayer(i, Atomkmphs);
- TextDrawShowForPlayer(i, Atombox);
- TextDrawShowForPlayer(i, Atompowerlinestext);
- TextDrawShowForPlayer(i, Atomspeedtank);
- TextDrawShowForPlayer(i, Atomspeedtankstext);
- TextDrawShowForPlayer(i, Atomvehiclename[i]);
- TextDrawShowForPlayer(i, Atomspeedtankline[i]);
- }
- }
- else
- {
- TextDrawHideForPlayer(i, Atompowerline[i]);
- TextDrawHideForPlayer(i, Atompowerlines);
- TextDrawHideForPlayer(i, Atomkmph[i]);
- TextDrawHideForPlayer(i, Atomkmphs);
- TextDrawHideForPlayer(i, Atombox);
- TextDrawHideForPlayer(i, Atompowerlinestext);
- TextDrawHideForPlayer(i, Atomspeedtank);
- TextDrawHideForPlayer(i, Atomspeedtankstext);
- TextDrawHideForPlayer(i, Atomvehiclename[i]);
- TextDrawHideForPlayer(i, Atomspeedtankline[i]);
- }
- }
- }
- return 1;
- }
- public IsAtGasStation(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(PlayerToPoint(6.0,playerid,1004.0070,-939.3102,42.1797) || PlayerToPoint(6.0,playerid,1944.3260,-1772.9254,13.3906))
- {//LS
- return 1;
- }
- else if(PlayerToPoint(6.0,playerid,-90.5515,-1169.4578,2.4079) || PlayerToPoint(6.0,playerid,-1609.7958,-2718.2048,48.5391))
- {//LS
- return 1;
- }
- else if(PlayerToPoint(6.0,playerid,-2029.4968,156.4366,28.9498) || PlayerToPoint(8.0,playerid,-2408.7590,976.0934,45.4175))
- {//SF
- return 1;
- }
- else if(PlayerToPoint(5.0,playerid,-2243.9629,-2560.6477,31.8841) || PlayerToPoint(8.0,playerid,-1676.6323,414.0262,6.9484))
- {//Between LS and SF
- return 1;
- }
- else if(PlayerToPoint(6.0,playerid,2202.2349,2474.3494,10.5258) || PlayerToPoint(10.0,playerid,614.9333,1689.7418,6.6968))
- {//LV
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,-1328.8250,2677.2173,49.7665) || PlayerToPoint(6.0,playerid,70.3882,1218.6783,18.5165))
- {//LV
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,2113.7390,920.1079,10.5255) || PlayerToPoint(6.0,playerid,-1327.7218,2678.8723,50.0625))
- {//LV
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,656.4265,-559.8610,16.5015) || PlayerToPoint(6.0,playerid,656.3797,-570.4138,16.5015))
- {//Dillimore
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,125.2434463501, -1935.9764404297, 2.6310691833496) || PlayerToPoint(8.0,playerid,133.91174316406, -1941.7890625, 2.6310691833496))
- {//Pumpa za Helice
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,1004.1514892578, -936.96557617188, 47.211837768555))
- {//Pumpa za Helice
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,2638.9402345345, 1106.41373453456, 10.543724234534))
- {//LV
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,-1471.315834534, 1864.20734534538, 32.359456456649))
- {//LV
- return 1;
- }
- else if(PlayerToPoint(8.0,playerid,1593.8060574677, 2199.42504563487, 10.547347895345))
- {//LV
- return 1;
- }
- }
- return 0;
- }
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- stock Bike(veh)
- {
- new no[] = { 481,509,510 };
- for(new e = 0; e < sizeof(no); e++)
- {
- if(GetVehicleModel(veh) == no[e]) return 0;
- }
- return 1;
- }
- stock Auti(veh)
- {
- new car[] = { 400,401,402,404,405,409,410,411,412,413,414,415,416,418,419,420,421,422,426,429,436,438,439,440,442,445,451,458,459,466,467,470,474,475,477,479,480,482,483,489,490,491,492,494,495,496,498,499,500,502,503,504,505,506,507,516,517,518,526,527,529,533,534,535,536,540,541,542,543,545,546,547,549,550,551,552,554,555,558,559,560,561,562,565,566,567,575,576,579,580,582,585,587,589,596,597,598,599,600,602,603,604,605 };
- for(new e = 0; e < sizeof(car); e++)
- {
- if(GetVehicleModel(veh) == car[e]) return 0;
- }
- return 1;
- }
- stock Brodovi(veh)
- {
- new car[] = { 430,446,452,453,454,472,473,484,493,508,514,515,595 };
- for(new e = 0; e < sizeof(car); e++)
- {
- if(GetVehicleModel(veh) == car[e]) return 0;
- }
- return 1;
- }
- stock Motori(veh)
- {
- new car[] = { 448,461,462,463,468,471,521,522,523,528,531,532,568,571,581,586 };
- for(new e = 0; e < sizeof(car); e++)
- {
- if(GetVehicleModel(veh) == car[e]) return 0;
- }
- return 1;
- }
- stock Kamioni(veh)
- {
- new car[] = { 403,406,407,408,423,424,427,428,431,432,433,434,437,443,444,455,456,457,478,485,486,524,525,537,538,543,556,557,568,573,574,578,583,588,601,609 };
- for(new e = 0; e < sizeof(car); e++)
- {
- if(GetVehicleModel(veh) == car[e]) return 0;
- }
- return 1;
- }
- stock Letjelice(veh)
- {
- new car[] = { 417,425,447,460,469,476,487,488,497,511,512,513,519,520,548,553,563,577,592,593 };
- for(new e = 0; e < sizeof(car); e++)
- {
- if(GetVehicleModel(veh) == car[e]) return 0;
- }
- return 1;
- }
- stock GetSpeed (playerid, mod = 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 ] ) ) ) * ( !mod ? 105.0 : 170.0 ) ) ) * 1 ) : 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment