Скрипт Заправки для IV:MP (Fuel Script) - Скрипты для сервера IV:MP - Моды для серверов - GTA моды, сервера, скрипты, дополнения, патчи, фиксы. - GrandTheftAuto - IVMP, SAMP, моды, коды, трайнеры.
Главная Вход Регистрация
Приветствую Вас Заглянувший | RSS
 GTA моды, сервера, скрипты, дополнения, патчи, фиксы. 
Главная » Файлы » Моды для серверов » Скрипты для сервера IV:MP

Скрипт Заправки для IV:MP (Fuel Script)
15.08.2011, 16:58
Enjoy.

Code


/*
Simple Fuel System For IV-MP  
for ivmp beta 2 (changes timer for ivmp 1 T3 in script)
By c-middia
*/
//=============================================================================================//
const yellow = 0xFFFF00AA;
const red = 0xFF0000AA;
const orange = 0xFF7F00AA;
const green = 0x20AA20FF;
const MAX_GSTATIONS = 11;
local gas_can = array(getPlayerSlots(), 0);
local vinfo ={};
local gastime;
//=============================================================================================//
local gas_stations =
  [
  [0, 652.08, 766.0, 4.0],
  [1, 1454.0, 1712.0, 17.0],
  [2, 1128.0, 329.0, 30.0],
  [3, 1129.0, -358.0, 19.0],
  [4, 109.0, 1136.0, 15.0],
  [5, -480.0, -211.0, 7.0],
  [6, -1391.0, 29.0, 7.0],
  [7, -434.0, -20.0, 9.0],
  [8, 1771.0, 837.0, 16.0],
  [9, -1313.0, 1736.0, 28.0],
  [10, 774.0, 195.5, 6.0]
  ];
//=============================================================================================//
function onScriptInit()
{
  log("---------------------");
  log(SCRIPT_NAME + " loaded");
  log("---------------------");
  gastime = setTimer(fueldown, 500, -1);
  /*
  gastime = timer(fueldown, 500, -1);// T3
  */
  return 1;
}
addEvent("scriptInit", onScriptInit);
//=============================================================================================//
function onScriptExit()
  {  
  killTimer(gastime);
  /*
  gastime.kill();// T3
  */
  return 1;
  }
addEvent("scriptExit", onScriptExit);
//=============================================================================================//
function onVehicleCreate(vehicleid)
  {
  vinfo[vehicleid] <- {};
  vinfo[vehicleid].gastank <- 5000;
  return true;
  }
addEvent("vehicleCreate", onVehicleCreate);
//=============================================================================================//
function onVehicleDelete(vehicleid)
  {
  return 1;
  }
addEvent("vehicleDelete", onVehicleDelete);
//=============================================================================================//
function PlayerToPoint(playerid, radius, x, y, z)
  {
  local playerpos = getPlayerCoordinates(playerid);
  return isPointInBall(x, y, z, playerpos[0], playerpos[1], playerpos[2], radius);
  }  
//=============================================================================================//
function get_station(playerid)
  {
  for (local i = 0; i < MAX_GSTATIONS; i++)
  {
  if(PlayerToPoint(playerid,8.0,gas_stations[i][1],gas_stations[i][2],gas_stations[i][3]))
  {
  return i;
  }
  }
  return -1;
  }
//=============================================================================================//
function getSpeed(vehicleid)
  {
  local velo = getVehicleVelocity(vehicleid);
  return sqrt(pow(velo[0], 2) + pow(velo[1], 2) + pow(velo[2], 2))*5;
  }
//=============================================================================================//
function fueldown()
  {
  foreach(playerid, name in getPlayers())
  {
  if(getPlayerState(playerid) == 6)
  {
  local vehicleid = getPlayerVehicleId(playerid);
  local modelid = getVehicleModel(vehicleid);
  local vsname = getVehicleName(modelid);
  local vhealth = getVehicleHealth(vehicleid);
  local speed = getSpeed(vehicleid).tointeger();
  if(speed >= 1)
  {
  vinfo[vehicleid].gastank -= 1;
  }
  if(speed >= 75)
  {
  vinfo[vehicleid].gastank -= 1;
  }
  if(speed >= 150)
  {
  vinfo[vehicleid].gastank -= 1;
  }
  if(speed >= 225)
  {
  vinfo[vehicleid].gastank -= 1;
  }
  if(speed >= 275)
  {
  vinfo[vehicleid].gastank -= 1;
  }
  if(speed >= 300)
  {
  vinfo[vehicleid].gastank -= 1;
  }  
  if(vinfo[vehicleid].gastank < 1)
  {
  setVehicleVelocity(vehicleid, 0.0, 0.0, -1.0 );
  vinfo[vehicleid].gastank = 0;
  }
  if(speed >= 180)
  {
  displayPlayerInfoText(playerid, "~b~"+vsname+"~b~ Vehicle ID ~w~"+vehicleid+"~n~ ~p~ Speed ~r~"+speed+"~p~ KM/H ~n~ ~b~ Fuel ~w~"+vinfo[vehicleid].gastank/100+"~b~ percent", 500);
  }
  else if(speed <= 179)
  {
  displayPlayerInfoText(playerid, "~b~"+vsname+"~b~ Vehicle ID ~w~"+vehicleid+"~n~ ~b~ Speed ~w~"+speed+"~b~ KM/H ~n~ ~b~ Fuel ~w~"+vinfo[vehicleid].gastank/100+"~b~ percent", 500);
  }
  }  
  }
  return 1;  
  }
//=============================================================================================//
function onPlayerCommand(playerid, command)
  {
  local cmd = split(command, " ");
  if(cmd[0] == "/fillup" || cmd[0] == "/refuel")
  {
  if(isPlayerInAnyVehicle(playerid))
  {
  local vehicleid = getPlayerVehicleId(playerid);
  if(vinfo[vehicleid].gastank >= 10000) return sendPlayerMessage(playerid, "Vehicle Full", yellow, false);
  local stn = get_station(playerid);
  if(stn < 0) return sendPlayerMessage(playerid, "You are not at a gas station", yellow, false);
  local fuelamount = (10000 - vinfo[vehicleid].gastank);
  if(getPlayerMoney(playerid)<(fuelammount/100)) return sendPlayerMessage(playerid, "You need more money", yellow, false);
  vinfo[vehicleid].gastank += fuelamount;
  givePlayerMoney(playerid,-fuelamount/100).tointeger();
  sendPlayerMessage(playerid, "You bought "+fuelamount/100+" centiliters of petrol ", green, false);
  return 1;
  }
  else  
  {
  sendPlayerMessage(playerid, "You are not in a vehicle", orange, false);
  }
  return 1;
  }
  //---------------------------------------------------------------------------------------------//
  if(cmd[0] == "/checkcan")
  {
  sendPlayerMessage(playerid, "You have "+gas_can[playerid]/100+" centiliters of petrol in your can", green, false);
  return 1;
  }
  //---------------------------------------------------------------------------------------------//
  if(cmd[0] == "/fillcan")
  {
  local stn = get_station(playerid);
  if(stn < 0) return sendPlayerMessage(playerid, "You are not at a gas station", yellow, false);
  local fuelamount = (1500 - gas_can[playerid]);
  if(getPlayerMoney(playerid)<(fuelammount/100)) return sendPlayerMessage(playerid, "You need more money", yellow, false);
  gas_can[playerid]=fuelamount;
  givePlayerMoney(playerid,-fuelamount/100).tointeger();
  sendPlayerMessage(playerid, "You bought "+fuelamount/100+" centiliters of petrol", green, false);
  return 1;
  }
  //---------------------------------------------------------------------------------------------//
  if(cmd[0] == "/fuelcar")
  {
  if(isPlayerInAnyVehicle(playerid))
  {
  if(gas_can[playerid]==0) return sendPlayerMessage(playerid, "can is empty", red, false);
  local vehicleid = getPlayerVehicleId(playerid)
  if(vinfo[vehicleid].gastank >= 10000) return sendPlayerMessage(playerid, "Vehicle Full", yellow, false);
  local fuelamount=0;
  vinfo[vehicleid].gastank += gas_can[playerid];
  if(vinfo[vehicleid].gastank > 10000)
  {
  fuelamount = (vinfo[vehicleid].gastank) -10000;
  vinfo[vehicleid].gastank = 10000;
  }
  gas_can[playerid] = fuelamount;  
  sendPlayerMessage(playerid, "You have "+gas_can[playerid]/10+" centiliters of petrol left in your can", green, false);
  AtGas[playerid]= 0;
  return 1;
  }
  else  
  {
  sendPlayerMessage(playerid, "You are not in a vehicle", orange, false);
  }
  return 1;
  }
  return 0;
}
addEvent("playerCommand", onPlayerCommand);
//=============================================================================================//
   


Автор: c-middia
Хитрый интеллект нашего сайта установил: Вы не зарегистрированный пользователь!

Хотите скачать фаил зарегистрируйтесь, или войдите под своим логином.
Сайт поддерживает систему Unet.
Это означает, что вы можете использвовать любой профиль из системы UCOZ.

Добавь в закладки, а вдруг поможет )
Категория: Скрипты для сервера IV:MP | Добавил: Van | Просмотров: 2589 | Загрузок: 0 | Рейтинг: 5.0/4
Комментарии: 2
Теги материала: скприт ivmp

Дополнительный контент:
[13.09.2011] [Программы для GTA 4]
Microsoft Visual Studio 2008 Professional Russian ( 0)
[08.12.2010] [Программы для GTA 4]
Generate color gta 4 ( 0)
[18.03.2011] [GTA 1-4 Играть по интернету]
IVMP-0.1-T2-R2-Server-Win32 ( 0)
[21.09.2010] [Патчи для GTA 4]
Патч v. 1.0.3.1 для GTA IV ( 0)
[29.06.2010] [GTA 4 Моды Машины]
Автомобиль Bufallo для GTA 4 ( 3)


Всего комментариев: 2
0  
1 Zhenya1222   (11.09.2011 10:32) [Материал]
Фу фу фу, не качайте скрипт полная *у*н*.....

+1  
2 Van   (11.09.2011 14:48) [Материал]
Его качать и ненадо.
Можно изменить под себя.

Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Все, используемые на сайте торговые марки принадлежат их владельцам. [ Take-Two | RockStar ]
Внимание! Копирование материалов, без обратной ссылки запрещено. Если Вы являетесь правообладателем материала, попавшего на наш сайт и можете доказать это соответствующими документами, прочтите информацию для ПРАВООБЛАДАТЕЛЕЙ, а также сообщите об этом администрации сайта.
Design by VanGog | Copyright GTA4ODUA.at.ua © 2010-2024|Создать бесплатный сайт с uCozHASH(0x3547488)