29.08.2016, 23:15
Try this
PHP Code:
CMD:loadcargo(playerid, params[])
{
if(cargopicked[playerid] == 1)
{
for(new i; i < sizeof(meatcar); i++)
{
new vehicleid = meatcar[i];
if(IsPlayerInRangeOfVehicle(playerid, meatcar[i], 4))
{
RemovePlayerAttachedObject(playerid, 0);
SendClientMessage(playerid, COLOR_YELLOW, "You loaded the cargo into the van, now get inside and drive it.");
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s places the bag of meat in the back of the van.", ReturnName(playerid, 0));
ClearAnimations(playerid, 1);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
loadedcargo[vehicleid]++;
break;//got what you want, stop looping..
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not behind a van.");
}
}
}
return 1;
}