Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


  Show Posts
Pages: 1 2 3 [4]
46  Scripting / Script Releases / New LU Fuel Speedo Script on: October 06, 2012, 10:03:06 am
Download:http://dl.dropbox.com/u/15204202/New%20LU%20Fuel%20Speedo%20Script.rar
This script contains functions (fuel, speedometer)

screenshot

http://cs406930.userapi.com/v406930382/2d83/YjrONIfxPE4.jpg
47  Scripting / Script Releases / LUFuel Script on: October 02, 2012, 08:19:16 am
LUF.nut
/*
     Liberty Unleashed Fuel Script - Server
    Version 1.0 
    by [MKs]X_94
*/   

//---  Data  ---

const Price_Per_Liter = 20;
const Max_Gas = 50;
const Min_Gas = 10;
const Rand_Gas = 20;
const FSphereRadius = 5.0;
local fuel = array( MAX_VEHICLES   1, 0 );
local Dispatchers = array( MAX_SPHERES   1, null );
BLUE <- ::Colour( 0, 0, 255 );
ORANGE <- ::Colour( 255, 153, 0 );
LBLUE <- ::Colour( 51, 51, 153 );
GREEN <- ::Colour( 0, 255, 0 );
RED <- ::Colour( 255, 0, 0 );
SKYBLUE <- ::Colour( 0, 102, 255 );
PURPLE <- ::Colour( 204, 0, 204 );
iCPURPLE <- ::Colour( 100, 20, 255 );

//--- Script Events ---

function onScriptLoad()
{
    for ( local i = 0; i <= MAX_VEHICLES; i   ) fuel[ i ] = Random( Min_Gas, Rand_Gas );
    Dispatchers[ 0 ] = CreateDispatcher( 0, Vector( 1155.50, -74.10, 7.47 ) );
    Dispatchers[ 1 ] = CreateDispatcher( 1, Vector( 1163.50, -74.31, 7.47 ) );
    Dispatchers[ 2 ] = CreateDispatcher( 2, Vector( 1171.50, -74.40, 7.47 ) );   
   NewTimer( "FuelProcess", 60000, 0 );
   print( "LU Fuel Script Loaded" );
   return 1;   
}

function onPlayerEnterSphere( player, Sph )
{
    local Dispatcher = FindDispatcher( Sph.ID );
   if ( Dispatcher )
   {
       if ( !Dispatcher.Player || Dispatcher.Player == player.Name )
       {
          if ( FindPlayerDispatcher( player ) ) MessagePlayer( "You are using other dispatcher yet", player, RED );
         else
         {
              Dispatcher.Player = player;
             CallClientFunc( player, "LU-FS/LUFC.nut", "CreateMenu" );
         }   
      }
      else MessagePlayer( "Sorry, this fuel dispatcher is being using, go to other dispatcher or fuel station", player, RED );
   }
    return 1;
}

function onPlayerExitSphere( player, Sph )
{
    local Dispatcher = FindDispatcher( Sph.ID );
   if ( Dispatcher )
   {
       if ( Dispatcher.Player )
       {
          Dispatcher.Player = null;
            CallClientFunc( player, "LU-FS/LUFC.nut", "DeleteMenu" );         
      }
   }
   return 1;
}   

function onVehicleRespawn( vehicle )
{
    fuel[ vehicle.ID ] = Random( Min_Gas, Rand_Gas );
    return 1;
}

function onPlayerEnteredVehicle( player, vehicle, door )
{
    if ( fuel[ vehicle.ID ] <= 0 )
    {
        CallClientFunc( player, "LU-FS/LUFC.nut", "DisplayFuelMeter", "EMPTY" );
        vehicle.SetEngineState( false );
        fuel[ vehicle.ID ] = 0;
    }
   else
   {
      CallClientFunc( player, "LU-FS/LUFC.nut", "DisplayFuelMeter", fuel[ vehicle.ID ] );
   }   
   
    return 1;
}

function FindPlayerDispatcher( plr )
{
    for ( local i = 0; i <= MAX_SPHERES; i   )
   {
       local D = FindDispatcher( i );
       if ( D && D.Player == plr.Name ) { return true; break; }
   }
   return false;
}

//---- Script Functions ----

function FuelProcess()
{
    for ( local i = 0; i <= MAX_PLAYERS; i   )
    {
        local player = FindPlayer( i );
        if ( player && player.Vehicle )
        {
          local veh = player.Vehicle;
            if ( IsVehicleCar( veh.Model ) )
            {
                if    ( veh.Driver.ID == player.ID )
                {
                   fuel[ veh.ID ] --;
                }
            
                if ( fuel[ veh.ID ] <= 0 )
                {
                    CallClientFunc( player, "LU-FS/LUFC.nut", "DisplayFuelMeter", "EMPTY" );
                    if    ( veh.Driver.ID == player.ID )
                    {
                  veh.SetEngineState( false );
               }
                    fuel[ veh.ID ] = 0;
                }
            else
            {
                veh.SetEngineState( true );
                CallClientFunc( player, "LU-FS/LUFC.nut", "DisplayFuelMeter", fuel[ veh.ID ] );
            }   
         }
        }
    }
}
   
class CreateDispatcher
{
    function constructor( id, pos )
   {
       Player = null;
      Pos = pos;
      ID = id;      
       local D = ::CreateSphere( pos, FSphereRadius, ::Colour( Random( 0, 256 ), Random( 0, 256 ), Random( 0, 256 ) ) );
      if ( D )
      {
         D.Type = 2;
         Sphere = D.ID;
      }   
   }
   Player = null;
   Pos = null;
   ID = 0;
   Sphere = 0;
}
   
function FindDispatcher( sphID )
{
   for ( local i = 0; i <= MAX_SPHERES; i   )
   {
       local D = Dispatchers[ i ];
       if ( D && D.Sphere == sphID ) { return Dispatchers[ i ]; break; }
   }
   return null;
}   
   
function Random( min, max )
{
    min = min.tointeger(), max = max.tointeger()   1;
    local a = rand() % ( max - min )   min;
    return a;
}
   
function SetVehicleTank( player, tank )
{
    local veh = player.Vehicle;
    if ( veh )
   {
       local cost = Price_Per_Liter * tank;
       if ( player.Cash < cost ) MessagePlayer( "Error - You need at least $"   cost   " in your pocket", player, RED );
      else
      {
          if ( fuel[ veh.ID ] == Max_Gas ) MessagePlayer( "Error - Your car is full yet", player, RED );
         else if ( ( fuel[ veh.ID ]   tank ) > Max_Gas ) MessagePlayer( "Error - Excesive amount, you cannot have more than "   Max_Gas   " liters in your car", player, RED );
         else
         {
             MessagePlayer( "Your car has been refuelled with "   tank   " liters of fuel, Cost: $"   cost   " good luck :)", player, GREEN );
              fuel[ veh.ID ]  = tank;            
            player.Cash -= cost;
         
         }
        }         
   }
}   
   
   //---- Juppi's function ----
function IsVehicleCar( model )
{
   switch ( model )
   {
      case VEH_PREDATOR:
      case VEH_TRAIN:
      case VEH_CHOPPER:
      case VEH_DODO:
      case VEH_RCBANDIT:
      case VEH_AIRTRAIN:
      case VEH_DEADDODO:
      case VEH_SPEEDER:
      case VEH_REEFER:
         return false;
   }
   
   return true;
}   





LUFC.nut


/*
     Liberty Unleashed Fuel Script - Client
    Version 1.0 
    by [MKs]X_94
*/   

//---- Script Data ----

local lP = FindLocalPlayer();
local BLUE = Colour( 0, 0, 255 );
local ORANGE = Colour( 255, 153, 0 );
local LBLUE = Colour( 51, 51, 153 );
local GREEN = Colour( 0, 255, 0 );
local RED = Colour( 255, 0, 0 );
local SKYBLUE = Colour( 0, 102, 255 );
local PURPLE = Colour( 204, 0, 204 );
local iCPURPLE = Colour( 100, 20, 255 );
const Price_Per_Liter = 20;
const Max_Gas = 50;
const Min_Gas = 10;
const Rand_Gas = 20;
const FSphereRadius = 5.0;

//----- GUI -----

local FLabel = GUILabel( VectorScreen( ScreenWidth - 225, ScreenHeight - 25 ), ScreenSize( 5, 25 ), "Fuel:" );
local FullTank_Button = GUIButton( VectorScreen( 5, 5 ), ScreenSize( 225, 25 ), "Full Tank" );
local MenuWindow = GUIWindow( VectorScreen( ScreenWidth - ( ScreenWidth / 2 ), ScreenHeight - ( ScreenHeight / 2 ) ), ScreenSize( 350, 250 ), "Fuel Dispatcher Menu" );
local ExitMenu_Button = GUIButton( VectorScreen( 5, 95 ), ScreenSize( 225, 25 ), "Exit Menu" );
local FuelBox = GUIEditbox( VectorScreen( 5, 65 ), ScreenSize( 225, 25 ) );
local otherwL = GUILabel( VectorScreen( 5, 35 ), ScreenSize( 225, 25 ), "Or if you want choose how many fuel wanna you buy" );

//----- Script Events -----

function onScriptLoad()
{   
    BindKey( KEY_RETURN, BINDTYPE_DOWN, "PressEnter" );
    MenuWindow.Colour = Colour( 5, 5, 5 );   
   MenuWindow.Visible = false;   
    FLabel.FontName = "Calibri";   
   FLabel.FontSize = 10;
   FLabel.TextColour = RED;
    otherwL.FontName = "Calibri";   
   otherwL.FontSize = 13;
   otherwL.TextColour = ORANGE;   
   ExitMenu_Button.TextColour = GREEN;
   FullTank_Button.TextColour = SKYBLUE;
   ExitMenu_Button.Colour = Colour( 5, 5, 5 );
   FullTank_Button.Colour = RED;   
   FullTank_Button.Text = "Full Tank";
   FuelBox.TextColour = iCPURPLE;   
    FuelBox.Colour = LBLUE;      
   FuelBox.Active = true;      
   FLabel.Visible = false;   
   otherwL.Visible = true;      
   MenuWindow.AddChild( FullTank_Button );   
   MenuWindow.AddChild( ExitMenu_Button );   
   MenuWindow.AddChild( otherwL );      
   MenuWindow.AddChild( FuelBox );   
   AddGUILayer( MenuWindow );
    AddGUILayer( FLabel );
    FullTank_Button.SetCallbackFunc( "SetFullTank" );
   ExitMenu_Button.SetCallbackFunc( "DeleteMenu" );      
    return 1;
}

function onClientExitedVehicle( veh )
{
   if ( FLabel.Visible ) FLabel.Visible = false;
   return 1;
}

//----- Script Functions -----

function DisplayFuelMeter( fuel )
{
    if ( !FLabel.Visible ) FLabel.Visible = true;
    FLabel.Text = "Fuel: "   fuel;
}

function SetFullTank()
{
    CallServerFunc( "LU-FS/LUF.nut", "SetVehicleTank", lP, Max_Gas );
}   

function PressEnter()
{
    if ( MenuWindow.Visible )
   {
       local f = FuelBox.Text;
       if ( f && IsNum( f ) )
      {
           CallServerFunc( "LU-FS/LUF.nut", "SetVehicleTank", lP, f.tointeger() );
      }   
      else Message( "Error - The amount is null or must be a number", RED );
   }
}

function CreateMenu()
{
    if ( !MenuWindow.Visible ) MenuWindow.Visible = true;
   if ( !FuelBox.Active ) FuelBox.Active = true;   
    if ( FuelBox.Text ) FuelBox.Text = null;   
   lP.Frozen = true;
   if ( !IsMouseCursorShowing() ) ShowMouseCursor( true );
}

function DeleteMenu()
{
    if ( MenuWindow.Visible ) MenuWindow.Visible = false;
   if ( FuelBox.Active ) FuelBox.Active = false;   
    if ( FuelBox.Text ) FuelBox.Text = null;   
   lP.Frozen = false;
   if ( IsMouseCursorShowing() ) ShowMouseCursor( false );
}



Script.xml

<script file=LUF.nut" client="0" />
<script file="LUFC.nut" client="1" />
48  Liberty Unleashed / LU Clans / [EG] Express Game!:D on: September 28, 2012, 08:50:01 am
Express Game!:D Clan
49  Scripting / Script Help / Sound help on: September 28, 2012, 08:44:26 am
you need to do so in this script after spawning music stop


function onScriptLoad()
{
     spawn_Sound <- null;
}

function onClientRequestClass( player )
{
    if ( !spawn_Sound )
    {
         spawn_Sound = FindSound( "welcome2.mp3" );
         if ( spawn_Sound )
         {
              spawn_Sound.Open();
              spawn_Sound.Play();
         
              return 1;
         }
    }
    else
    {
        spawn_Sound.Open();
         spawn_Sound.Play();
      
         return 1;
    }
}
50  Scripting / Script Help / Re: RACE on: September 28, 2012, 07:46:37 am
I understand me here, I will help you no good Charite in scripts for me to ask someone else UTB vile all for me to do forgive me for meanness
51  Scripting / Script Help / Re: RACE on: September 27, 2012, 10:55:09 am
I'm a little rummage in the scripts can write to me here one example of the race well naprime issuing the command / race poshol otshet 3 2 1 and drive to the finish line by label OWL me Pts must
52  Scripting / Script Help / RACE on: September 26, 2012, 01:55:10 pm
How do I create a race server? :o
53  Servers / General Server Chat / Re: Race Server ?1 on: July 22, 2012, 09:04:29 am
?????? ??? ???? ?????? ???????? ??????? ? ????????????!
54  Servers / Advertise your server! / Express Game!:D server on: July 22, 2012, 08:57:47 am
?? ???? ??????? ???????? ??? ?????? ??????????? ????????? ??? ? ?????? ? ???????? http://vk.com/serverlu
Pages: 1 2 3 [4]
© Liberty Unleashed Team.