checkpoint problem need help
#1

Hi.
i got back to working on my gamemode after almost a year.
i'm having a problem with my delivery mission.

on top
Код:
new DeliveryMissionCP[MAX_PLAYERS];
OnPlayerKeyStateChange ( this part is 100% working fine )
Код:
if (IsPlayerInRangeOfPoint(playerid, 2.0, 1725.1687,923.0775,10.8203))
{
        new RandomTruck = random(sizeof(RandomDeliverySpawns));
        ActualVehicleID[playerid] = CreateVehicle(456, RandomDeliverySpawns[RandomTruck][0], 
        RandomDeliverySpawns[RandomTruck][1],RandomDeliverySpawns[RandomTruck][2], 
        RandomDeliverySpawns[RandomTruck][3], -1, -1, 30);
        PutPlayerInVehicle(playerid,ActualVehicleID[playerid],0);
        DeliveryMissionCP[playerid] = 1;
        SetPlayerCheckpoint(playerid, 1050.6199, 2087.5503, 10.8203, 3.0);
}
OnPlayerEnterCheckpoint
Код:
public OnPlayerEnterCheckpoint(playerid)
{
        if(DeliveryMissionCP[playerid] == 1)
	{
	    new string[128];
	    format(string, sizeof(string), "DeliveryMissionCP is %i", DeliveryMissionCP[playerid]);
	    SendClientMessage(playerid, COLOR_GREEN, string);
	    DisablePlayerCheckpoint(playerid);
	    new RandomDelivery = random(sizeof(RandomDeliveryPoint));
	    SetPlayerCheckpoint(playerid, RandomDeliveryPoint[RandomDelivery][0], RandomDeliveryPoint[RandomDelivery][1], RandomDeliveryPoint[RandomDelivery][2], 3.0);
	    SetPlayerMapIcon(playerid, 0, RandomDeliveryPoint[RandomDelivery][0], RandomDeliveryPoint[RandomDelivery][1], RandomDeliveryPoint[RandomDelivery][2], 0, COLOR_RED, MAPICON_GLOBAL);
	    DeliveryMissionCP[playerid] = 2;
	}
	if(DeliveryMissionCP[playerid] == 2)
	{
	    new string[128];
	    format(string, sizeof(string), "DeliveryMissionCP is %i", DeliveryMissionCP[playerid]);
	    SendClientMessage(playerid, COLOR_GREEN, string);
	    DisablePlayerCheckpoint(playerid);
	    SetPlayerCheckpoint(playerid, 1720.7654,897.8714,10.7698, 3.0);
	    SetPlayerMapIcon(playerid, 0, 1720.7654,897.8714,10.7698, 0, COLOR_RED, MAPICON_GLOBAL);
	    DeliveryMissionCP[playerid] = 3;
	}
	if(DeliveryMissionCP[playerid] == 3)
	{
	    new string[128];
	    format(string, sizeof(string), "DeliveryMissionCP is %i", DeliveryMissionCP[playerid]);
	    SendClientMessage(playerid, COLOR_GREEN, string);
	    DisablePlayerCheckpoint(playerid);
	    DeliveryMissionCP[playerid] = 0;
	    SendClientMessage(playerid, COLOR_WHITE, "Mission complete");
	    GivePlayerMoney(playerid, 250);
	    RemovePlayerFromVehicle(playerid);
	    DestroyVehicle(ActualVehicleID[playerid]);
	}
	return 1;
}
so as you can see i added a message telling what is the actual DeliveryMissionCP
when i get to the first point ( DeliveryMissionCP 1 ) the message is
Код:
DeliveryMissionCP is 1
DeliveryMissionCP is 2
DeliveryMissionCP is 3
Mission complete
all at once , it pull me out of the vehicle and destroy the vehicle.
it is supposed to do that at the LAST checkpoint , aka DeliveryMissionCP = 3.

i have checked the code many time and i can't see what is wrong.

thanks
Reply
#2

Use Incognito streamer and CreateDynamicCheckpoint and OnPlayerEnterDynamicCp instead.
Reply
#3

i had the same problem but i solved it like this
Код:
if(DeliveryMissionCP[playerid] == 2)
	{
	    new string[128];
	    format(string, sizeof(string), "DeliveryMissionCP is %i", DeliveryMissionCP[playerid]);
	    SendClientMessage(playerid, COLOR_GREEN, string);
	    DisablePlayerCheckpoint(playerid);
	    SetPlayerCheckpoint(playerid, 1720.7654,897.8714,10.7698, 3.0);
	    SetPlayerMapIcon(playerid, 0, 1720.7654,897.8714,10.7698, 0, COLOR_RED, MAPICON_GLOBAL);
	    SetTimerEx("seco", 1000, false, "i", playerid);
	}

forward seco(playerid);
public seco(playerid)
{
	DeliveryMissionCP[playerid]=DeliveryMissionCP[playerid]+1;
	return 1;
}
so instead of setting your cp number through out entering the checkpoint set your current needed checkpoint number with a timer it works like a charm because as code applies so fast in the first checkpoint that until one checkpoint disappears you already get them all
Reply
#4

Quote:
Originally Posted by Despacito
Посмотреть сообщение
Use Incognito streamer and CreateDynamicCheckpoint and OnPlayerEnterDynamicCp instead.
i WAS using this but switched thinking it was my problem.
Reply
#5

Quote:
Originally Posted by grymtn
Посмотреть сообщение
i had the same problem but i solved it like this
Код:
if(DeliveryMissionCP[playerid] == 2)
	{
	    new string[128];
	    format(string, sizeof(string), "DeliveryMissionCP is %i", DeliveryMissionCP[playerid]);
	    SendClientMessage(playerid, COLOR_GREEN, string);
	    DisablePlayerCheckpoint(playerid);
	    SetPlayerCheckpoint(playerid, 1720.7654,897.8714,10.7698, 3.0);
	    SetPlayerMapIcon(playerid, 0, 1720.7654,897.8714,10.7698, 0, COLOR_RED, MAPICON_GLOBAL);
	    SetTimerEx("seco", 1000, false, "i", playerid);
	}

forward seco(playerid);
public seco(playerid)
{
	DeliveryMissionCP[playerid]=DeliveryMissionCP[playerid]+1;
	return 1;
}
so instead of setting your cp number through out entering the checkpoint set your current needed checkpoint number with a timer it works like a charm because as code applies so fast in the first checkpoint that until one checkpoint disappears you already get them all
didnt tought of that. thanks.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)