Peršokti į turinį
  • ŽAIDIMAI
  • , ŽAIDIMAI
  • ŽAIDIMAI

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4264 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Recommended Posts

Sveiki, taigi bandau editinti spidometrą, uždėjau foną (boxus) ir man jų nerodo, ką daryt?

Visas scriptas apačioje, kas netaip?

#include <a_samp>

#undef MAX_PLAYERS
#define MAX_PLAYERS 200

new Text:speedo1[MAX_PLAYERS];
new Text:speedo2[MAX_PLAYERS];
new Text:speedo3[MAX_PLAYERS];
new Text:speedo4[MAX_PLAYERS];
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new CarFuel[MAX_VEHICLES]; //Holds the fuel for each vehicle.
new Float:PlayerPos[3][MAX_PLAYERS]; //Holds the player's last posistion.
new PlayerTotalDistance[MAX_PLAYERS]; //Total player distance for each section they drive. (To reduce the fuel)
//For messaging:
new GotFuelMessage[MAX_PLAYERS];
//This is stuff that you can change.
#define DEF_GAS			  (100) //Default gas level for the vehicles in the server when the filterscript is loaded. (DEFAULT: 100)
#define DISTANCE			 (250) //Distance in which FUEL_INCREMENT will be removed from the fuel (DEFAULT: 250)
#define FUEL_INCREMENT	   (1) //The value that will be removed from the fuel when DISTANCE is met. (DEFAULT: 1)
#define TEXT_DRAW_FONT	   (2) //Font for the text draw. It's recomended that you not change this. (DEFAULT: 2)
#define TEXT_DRAW_X_FACTOR   (0.4) // Font size X factor (DEFAULT: 0.4) (RECOMENDED NOT TO CHANGE)
#define TEXT_DRAW_Y_FACTOR   (0.8) // Font size Y factor (DEFAULT: 0.8) (RECOMENDED NOT TO CHANGE)
#define EXIT_VEHICLE_ON_NO_GAS  (true) // If the player should exit the vehicle when the fuel is 0, set this true.
#define WARNING				 (20) // Number at which to send a warning to the player. (DEFAULT: 20)
#define WARNING_LIMIT		   (10000) // Time to wait before sending another message about low fuel. (DEFAULT: 10000)
//Do not change anything past this point unless you are sure of what you are doing.
//Also, by doing this, you certify that you do not need help from Karagon.
//As he will not help you past this point.
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//The following array is a list of vehicle names.
new CarName[][] =
{
   "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",
   "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","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"
};
public OnFilterScriptInit()
{
print("\n Karagon's Speedometer and Fuel System ");
print("\n Use with Permission, please leave credits.");
print("\n \t---- Loaded ----");

for (new i = 0; i <MAX_VEHICLES; i++) {
 //Loop through all the vehicles and set their fuel levels at DEF_GAS
 CarFuel[i] = DEF_GAS;
}
for (new i = 0; i < MAX_PLAYERS; i++) {
 GotFuelMessage[i] = -1;
}

return 1;
}
public OnFilterScriptExit()
{
for ( new i = 0; i < MAX_PLAYERS; i++) {
 //Hide all the text draws for the players
    TextDrawHideForPlayer(i, speedo1[i]);
 TextDrawHideForPlayer(i, speedo2[i]);
 TextDrawHideForPlayer(i, speedo3[i]);
 TextDrawHideForPlayer(i, speedo4[i]);
 TextDrawHideForPlayer(i, Textdraw0);
 TextDrawHideForPlayer(i, Textdraw1);
 TextDrawHideForPlayer(i, Textdraw2);
 TextDrawDestroy(speedo1[i]);
 TextDrawDestroy(speedo2[i]);
  TextDrawDestroy(speedo3[i]);
 TextDrawDestroy(speedo4[i]);
 TextDrawDestroy(Textdraw0);
 TextDrawDestroy(Textdraw1);
 TextDrawDestroy(Textdraw2);
}
print("\n Karagon's Speedometer and Fuel System");
print("\n Unloading....");

return 1;
}
// #### Stocks ####
//Do not modify these.
//Gets the player's speed in KM/H
//Credits to whom who made it.
stock Float:GetPlayerSpeed(playerid, bool:Z = true) //km.h
{
   new Float:SpeedX, Float:SpeedY, Float:SpeedZ;
   new Float:Speed;
   if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), SpeedX, SpeedY, SpeedZ);
   else GetPlayerVelocity(playerid, SpeedX, SpeedY, SpeedZ);
   if(Z) Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatadd(floatpower(SpeedY, 2.0), floatpower(SpeedZ, 2.0))));
   else Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0)));
   Speed = floatround(Speed * 100 * 1.61);
   return Speed;
}
//Damage color - Gets the color of the damage percentage.
//Credits to Me
stock DamageColor(Float: h) {
new str[5];
if (h <= 30)
 format(str, sizeof(str), "r");
else if (h < 60)
 format(str, sizeof(str), "y");
else
 format(str, sizeof(str), "g");
return str;
}
//FuelColor - Gets the color of the fuel percentage
//Credits to me
stock FuelColor(vid) {
new str[5];
if (CarFuel[vid] <= 20)
 format(str, sizeof(str), "r");
else if (CarFuel[vid] < 40)
 format(str, sizeof(str), "y");
else
 format(str, sizeof(str), "g");
return str;
}
//Use of the distance formula, using 3D space.
//Credits to who made it.
stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
   return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) ;
}

// #### Public Functions ####
// Do not edit this stuff unless you know what you're doing.
// I won't help you edit it either.
//We'll call OnPlayerUpdate for this. We're only doing this because it's a small amount of code to process
//And shouldn't lag the server. If you have lag issues, you should transfer it to a global loop in the server.
//Preferably, a 1-1.5 second loop. This will give the best result.
public OnPlayerUpdate(playerid) {
if (IsPlayerInAnyVehicle(playerid)) {
 new Float:vh, Float:s;
 new vid = GetPlayerVehicleID(playerid);
 new h, string[80];
 GetVehicleHealth(vid, vh);
 h = floatround(vh) / 10;
 format(string, sizeof(string), "Bukle: ~%s~%d \%", DamageColor(h), h); //55 -> Orange, 30 -> Red
 TextDrawSetString(speedo2[playerid], string);
 s = GetPlayerSpeed(playerid);
 new ss = floatround(s);
 format(string, sizeof(string), "Greitis: ~g~%d km/h", ss);
 TextDrawSetString(speedo3[playerid], string);

 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 format(string, sizeof(string), "Kuras: ~%s~%d \%", FuelColor(vid), CarFuel[vid]);
 TextDrawSetString(speedo4[playerid], string);
 new distance = GetDistance(x, y, z, PlayerPos[0][playerid], PlayerPos[1][playerid], PlayerPos[2][playerid]);
 PlayerPos[0][playerid] = x;
 PlayerPos[1][playerid] = y;
 PlayerPos[2][playerid] = z;
 PlayerTotalDistance[playerid] += distance;
 if (PlayerTotalDistance[playerid] > DISTANCE) {
  CarFuel[vid] -= FUEL_INCREMENT;
  PlayerTotalDistance[playerid] = 0;
 }
 if (CarFuel[vid] < WARNING) {
  if ( (GetTickCount() - GotFuelMessage[playerid]) > WARNING_LIMIT) {
   GotFuelMessage[playerid] = GetTickCount();
   SendClientMessage(playerid, -1, "Jūsų automobilis turi mažą kuro kiekį. Gauk naują, jei turite!");
  }
 }
 if (CarFuel[vid] < 0) {
  #if defined EXIT_VEHICLE_ON_NO_GAS
  SendClientMessage(playerid, -1, "Baigėsi kuras!");
  RemovePlayerFromVehicle(playerid);
  #endif
 }
}
return 1;
}
// We will use OnPlayerStateChange to detect if the player is in a vehicle.
// Here, the text draw will be created and placed for the player.
public OnPlayerStateChange(playerid, newstate, oldstate) {
if ( (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) && oldstate == PLAYER_STATE_ONFOOT ) {
   Textdraw0 = TextDrawCreate(644.000000, 389.000000, "New Textdraw");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 5.899998);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 572661656);
TextDrawTextSize(Textdraw0, 465.000000, 0.000000);
Textdraw1 = TextDrawCreate(469.000000, 389.000000, "New Textdraw");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.000000, 5.899999);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
TextDrawUseBox(Textdraw1, 1);
TextDrawBoxColor(Textdraw1, 255);
TextDrawTextSize(Textdraw1, 464.000000, 0.000000);
Textdraw2 = TextDrawCreate(661.000000, 387.980010, "New Textdraw");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.500000, -0.199999);
TextDrawColor(Textdraw2, -1);
TextDrawSetOutline(Textdraw2, 0);
TextDrawSetProportional(Textdraw2, 1);
TextDrawSetShadow(Textdraw2, 1);
TextDrawUseBox(Textdraw2, 1);
TextDrawBoxColor(Textdraw2, 255);
TextDrawTextSize(Textdraw2, 464.000000, 0.000000);
 new str[50];
 new vid = GetPlayerVehicleID(playerid);
 format(str, sizeof(str), "Masina: ~g~%s", CarName[GetVehicleModel(vid)-400]);
 speedo1[playerid] = TextDrawCreate(478.000000, 391.000000, " ");
 TextDrawSetString(speedo1[playerid], str);
 TextDrawSetShadow(speedo1[playerid], false);
 TextDrawSetOutline(speedo1[playerid], 1);
 TextDrawLetterSize(speedo1[playerid], TEXT_DRAW_X_FACTOR, TEXT_DRAW_Y_FACTOR);
 TextDrawSetProportional(speedo1[playerid], 1);
 TextDrawFont(speedo1[playerid], TEXT_DRAW_FONT);
 TextDrawShowForPlayer(playerid, speedo1[playerid]);
 new Float:vh;
 GetVehicleHealth(vid, vh);
 new h = floatround(vh) / 10;
 format(str, sizeof(str), "Bukle: ~g~%d \%", h);
 speedo2[playerid] = TextDrawCreate(478.000000, 418.000000, " ");
 TextDrawSetString(speedo2[playerid], str);
 TextDrawSetShadow(speedo2[playerid], false);
 TextDrawSetOutline(speedo2[playerid], 1);
 TextDrawLetterSize(speedo2[playerid], TEXT_DRAW_X_FACTOR, TEXT_DRAW_Y_FACTOR);
 TextDrawSetProportional(speedo2[playerid], 1);
 TextDrawFont(speedo2[playerid], TEXT_DRAW_FONT);
 TextDrawShowForPlayer(playerid, speedo2[playerid]);

 new Float:s = GetPlayerSpeed(playerid);
 new ss = floatround(s);
 format(str, sizeof(str), "Greitis: ~%s~%d km/h", DamageColor(h), ss);
 speedo3[playerid] = TextDrawCreate(478.000000, 404.000000, " ");
 TextDrawSetString(speedo3[playerid], str);
 TextDrawSetShadow(speedo3[playerid], false);
 TextDrawSetOutline(speedo3[playerid], 1);
 TextDrawLetterSize(speedo3[playerid], TEXT_DRAW_X_FACTOR, TEXT_DRAW_Y_FACTOR);
 TextDrawSetProportional(speedo3[playerid], 1);
 TextDrawFont(speedo3[playerid], TEXT_DRAW_FONT);
 TextDrawShowForPlayer(playerid, speedo3[playerid]);
 format(str, sizeof(str), "Kuras: ~%s~%d \%", FuelColor(vid), CarFuel[vid]);
 speedo4[playerid] = TextDrawCreate(478.000000, 432.000000, " ");
 TextDrawSetString(speedo4[playerid], str);
 TextDrawSetShadow(speedo4[playerid], false);
 TextDrawSetOutline(speedo4[playerid], 1);
 TextDrawLetterSize(speedo4[playerid], TEXT_DRAW_X_FACTOR, TEXT_DRAW_Y_FACTOR);
 TextDrawSetProportional(speedo4[playerid], 1);
 TextDrawFont(speedo4[playerid], TEXT_DRAW_FONT);
 TextDrawShowForPlayer(playerid, speedo4[playerid]);
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 PlayerPos[0][playerid] = x;
 PlayerPos[1][playerid] = y;
 PlayerPos[2][playerid] = z;
}

if (newstate == PLAYER_STATE_ONFOOT && ( oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_ONFOOT ) ) {
 TextDrawHideForPlayer(playerid, speedo1[playerid]);
 TextDrawHideForPlayer(playerid, speedo2[playerid]);
 TextDrawHideForPlayer(playerid, speedo3[playerid]);
 TextDrawHideForPlayer(playerid, speedo4[playerid]);
 TextDrawHideForPlayer(playerid, Textdraw0);
 TextDrawHideForPlayer(playerid, Textdraw1);
 TextDrawHideForPlayer(playerid, Textdraw2);
}
return 1;
}
//Player command text
//If you wish to use this, DO NOT REMOVE THE FOLLOWING.
public OnPlayerCommandText(playerid, cmdtext[]) {
dcmd(speedocredits, 13, cmdtext);
return 0;
}
dcmd_speedocredits(playerid, params[]) {
#pragma unused params
SendClientMessage(playerid, -1, "*Speedo (c) 2012");
return 1;
}
public OnPlayerConnect(playerid) {
GotFuelMessage[playerid] = -1;
return 1;
}

  • ,

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4264 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Prisijungti prie diskusijos

Palikti atsakymą galite iš karto, o užsiregistruoti vėliau. Jeigu jau turite paskyrą mūsų forume, Prisijunkite.

Svečias
Atsakyti šioje temoje...

×   Įklijuotas tekstas turi teksto formatavimą.   Pašalinti teksto formatavimą

  Galimi tik 75 veidukai.

×   Nuoroda buvo automatiškai įterpta.   Įterpti nuorodą paprastai

×   Jūsų ankstesnis pranešimas buvo atkurtas.   Išvalyti redaktorių

×   Jūs negalite įkelti nuotraukas tiesiogiai.Įkelkite arba įdėkite nuotraukas iš URL.

  • Šiame puslapyje naršo:   0 nariai

    • Nėra registruotų narių peržiūrinčių šį forumą.

Skelbimai



×
×
  • Sukurti naują...