why this doesn't work ?
const RAMP_OBJECT = 1378;
objects <- array( GetMaxPlayers(), -1 );
function SpawnRamp( id, boost )
{
local plr = FindPlayer( id );
if ( plr )
{
local pos = plr.Pos;
local rot = plr.Angle, rad = rot * PI / 180.0;
local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad);
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
if ( objects[id] != -1 )
{
local obj = FindObject( objects[id] );
if ( obj )
{
obj.Pos = Vector( x2, y2, pos.z - 0.3 );
obj.Angle = Vector( 0.0, 0.0, rot + 270.0 );
}
}
else
{
local obj = CreateObject( RAMP_OBJECT, Vector( x2, y2, pos.z ), Vector( 0.0, 0.0, rot + 270.0 ) );
if ( obj )
{
objects[id] = obj.ID;
}
}
if ( boost ) Boost( plr );
}
}
function Boost( plr )
{
local veh = plr.Vehicle;
if ( veh )
{
local vel = veh.Velocity;
vel.x *= 1.5;
vel.y *= 1.5;
vel.z *= 1.5;
veh.Velocity = vel;
}
}
function Fix( plr )
{
local veh = plr.Vehicle;
if ( veh )
{
plr.Vehicle.Fix();
}
}
function Flip( plr )
{
local veh = plr.Vehicle;
if ( veh )
{
plr.Vehicle.Fix();
local rot = plr.Vehicle.Angle;
plr.Vehicle.Pos = plr.Vehicle.Pos;
plr.Vehicle.Angle = rot;
}
}
function Jump( plr )
{
local veh = plr.Vehicle;
if ( veh )
{
local vel = veh.Velocity;
vel.x += 0;
vel.y += 0;
vel.z += 0.5;
veh.Velocity = vel;
}
}
function onPlayerPart( plr, reason )
{
local id = plr.ID;
if ( objects[id] != -1 )
{
local obj = FindObject( objects[id] );
if ( obj )
{
obj.Remove();
objects[id] = -1;
}
}
return 1;
}
_______________________________________________________________________________
function onScriptLoad()
{
BindKey( 'O', BINDTYPE_DOWN, "Ramp" );
BindKey( 'P', BINDTYPE_DOWN, "RampWithBoost" );
BindKey( 'I', BINDTYPE_DOWN, "Boost" );
BindKey( 'U', BINDTYPE_DOWN, "Fix" );
BindKey( 'Z', BINDTYPE_DOWN, "Flip" );
BindKey( '2', BINDTYPE_DOWN, "Jump" );
g_pLocalPlayer <- FindLocalPlayer();
return 1;
}
function Ramp()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Ramp", g_pLocalPlayer.ID, false );
}
}
}
function RampWithBoost()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Ramp", g_pLocalPlayer.ID, true );
}
}
}
function Boost()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Boost", g_pLocalPlayer );
}
}
}
function Fix()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Fix", g_pLocalPlayer );
}
}
}
function Flip()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Flip", g_pLocalPlayer );
}
}
}
function Jump()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "binds/binds.nut", "Jump", g_pLocalPlayer );
}
}
}