22.07.2012, 00:10
I cleaned up the code a bit, got a better view of it and removed unnecesarry brackets, easier to track the problem then.
I found the source of the problem.
Thanks for the help.
Final code:
I found the source of the problem.
Thanks for the help.
Final code:
pawn Код:
CMD:loadtruck(playerid, params[])
{
if(pInfo[playerid][pJob] == 1){ // If has the truckerjob (job 1)
if(IsVehicleTruck(GetPlayerVehicleID(playerid))) // If is in a truck
if(IsPlayerInRangeOfPoint(playerid, 5, 2197.8425,-2662.9883,13.5469)) // If is next to the loading point
if(pTruckLoaded[playerid] == 0 && pCheckpoint[playerid] == 0) // If you don't have a checkpoint or trucking route, then
CountDownCheck10(playerid); // execute the timer (loading truck screen)
if(pInfo[playerid][pJob] != 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not a trucker."); // But if you don't have the trucking job, return you are not a trucker and cancel.
if(!IsVehicleTruck(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_WHITE, "You are not in an Ocean Dock truck."); // If you are not in a truck, cancel.
if(!IsPlayerInRangeOfPoint(playerid, 5, 2197.8425,-2662.9883,13.5469)) return SendClientMessage(playerid, COLOR_WHITE, "To load the truck, go to the loading garage in Ocean Docks, then /loadtruck."); // If not next to the loading garage, describe where to load it, and cancel.
if(pTruckLoaded[playerid] != 0 && pCheckpoint[playerid] != 0) return SendClientMessage(playerid, COLOR_WHITE, "You already have an existing checkpoint or trucking route."); // If you already have a checkpoint or trucking route, cancel.
return 1;
}