SA-MP Forums Archive
Random Checkpoints and money - 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: Random Checkpoints and money (/showthread.php?tid=492561)



Random Checkpoints and money - ross8839 - 04.02.2014

I've tried everything I know how, so can anyone else help me out with this problem please?

I enter the checkpoint, it gives me random amount... either 30 or 50... but i only want specific checkpoints to give me that money... this is for a pizza job for an rp script im working on, that explains the non random checkpoint... which is the pizza parlour... also, I only want the PIZZA PARLOUR checkpoint to pay up, not the random checkpoints :/

if you fix this, i will love you forever....

enum/array
pawn Код:
new PizzaCP1[MAX_PLAYERS];
new PizzaCPReturn[MAX_PLAYERS];
enum pRandomPizza {
    Float:pizzaX,
    Float:pizzaY,
    Float:pizzaZ,
    pizzamoney
}

new entered1[MAX_PLAYERS];

new pizzapay[MAX_PLAYERS];

new Float:RandomPizza[][pRandomPizza] = //where?
{
    {132.1640,-70.3740,1.5781,30},
    {170.0347,-52.9291,1.5781,50}
};
command:
pawn Код:
CMD:start(playerid, params[])
{
    entered1[playerid] = 1;
    new rand = random(sizeof(RandomPizza));
    PizzaCP1[playerid] = CreateDynamicCP(RandomPizza[rand][pizzaX], RandomPizza[rand][pizzaY], RandomPizza[rand][pizzaZ], 3.0, 0, 0,playerid, 100.0);
    pizzapay[playerid] = RandomPizza[rand][pizzamoney];
    return 1;
}
onplayerentercheckpoint
pawn Код:
public OnPlayerEnterDynamicCP(playerid)
{
    new rand = random(sizeof(RandomPizza));
    if(entered1[playerid] == 1)
    {
        DestroyDynamicCP(PizzaCP1[playerid]);
        PizzaCPReturn[playerid] = CreateDynamicCP(196.4546,-28.6804,1.5781, 3.0, 0, 0,playerid, 100.0);
        entered1[playerid] = 2;
    }
    if(entered1[playerid] == 2)
    {
        DestroyDynamicCP(PizzaCPReturn[playerid]);
        PizzaCP1[playerid] = CreateDynamicCP(RandomPizza[rand][pizzaX], RandomPizza[rand][pizzaY], RandomPizza[rand][pizzaZ], 3.0, 0, 0,playerid, 100.0);
        entered1[playerid] = 1;
        GivePlayerMoney(playerid, pizzapay[playerid]);
    }
    return 1;
}



Re: Random Checkpoints and money - ross8839 - 04.02.2014

Anyone, this is slowly killing me inside...


Re: Random Checkpoints and money - ross8839 - 04.02.2014

what, no-one knows how to fix this?