25.08.2011, 18:02
Hello I have attempted to make a command which attaches a random trailer to a truck, now I have set up the 3 trailer id's in to a new:
Which I have no idea if it is right, guessing it isn't seeing as it isn't working. now here's my command:
With the "IsATruck" attached the the command.
pawn Код:
new Trailers[3][1] =
{
403,
514,
515,
};
pawn Код:
CMD:trailer(playerid, params[])
{
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(IsATruck(vehicleid))
{
new randtrailer = random( sizeof( Trailers ) );
AttachTrailerToVehicle(randtrailer, IsATruck(vehicleid));
SendClientMessage(playerid, COLOR_RED, "INFO: Trailer attached");
printf("%d", randtrailer);
}
return 1;
}
stock IsATruck(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 435, 450, 584, 591: return 1;
}
return 1;
}