09.02.2012, 19:16
Hello,
I've made a command that you would input a vehicle plate, and if the vehicle is found, it will mark it in the radar.
The problem is that it always says, no matter what I put:
The vehicle has been found and been marked in the radar. [Veh: 2000].
And it marks a checkpoint in the Blueberry farms.
I do use this function to change the vehicle plates, and store them in a variable, replacing AddStaticVehicleEx with a custom function:
The command:
Assist me with help, please!
I've made a command that you would input a vehicle plate, and if the vehicle is found, it will mark it in the radar.
The problem is that it always says, no matter what I put:
The vehicle has been found and been marked in the radar. [Veh: 2000].
And it marks a checkpoint in the Blueberry farms.
I do use this function to change the vehicle plates, and store them in a variable, replacing AddStaticVehicleEx with a custom function:
pawn Код:
stock AddStaticVehEx( model, Float:vx, Float:vy, Float:vz, Float:vrot, vc1, vc2, rspwn = 60000 )
{
ScriptCars++;
new tmp;
tmp = AddStaticVehicleEx( model, vx, vy, vz, vrot, vc1, vc2, rspwn );
new szString[128];
format( szString, 128, "GOV-%d", 100+random( 900 ) );
if ( IsAPoliceVehicle( tmp ) )
format( szString, 128, "SFPD-%d", 100+random( 900 ) );
SetVehiclePlateEx( tmp, szString );
return tmp;
}
pawn Код:
CMD:trackplate( playerid, params[] )
{
if ( isnull( params ) )
{
return ShowSyntaxMessage( playerid, "/trackplate [plate number]");
}
else
{
new found, moving, szString[128];
for( new i = 1; i < MAX_VEHICLES+1; i ++ )
{
if ( !strcmp( VehiclePlate[i], params, true ) ){
found = i;
}
}
if ( found )
{
new Float:vehiclex, Float:vehicley, Float:vehiclez;
if ( GetVehicleSpeed( found, true ) > 10 )
moving = 1;
else
moving = 0;
GetVehiclePos( found, vehiclex, vehicley, vehiclez );
SetPlayerCheckpoint( playerid, vehiclex, vehicley, vehiclez, 2.0 );
format( szString, 128, "The vehicle has been found and been marked in the {ff0000}radar. [Veh: %d]", found );
SendClientMessage( playerid, -1, szString );
if( moving == 1 ) {
new vspeed = GetVehicleSpeed( found, true );
new vspd = floatround( vspeed, floatround_ceil );
format( szString, 128, "Vehicle moving speed: {ff000}%d KM/h", vspd );
SendClientMessage( playerid, -1, szString );
}
}
else
{
SendClientMessage( playerid, -1, "Vehicle has not been found.");
}
}
return 1;
}