21.03.2011, 13:55
Here's the /car [Model] [CC1] [CC2] command in ZCMD + sscanf2 - Credits to Zeex and ****** for those.
And the IsValidVeh stock:
pawn Код:
CMD:car( playerid, params[] )
{
/*if ( GetAdminLevel( playerid ) < 5 ) // This is for your admin variable
return 1;*/
new tempveh1, tempcol1, tempcol2;
if ( sscanf( params, "iii", tempveh1, tempcol1, tempcol2 ) )
return SendClientMessage( playerid, -1, "Usage: /veh <CarID> [Color 1] [Color 2]");
if ( !IsValidVeh( tempveh1 ) )
return SendClientMessage( playerid, -1, "VEHICLE: Invalid vehicle ID.");
new Float:pos[ 3 ],Float:a;
GetPlayerPos( playerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
GetPlayerFacingAngle( playerid, a );
new tempveh;
tempveh = CreateVehicle( tempveh1, pos[ 0 ], pos[ 1 ], pos[ 2 ], a, tempcol1, tempcol2, -1 );
PutPlayerInVehicle( playerid, tempveh, 0 );
return 1;
}
pawn Код:
stock IsValidVeh(VehicleID)
{
if( ( VehicleID >= 400 && VehicleID <= 611 ) ) return true;
return false;
}