Liberty Unleashed
Scripting => Script Help => Topic started by: Kevin on November 16, 2016, 03:02:02 am
-
Server crashed when creating vehicle, help version 0.17
function onPlayerCommand( pPlayer, szCommand, szText )
{
if ( szCommand == "veh" )
{
CreateVehicle( VEH_INFERNUS, pPlayer.Pos, pPlayer.Angle, -1, -1 );
}
return 1;
}
-
Hey Kevin, Welcome back to LU :).
I just want to add in the server package there is a vehicle command already there ;)
I hope this is helpful. If you only want that one vehicle I can script it for you :), Just reply back with what you want.
function onPlayerCommand( pPlayer, szCmd, szParams )
{
if ( szCmd == "mypos" )
{
local v = pPlayer.Pos;
Message( pPlayer.Name + " is currently at " + v.x + ", " + v.y + ", " + v.z );
}
else if ( szCmd == "spawncar" )
{
if ( szParams )
{
local pTemp = split( szParams, " " ), ID = 90;
if ( IsNum( pTemp[ 0 ] ) ) ID = pTemp[ 0 ].tointeger();
if ( ( ID >= 90 ) && ( ID <= 150 ) )
{
local v = pPlayer.Pos;
MessagePlayer( "Spawning a vehicle with model ID " + ID + "...", pPlayer );
CreateVehicle( ID, Vector( v.x + 5, v.y, v.z ), pPlayer.Angle );
}
}
}
else if ( szCmd == "health" )
{
if ( !szParams ) MessagePlayer( "Your Health: " + pPlayer.Health, pPlayer );
else
{
local pTemp = split( szParams, " " ), p = GetPlayer( pTemp[ 0 ] );
if ( p )
{
if ( p.Spawned ) MessagePlayer( pPlayer.Name + "'s Health: " + p.Health, pPlayer );
else MessagePlayer( "This person isn't spawned nub!", pPlayer );
}
else MessagePlayer( "Can't find anyone with that id/nick", pPlayer );
}
}
else if ( szCmd == "armour" )
{
if ( !szParams ) MessagePlayer( "Your Armour: " + pPlayer.Armour, pPlayer );
else
{
local pTemp = split( szParams, " " ), p = GetPlayer( pTemp[ 0 ] );
if ( p )
{
if ( p.Spawned ) MessagePlayer( pPlayer.Name + "'s Armour: " + p.Armour, pPlayer );
else MessagePlayer( "This person isn't spawned nub!", pPlayer );
}
else MessagePlayer( "Can't find anyone with that id/nick", pPlayer );
}
}
else if ( szCmd == "goto" )
{
if ( !szParams ) MessagePlayer( "Error - Need to specify a target player.", pPlayer );
else
{
local pTemp = split( szParams, " " ), p = GetPlayer( pTemp[ 0 ] );
if ( p )
{
if ( p.Spawned )
{
Message( "Taking " + pPlayer.Name + " to " + p.Name, Colour( 0, 255, 0 ) );
pPlayer.Pos = p.Pos;
pPlayer.Pos.y += 5;
pPlayer.Pos.z += 2;
}
else MessagePlayer( "This person isn't spawned nub!", pPlayer );
}
else MessagePlayer( "Can't find anyone with that id/nick", pPlayer );
}
}
else if ( szCmd == "bring" )
{
if ( !szParams ) MessagePlayer( "Error - Need to specify a target player.", pPlayer );
else
{
local pTemp = split( szParams, " " ), p = GetPlayer( pTemp[ 0 ] );
if ( p )
{
if ( p.Spawned )
{
Message( "Taking " + p.Name + " to " + pPlayer.Name, Colour( 0, 255, 0 ) );
p.Pos = pPlayer.Pos;
p.Pos.y += 5;
p.Pos.z += 2;
}
else MessagePlayer( "This person isn't spawned nub!", pPlayer );
}
else MessagePlayer( "Can't find anyone with that id/nick", pPlayer );
}
}
return 1;
}
function GetPlayer( target )
{
target = target.tostring();
if ( IsNum( target ) )
{
target = target.tointeger();
if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
else if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
-
Oo thank you, I see that I changed some things
-
Oo thank you, I see that I changed some things
You managed to fix it? And how did you fixed it if you did?
-
Keep crashing server, you can better pass me the version server windows version.0.17 :'( :'( :'( :'( :'(
-
I've tested your code and it works just fine. Maybe some other script is causing trouble in combination with this one?
-
After creating vehicle the server suddenly closes
-
Any errors in the script log of the server?