Job bug
#1

Hello and thank you for taking a look at the topic. I have scripted a pizza boy job and facing some issues which I cannot fix and I need your help. The problem is when the player starts the job the pickup is shown on the minimap, but when he goes at it, the pickup dissapears without showing the next or giving the player cash. Codes used:



Command:

pawn Код:
CMD:startdelivery(playerid, params[])
{
    new vid = GetPlayerVehicleID(playerid);
    if(!IsPlayerLoggedIn(playerid)) return SCM(playerid, COLOR_GREY, "You need to be logged in to use commands.");
    if(!IsPizzaBike(vid)) return SCM(playerid, COLOR_GREY, "You are not in a Pizza Boy bike.");
    if(!IsPlayerInRangeOfPoint(playerid, 2, 2099.4939,-1784.9034,13.3983)) return SCM(playerid, COLOR_GREY, "You cannot start a delivery here.");
    if(PlayerInfo[playerid][pJob] != JOB_PBOY && PlayerInfo[playerid][pVJob] != JOB_PBOY) return SCM(playerid, COLOR_GREY, "You are not a pizza boy.");
    if(Deliverying[playerid]) return SCM(playerid, COLOR_GREY, "You are already deliverying pizza.");
    else
    {
        Deliverying[playerid] = 1;
        new randomp = random(sizeof(DelCp));
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, DelCp[randomp][0], DelCp[randomp][1], DelCp[randomp][2], 4);
        SCM(playerid, COLOR_WHITE, "You have started deliverying pizza.");
    }
    return 1;
}
OnPlayerEnterCheckpoint:

pawn Код:
if(Deliverying[playerid])
    {
        new vid = GetPlayerVehicleID(playerid);
        if(IsPizzaBike(vid))
        {
            new cash = (random(35-10)+10);
            Deliverying[playerid] += 1;
            DisablePlayerCheckpoint(playerid);
            GiveMoney(playerid, cash*5);
            new randomss = random(sizeof(DelCp));
            SetPlayerCheckpoint(playerid, DelCp[randomss][0], DelCp[randomss][1], DelCp[randomss][2], 4);
            if(Deliverying[playerid] == 6)
            {
                SCM(playerid, COLOR_WHITE, "You have successfully finished your delivery.");
                DisablePlayerCheckpoint(playerid);
                Deliverying[playerid] = 0;
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "This is a not a pizza bike. (Route canceled)");
            DisablePlayerCheckpoint(playerid);
            Deliverying[playerid] = 0;
        }
    }
IsPizzaBike stock:

pawn Код:
stock IsPizzaBike(vehicleid)
{
    for(new i = 0; i < sizeof(pbike); i++)
    {
        if(vehicleid == pbike[i])   return 1;
    }
    return 0;
}
Reply
#2

bump
Reply
#3

Try to change the OnPlayerEnterCheckpoint to this one
pawn Код:
if(Deliverying[playerid])
    {
        new vid = GetPlayerVehicleID(playerid);
        if(IsPizzaBike(vid))
        {
            new cash = (random(35-10)+10);
            Deliverying[playerid] += 1;
            DisablePlayerCheckpoint(playerid);
            GivePlayerMoney(playerid, cash*5);
            new randomss = random(sizeof(DelCp));
            SetPlayerCheckpoint(playerid, DelCp[randomss][0], DelCp[randomss][1], DelCp[randomss][2], 4);
            if(Deliverying[playerid] == 6)
            {
                SCM(playerid, COLOR_WHITE, "You have successfully finished your delivery.");
                DisablePlayerCheckpoint(playerid);
                Deliverying[playerid] = 0;
            }
        }
        else
        {
            SCM(playerid, COLOR_GREY, "This is a not a pizza bike. (Route canceled)");
            DisablePlayerCheckpoint(playerid);
            Deliverying[playerid] = 0;
        }
    }
Reply
#4

You actually changed GiveMoney?

GiveMoney is a custom stock I made to prevert money hacking. Thank for your attempt anyway.
Reply
#5

on OnPlayerEnterCheckpoint try to change

PHP код:
if(Deliverying[playerid]) 
to

PHP код:
if(Deliverying[playerid] != 0
Reply
#6

Could you tell me what's the difference between the first and second?
Reply
#7

you try?
Reply
#8

No I haven't cuz it's useless, also I've fixed the issue, lock the topic.

Fix: in the string format I had put $%s, noticed the mistake and changed it to $%d. The issue was fixed that way, idk why, anyway. Thank you for your replies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)