Truck Unloading Help
#1

hi i have a commands /loadtruck, its create checkpoint that must Load the truck.. but the problem is when i in near the checkpoint is nothing happen, btw in my script when near in load checkpoint it create new checkpoint to unload the truck.. #sorry4badEng xD

this my code
Код:
CMD:loadtruck(playerid, params[])
{
	if(Work[playerid] == 0)
 	{
		if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
		{
  			if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
	    	{
				SetPlayerCheckpoint(playerid, 2509.2415,-2077.5667,13.5469, 7.0);
				SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}go to the checkpoint in the map to Load your truck");
				Work[playerid] = 1;
			}
			else return SendClientMessage(playerid, -1, "** you must have trailer to start job");
		}
		else return SendClientMessage(playerid, -1, "** you must in the truck");
	}
	else return SendClientMessage(playerid, -1, "** you are still in job");
	return 1;
}
This code when player near Load truck checkpoint

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(IsPlayerInRangeOfPoint(playerid, 3.0, 2509.2415,-2077.5667,13.5469)) // Load Truck Checkpoint
	{
 		SetTimerEx("LoadMats", 5000, false, "i", playerid);
		GameTextForPlayer(playerid, "~r~Loading Truck", 3000, 3);
		TogglePlayerControllable(playerid, 1);
		DisablePlayerCheckpoint(playerid);
	}
	for (new i; i != sizeof (TruckingUnload); ++i)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 7.0, TruckingUnload[i][0], TruckingUnload[i][1], TruckingUnload[i][2]))
	    {
			GivePlayerMoney(playerid, 4000);
			SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}you have passed trucking job and get reward $4.000");
			DisablePlayerCheckpoint(playerid);
			Work[playerid] = 0;
        	break;
	    }
	}
	return 1;
}
Reply
#2

For one, you're not showing all the code. What does loadmats do? If it's obviously loading the truck up with the materials, you should set a checkpoint inside of the load materials (after the vehicle is done loading).
Reply
#3

Код:
public LoadMats(playerid)
{
    new rand = random(sizeof(TruckingUnload));
	SetPlayerCheckpoint(playerid, TruckingUnload[rand][0], TruckingUnload[rand][1], TruckingUnload[rand][2], 7.0);
	SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}Pergilah ke checkpoint yang berada di map");
	TogglePlayerControllable(playerid, 0);
	return 1;
}
Reply
#4

Okay, this is what I've done in the past.

some where:
pawn Код:
new TruckLoadX[MAX_PLAYERS];
new TruckLoadY[MAX_PLAYERS];
new TruckLoadZ[MAX_PLAYERS];
onplayer connect reset them:
pawn Код:
TruckLoadX[playerid] = 0;
TruckLoadY[playerid] = 0;
TruckLoadZ[playerid] = 0;
pawn Код:
public LoadMats(playerid)
{
    new rand = random(sizeof(TruckingUnload));
    TruckLoadX[playerid] = TruckingUnload[rand][0];
    TruckLoadY[playerid] = TruckingUnload[rand][1];
    TruckLoadZ[playerid] = TruckingUnload[rand][2];
    SetPlayerCheckpoint(playerid, TruckLoadX[playerid],TruckLoadY[playerid],TruckLoadX[playerid], 7.0);
    SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}Pergilah ke checkpoint yang berada di map");
    TogglePlayerControllable(playerid, 0);
    return 1;
}
Your checkpoint for unloading change too:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, TruckLoadX[playerid],TruckLoadY[playerid],TruckLoadZ[playerid]))
{
    if(work[playerid] == 1)
    {
        GivePlayerMoney(playerid, 4000);
        SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}you have passed trucking job and get reward $4.000");
        DisablePlayerCheckpoint(playerid);
        Work[playerid] = 0;
        return 1;
    }
}

Might work, could try it, dunno.
Reply
#5

Quote:
Originally Posted by The__
Посмотреть сообщение
Okay, this is what I've done in the past.

some where:
pawn Код:
new TruckLoadX[MAX_PLAYERS];
new TruckLoadY[MAX_PLAYERS];
new TruckLoadZ[MAX_PLAYERS];
onplayer connect reset them:
pawn Код:
TruckLoadX[playerid] = 0;
TruckLoadY[playerid] = 0;
TruckLoadZ[playerid] = 0;
pawn Код:
public LoadMats(playerid)
{
    new rand = random(sizeof(TruckingUnload));
    TruckLoadX[playerid] = TruckingUnload[rand][0];
    TruckLoadY[playerid] = TruckingUnload[rand][1];
    TruckLoadZ[playerid] = TruckingUnload[rand][2];
    SetPlayerCheckpoint(playerid, TruckLoadX[playerid],TruckLoadY[playerid],TruckLoadX[playerid], 7.0);
    SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}Pergilah ke checkpoint yang berada di map");
    TogglePlayerControllable(playerid, 0);
    return 1;
}
Your checkpoint for unloading change too:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, TruckLoadX[playerid],TruckLoadY[playerid],TruckLoadZ[playerid]))
{
    if(work[playerid] == 1)
    {
        GivePlayerMoney(playerid, 4000);
        SendClientMessage(playerid, COLOR_ORANGE, "INFO: {FFFFFF}you have passed trucking job and get reward $4.000");
        DisablePlayerCheckpoint(playerid);
        Work[playerid] = 0;
        return 1;
    }
}

Might work, could try it, dunno.
BTW i have a code Unload Truck
Код:
new Float:TruckingUnload[][3] =
{
	{-64.7117,-1133.9790,1.0781},
	{-19.0223,-278.8979,5.4297},
	{1336.4464,289.4808,19.5615}
};
if they take any effect?
Reply
#6

help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)