What's wrong with this?
#1

EDIT: Fixed it, I have another problem though.

I made a job, and you have to go back and forward through 2 checkpoints. When you enter the first one, it dissapears as it should to, and the second one appears. But when You enter the seconds one, it dissapears but the first one doesn't appear. Instead, the second one appears again. I don't see where the problem is.

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(pInfo[playerid][pJob] == 2 && pWorking[playerid] == 1){
        if(MinerProgress[playerid] == 10){
            SendClientMessage(playerid, INFO_COLOR, "You finished your job and you earned 1000000 dollars");
            GivePlayerMoney(playerid, 10000000);
            DestroyDynamicCP(MinerCP[playerid][0]); DestroyDynamicCP(MinerCP[playerid][1]);
            pWorking[playerid] = 0;
            MinerProgress[playerid] = 0;
            return 1;
        }
        if(checkpointid == MinerCP[playerid][0]){
            DestroyDynamicCP(checkpointid);
            MinerCP[playerid][1] = CreateDynamicCP(-446.1626,1230.4545,6.8758, 8, 1, -1, playerid, 1000);
            MinerProgress[playerid] += 1;
            return 1;
        }
        if(checkpointid == MinerCP[playerid][1]){
            DestroyDynamicCP(checkpointid);
            MinerCP[playerid][0] = CreateDynamicCP(-422.4301,1196.7813,6.7826, 8, 1, -1, playerid, 1000);
            MinerProgress[playerid] += 1;
            return 1;
        }
    }
    return 1;
               
}
Reply
#2

Give this a try:

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(pInfo[playerid][pJob] == 2 && pWorking[playerid] == 1)
    {
        if(MinerProgress[playerid] == 10)
        {
            SendClientMessage(playerid, INFO_COLOR, "You finished your job and you earned 1000000 dollars");
            GivePlayerMoney(playerid, 10000000);
            DestroyDynamicCP(MinerCP[playerid][0]);
            DestroyDynamicCP(MinerCP[playerid][1]);
            pWorking[playerid] = 0;
            MinerProgress[playerid] = 0;
            return 1;
        }
        if(checkpointid == MinerCP[playerid][0]) //First CP, show 2nd
        {
            DestroyDynamicCP(MinerCP[playerid][0]);
            DestroyDynamicCP(MinerCP[playerid][1]);
            MinerCP[playerid][1] = CreateDynamicCP(-446.1626,1230.4545,6.8758, 8, 1, -1, playerid, 1000);
            MinerProgress[playerid] += 1;
            return 1;
        }
        else if(checkpointid == MinerCP[playerid][1]) //2nd CP, show 1st
        {
            DestroyDynamicCP(MinerCP[playerid][0]);
            DestroyDynamicCP(MinerCP[playerid][1]);
            MinerCP[playerid][0] = CreateDynamicCP(-422.4301,1196.7813,6.7826, 8, 1, -1, playerid, 1000);
            MinerProgress[playerid] += 1;
            return 1;
        }
    }
    return 1;
}
Reply
#3

Same thing happens.
Reply
#4

Hmm, edited my last post.
Reply
#5

Hmm, not working again. I tried it even with two seperate variables (MinerCP1[MAX_PLAYERS] and MinerCP2[MAX_PLAYERS]). I'm using Incongnitos streamer for this, maybe there's a problem with that :/ .
Reply
#6

ok, the array that the first checkpoint is in (checkpoint 0), well that value in the minercp array is 0, which is the same as the second one, so it thinks you entered the first checkpoint. after you enter the first checkpoint have it change the value to some wacky number. and also have it start at a wacky number for both checkpoints, that way it will prevent this from happening.
i think this will help as it seems to be a general thing with variables, however i have not worked with checkpoints much.
Reply
#7

I managed to fix it. I made it when you type the cmd to start the job, both checkpoints are created and they show/hide instead of destroying and creating. Like dowster suggested, when the checkpoints are destroyed, I set the variables to some random numbers.

Thanks guys, rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)