17.04.2012, 07:28
(
Последний раз редактировалось aRoach; 17.04.2012 в 07:34.
Причина: Oups!
)
Yes, you're right, the parameters can be whatever you want ( not numbers ) :
The command Should Be:
Functions:
EDIT: Modified the command...
Код:
CMD:hey( p, prm[ ] )
pawn Код:
CMD:veh( playerid, params[ ] )
{
new s_C[ 30 ], i_C[ 2 ];
if( unformat( params, "s[30]D(-1)D(-1)", s_C, i_C[ 0 ], i_C[ 1 ] ) ) return SendClientMessageEx( playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]" );
if( IsPlayerInAnyVehicle( playerid ) ) return SendClientMessageEx( playerid, COLOR_WHITE, "ERROR: You are already in a vehicle." );
new CarModel;
if( IsNumeric( s_C ) ) CarModel = strval( s_C );
else CarModel = GetVehicleModelIDFromName( s_C );
if( CarModel < 400 || CarModel > 611 ) return SendClientMessageEx( playerid, COLOR_WHITE, "ERROR: Invalid vehicle model/name" );
if( i_C[ 0 ] == -1 ) i_C[ 0 ] = random( 250 );
if( i_C[ 1 ] == -1 ) i_C[ 1 ] = random( 250 );
new Float: Pos[ 4 ];
GetPlayerPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
GetPlayerFacingAngle( playerid, Pos[ 3 ] );
CreatedCars[iIterator] = CreateVehicle( CarModel, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], Pos[ 3 ], i_C[ 0 ], i_C[ 1 ], -1 );
VehicleFuel[ CreatedCars[ iIterator ] ] = 100.0;
LinkVehicleToInterior( CreatedCars[ iIterator ], GetPlayerInterior( playerid ) );
return( 1 );
}
pawn Код:
IsNumeric( const string[ ] )
{
for( new i = 0, j = strlen( string ); i != j; i ++ )
{
if( string[ i ] > '9' || string[ i ] < '0' ) return ( 0 );
}
return ( 1 );
}