Quote:
Originally Posted by Andre9977
Quote:
Originally Posted by Tr1viUm
IsAnyTrailerAttachedToVehicle
Returns 1 when a trailer is attacked to the vehicle, 0 otherwise.
Code:
IsAnyTrailerAttachedToVehicle(vehicleid)
{
new trailerid = GetVehicleTrailer(vehicleid);
new modelid = GetVehicleModel(trailerid);
if(modelid == 435 || modelid == 450 || modelid == 591 || modelid == 606 || modelid == 607 ||
modelid == 610 || modelid == 569 || modelid == 590 || modelid == 584 || modelid == 570 ||
modelid == 608 || modelid == 611) return true;
return false;
}
|
pawn Code:
IsAnyTrailerAttachedToVehicle(vehicleid) { new v[] = { 435, 450, 591, 606, 607, 610, 569, 590, 584, 570, 608, 611 }; for(new i = 0; i < sizeof(v); i++) if(GetVehicleModel(GetVehicleTrailer(vehicleid)) == i) return true; return false; }
|
The way Tr1viUm has done it will be faster, but this way is faster and easier to write than both ways:
pawn Code:
stock IsAnyTrailerAttachedToVehicle( vehicleid )
{
switch ( GetVehicleModel( GetVehicleTrailer( vehicleid ) ) )
{
case 435, 450, 591, 606, 607, 610, 569, 590, 584, 570, 608, 611: return true;
}
return false;
}