SA-MP Forums Archive
Pizzaboy minimission issue - 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: Pizzaboy minimission issue (/showthread.php?tid=564119)



Pizzaboy minimission issue - VictorCreed - 19.02.2015

Hey folks. Today I found Pawnify's pizzaboy filterscript and put it on my server but there's a problem with it. Everything's normal during the first part of the mission (which you just pick a pizzabike and go to the random checkpoint included), then it should give you a second checkpoint to turn back to the pizza store but it doesn't. I've tried to fix it with my pawn knowledge but however I'm just a beginner so I couldn't. Sincerely asking you guys for help, thanks for everything. Here's the relevant filterscript;

pawn Код:
/*
CREDITS:
Created from scratch by Pawnify
*/

#include <a_samp>
#include <zcmd>
#include <sscanf2>

main(){}

new OnJob[MAX_PLAYERS] = 0;
new PizzaDelivered[MAX_PLAYERS] = 0;


//ADD MORE COORDINATES HERE IF YOU WANT EXTRA PIZZA TO HOUSES.
new Float:PizzaSpawns[][] =
{
        {1909.4767,-1597.6576,14.3062,151.4326},
        {1578.2671,-1822.0808,13.3907,259.9920},
        {1560.0779,-1845.3982,13.5469,98.6238},
        {992.8955,-1817.6660,13.8969,158.4711},
        {791.6743,-1754.5459,13.4283,18.0240},
        {852.2607,-1422.2950,13.8082,174.4514}
};
new pbike1,pbike2,pbike3,pbike4,pbike5,pbike6,pbike7,pbike8,pbike9,pbike10;

forward GivePizzaCheckpoint(playerid);
public GivePizzaCheckpoint(playerid)
{
    new Random = random(sizeof(PizzaSpawns));
    SetPlayerCheckpoint(playerid, PizzaSpawns[Random][0], PizzaSpawns[Random][1], PizzaSpawns[Random][2], 2.0);
    SendClientMessage(playerid, -1, "{00FF00}You have a pizza to deliver. Head to the checkpoint.");
    return 1;
}

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print("   Pizzaboy filterscript, by Pawnify.    ");
        print("--------------------------------------\n");

        pbike1 = CreateVehicle(448, 2122.2981, -1768.1520, 12.8729, 93.7800, -1, -1, 100);
        pbike2 = CreateVehicle(448, 2122.2188, -1770.5725, 12.8729, 93.7800, -1, -1, 100);
        pbike3 = CreateVehicle(448, 2122.1826, -1772.7524, 12.8729, 93.7800, -1, -1, 100);
        pbike4 = CreateVehicle(448, 2122.1814, -1774.6147, 12.8729, 93.7800, -1, -1, 100);
        pbike5 = CreateVehicle(448, 2122.2263, -1776.2585, 12.8729, 93.7800, -1, -1, 100);
        pbike6 = CreateVehicle(448, 2122.2053, -1777.9784, 12.8729, 93.7800, -1, -1, 100);
        pbike7 = CreateVehicle(448, 2122.1680, -1780.0364, 12.8729, 93.7800, -1, -1, 100);
        pbike8 = CreateVehicle(448, 2122.2488, -1781.9832, 12.8729, 93.7800, -1, -1, 100);
        pbike9 = CreateVehicle(448, 2122.2058, -1784.1187, 12.8729, 93.7800, -1, -1, 100);
        pbike10 = CreateVehicle(448, 2122.3621, -1765.5983, 12.8729, 91.8000, -1, -1, 100);
        return 1;
}

public OnFilterScriptExit()
{
        DestroyVehicle(pbike1),DestroyVehicle(pbike2),DestroyVehicle(pbike3),DestroyVehicle(pbike4),DestroyVehicle(pbike5),DestroyVehicle(pbike6),DestroyVehicle(pbike7),DestroyVehicle(pbike8),DestroyVehicle(pbike9),DestroyVehicle(pbike10);
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
                new mycar = GetPlayerVehicleID(playerid);
                if(mycar == pbike1 || mycar == pbike2 || mycar == pbike3 || mycar == pbike4 || mycar == pbike5 || mycar == pbike6 ||mycar == pbike7 || mycar == pbike8 ||mycar == pbike9 || mycar == pbike10)
                {
                    if(PizzaDelivered[playerid] == 0)
                    {
                                if(OnJob[playerid] == 0)
                                {
                                        GivePizzaCheckpoint(playerid);
                                        OnJob[playerid] = 1;
                                }
                    }
                }
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
        new mycar = GetPlayerVehicleID(playerid);
        if(mycar == pbike1 || mycar == pbike2 || mycar == pbike3 || mycar == pbike4 || mycar == pbike5 || mycar == pbike6 ||mycar == pbike7 || mycar == pbike8 ||mycar == pbike9 || mycar == pbike10)
        {
                if(OnJob[playerid] == 0)
                {
                        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                        DisablePlayerCheckpoint(playerid);
                        SendClientMessage(playerid, -1, "{00FF00}You have completed a delivery, get on another bike to start another delivery.");
                        GivePlayerMoney(playerid, 250);
                        OnJob[playerid] = 0;
                        PizzaDelivered[playerid] = 0;
                }

                if(!IsPlayerInRangeOfPoint(playerid, 2, 2128.1113, -1819.1235, 13.5534))
                {
                    if(OnJob[playerid] == 1)
                    {
                                new tip, string[250]; tip = random(150);
                                format(string, sizeof(string), "{00FF00}You have delivered a pizza, you earned a ($%i) tip. Return to the Pizza Parlour to earn your pay.", tip);
                                GivePlayerMoney(playerid, tip);
                                SendClientMessage(playerid, -1, string);
                                SetPlayerCheckpoint(playerid, 2128.1113, -1819.1235, 13.5534, 3.0);
                                OnJob[playerid] = 0;
                                PizzaDelivered[playerid] = 1;
                        }
                }
        }
        return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
        OnJob[playerid] = 0;
        PizzaDelivered[playerid] = 0;
        return 1;
}



Re: Pizzaboy minimission issue - dominik523 - 19.02.2015

Try to change this:
pawn Код:
{
                        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                        DisablePlayerCheckpoint(playerid);
                        SendClientMessage(playerid, -1, "{00FF00}You have completed a delivery, get on another bike to start another delivery.");
                        GivePlayerMoney(playerid, 250);
                        OnJob[playerid] = 0; // <--- OnJob[playerid] = 1;
                        PizzaDelivered[playerid] = 0;
                }



Re: Pizzaboy minimission issue - VictorCreed - 19.02.2015

Nah, tried that but doesn't work tho :/