SA-MP Forums Archive
Job bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Job bug (/showthread.php?tid=426851)



Job bug - L.Hudson - 30.03.2013

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;
}



Re: Job bug - L.Hudson - 31.03.2013

bump


Re: Job bug - Red_Dragon. - 31.03.2013

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;
        }
    }



Re: Job bug - L.Hudson - 01.04.2013

You actually changed GiveMoney?

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


Re: Job bug - brawrr - 01.04.2013

on OnPlayerEnterCheckpoint try to change

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

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



Re: Job bug - L.Hudson - 01.04.2013

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


Re: Job bug - brawrr - 01.04.2013

you try?


Re: Job bug - L.Hudson - 01.04.2013

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.