COMMAND:blablabla(playerid, params[])
{
if( isnull( params ) ) return SendClientMessage( playerid, 0xFF0000FF, "wrong, bla bla bla" );
new
Float:x,
Float:y,
Float:z,
Float:a,
car
;
GetPlayerFacingAngle( playerid, a );
GetPlayerPos( playerid, x, y, z );
if( IsPlayerInAnyVehicle( playerid ) )
{
DestroyVehicle( GetPlayerVehicleID( playerid ) );
RemovePlayerFromVehicle( playerid );
}
car = CreateVehicle( strval( params ), x, y, z, a, 6, 6, 1000 );
PutPlayerInVehicle( playerid, car, 0 );
/*new
obj = CreateObject( 325, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
;
AttachObjectToVehicle( obj, car, 0.0, -2.89, 0.0, 0.0, 0.0, 0.0 );*/
new
Float:result[ 3 ]
;
MPProjectPointOnVehicle( car, 0.0, -2.89, 0.0, result[ 0 ], result[ 1 ], result[ 2 ], 1 );
CreateObject( 325, result[ 0 ], result[ 1 ], result[ 2 ], 0.0, 0.0, 0.0 );
return 1;
}
forward MPTimer(Vid, Float:x, Float:y, Float:z);
COMMAND:test(playerid, params[])
{
if( isnull( params ) ) return SendClientMessage( playerid, 0xFF0000FF, "wrong, bla bla bla" );
new
Float:x,
Float:y,
Float:z,
Float:a,
car
;
GetPlayerFacingAngle( playerid, a );
GetPlayerPos( playerid, x, y, z );
if( IsPlayerInAnyVehicle( playerid ) )
{
DestroyVehicle( GetPlayerVehicleID( playerid ) );
RemovePlayerFromVehicle( playerid );
}
car = CreateVehicle( strval( params ), x, y, z, a, 6, 6, 1000 );
PutPlayerInVehicle( playerid, car, 0 );
SetTimerEx("MPTimer", 100, false, "ifff", car, x, y, z);
return 1;
}
public MPTimer(Vid, Float:x, Float:y, Float:z)
{
/*new
obj = CreateObject( 325, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 )
;
AttachObjectToVehicle( obj, car, 0.0, -2.89, 0.0, 0.0, 0.0, 0.0 );*/
new
Float:result[ 3 ]
;
MPProjectPointOnVehicle( Vid, 0.0, 2.89, 0.0, result[0], result[1], result[2]);
CreateObject( 325, result[0]+x, result[1]+y, result[2]+z, 0.0, 0.0, 0.0 );
return 1;
}
new
Float:offsetPos[ 6 ]
;
GetVehicleModelInfo( GetVehicleModel( vehicleid ), VEHICLE_MODEL_INFO_SIZE, offsetPos[ 0 ], offsetPos[ 1 ], offsetPos[ 2 ] );
printf( "GetVehicleModelInfo: %f, %f, %f", offsetPos[ 0 ], offsetPos[ 1 ], offsetPos[ 2 ] );
offsetPos[ 1 ] = offsetPos[ 1 ] / 2.0;
//offsetPos[ 1 ] = -offsetPos[ 1 ];
SetTimerEx( "fakeris", 200, false, "if", vehicleid, offsetPos[ 1 ] );
MPProjectPointOnVehicle( vehicleid, 0.0, offsetPos[ 1 ], 0.0, offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ], 1 );
printf( "MPProjectPointOnVehicle: %f, %f, %f", offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ] );
CreateObject( 325, offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ], 0.0, 0.0, 0.0 );
then pre-prepare coords incase you exitted the vehicle or something?
|
// command COMMAND:cmd(playerid, params[]) { IsPlayerNearVehicleBoot( playerid, GetPlayerVehicleID( playerid ) ); return 1; } // another part new Float:mPos[ 3 ] ; for( new i; i < MAX_VEHICLES; i++ ) { GetVehiclePos( i, mPos[ 0 ], mPos[ 1 ], mPos[ 2 ] ); if( IsPlayerInRangeOfPoint( playerid, 3.5, mPos[ 0 ], mPos[ 1 ], mPos[ 2 ] ) ) { function( playerid, i ); break; } } // another part stock function( playerid, vehicleid ) { new Float:offsetPos[ 6 ] ; GetVehicleModelInfo( GetVehicleModel( vehicleid ), VEHICLE_MODEL_INFO_SIZE, offsetPos[ 0 ], offsetPos[ 1 ], offsetPos[ 2 ] ); printf( "GetVehicleModelInfo: %f, %f, %f", offsetPos[ 0 ], offsetPos[ 1 ], offsetPos[ 2 ] ); offsetPos[ 1 ] = offsetPos[ 1 ] / 2.0; //offsetPos[ 1 ] = -offsetPos[ 1 ]; MPProjectPointOnVehicle( vehicleid, 0.0, offsetPos[ 1 ], 0.0, offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ], 1 ); printf( "MPProjectPointOnVehicle: %f, %f, %f", offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ] ); CreateObject( 325, offsetPos[ 3 ], offsetPos[ 4 ], offsetPos[ 5 ], 0.0, 0.0, 0.0 ); return 1; }