Job Problem
#1

When i start a job (go through checkpoints for money) and quit while it is active, then when i reconnect and i start the job again, i go through the first marker and get payed (I'm supposed to go through like 8, not 1). Then again i start the job, it still gives the money on the first checkpoint.

Defining the checkpoint checker (If a player goes through the first checkpoint, pokupipostu[playerid] = 2;)
Код:
new pokupipostu[MAX_PLAYERS];
When the player connects, pokupipostu[playerid] = 0;
Код:
public OnPlayerConnect(playerid)
{
	pokupipostu[playerid] = 0;
        return 1;
}
When the player disconnects, pokupipostu[playerid] = 0;
Код:
public OnPlayerDisconnect(playerid)
{
        pokupipostu[playerid] = 0;
        return 1;
}
If a player is in range of a checkpoint, pokupipostu[playerid] = some number;
Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0, -2358.3467,803.3227,38.3803) && pokupipostu[playerid] == 1 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 2;
	    SetPlayerCheckpoint(playerid, -2224.3804,804.1550,49.2969, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2224.3804,804.1550,49.2969) && pokupipostu[playerid] == 2 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 3;
	    SetPlayerCheckpoint(playerid, -2151.5386,786.5508,69.4141, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2151.5386,786.5508,69.4141) && pokupipostu[playerid] == 3 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 4;
	    SetPlayerCheckpoint(playerid, -2151.6677,644.7795,52.3672, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2151.6677,644.7795,52.3672) && pokupipostu[playerid] == 4 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 5;
	    SetPlayerCheckpoint(playerid, -2185.7598,573.2388,35.0156, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2185.7598,573.2388,35.0156) && pokupipostu[playerid] == 5 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 6;
	    SetPlayerCheckpoint(playerid, -2246.9546,620.5477,45.3104, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2246.9546,620.5477,45.3104) && pokupipostu[playerid] == 6 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 7;
	    SetPlayerCheckpoint(playerid, -2321.4087,674.2640,42.0596, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2321.4087,674.2640,42.0596) && pokupipostu[playerid] == 7 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
	    pokupipostu[playerid] = 8;
	    SetPlayerCheckpoint(playerid, -2468.9990,798.5485,35.1797, 3.0);
	}
	if(IsPlayerInRangeOfPoint(playerid, 3.0, -2468.9990,798.5485,35.1797) && pokupipostu[playerid] == 8 && IsPlayerInVehicle(playerid, pv6) || IsPlayerInVehicle(playerid, pv7))
	{
        pokupipostu[playerid] = 0;
	    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[IN:RP] {FFFFFF}Uspesno ste pokupili postu, pa ste dobili $100 i 1 EXP.");
		PlayerInfo[playerid][pExp] += 1;
		GivePlayerMoney(playerid, 100);
		DisablePlayerCheckpoint(playerid);
	}
        return 1;
}
Command to start the job (first checks if the player has a job as 'POSTAR' in my language, then does the command).
Код:
CMD:pokupipostu(playerid, params[])
{
    if(PlayerInfo[playerid][pPosao] == 1)
	{
		SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[IN:RP] {FFFFFF}Uspesno ste poceli da pokupljate postu.");
		SetPlayerCheckpoint(playerid, -2358.3467, 803.3227, 38.3803, 3.0);
		pokupipostu[playerid] = 1;
	}
	else
	{
	    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}ERROR: {FFFFFF}Morate biti zaposleni kao POSTAR!");
	}
	return 1;
}
Reply


Messages In This Thread
Job Problem - by Theepiccoder - 03.07.2016, 14:21
Re: Job Problem - by Dayrion - 03.07.2016, 14:28
Re: Job Problem - by Theepiccoder - 03.07.2016, 20:49
Re: Job Problem - by Dayrion - 03.07.2016, 21:58
Re: Job Problem - by Theepiccoder - 04.07.2016, 13:44
Re: Job Problem - by Dayrion - 04.07.2016, 14:42
Re: Job Problem - by Theepiccoder - 05.07.2016, 11:26
Re: Job Problem - by Mencent - 05.07.2016, 11:41
Re: Job Problem - by Theepiccoder - 05.07.2016, 13:16
Re: Job Problem - by Mencent - 05.07.2016, 13:25

Forum Jump:


Users browsing this thread: 3 Guest(s)