SA-MP Forums Archive
Chekpoints - 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: Chekpoints (/showthread.php?tid=317744)



Chekpoints - Alex.Cone - 12.02.2012

I want to make sweeper job, and I don't know how to make random checkpoints. I have 10 chekpoints, and they come random, how can i make that?


Re: Chekpoints - IceCube! - 12.02.2012

make an array like this.

pawn Код:
new Sweeper[][3]
{
       {X, Y, Z},
       {X, Y, Z}
};
In your command use

pawn Код:
new rand = random(sizeof(Sweeper));
Stting the checkpoint - Use Sweeper[rand][0], 0 = X 1 = Y 2 = Z etc



Re: Chekpoints - EightTwoFourThree - 12.02.2012

First add that to the top of script (After includes):
pawn Код:
new Float:RandCp[] [] = {
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0} // Change/Add X Y Z Coorinates
};
Then, put it On OnGameModeInit:
pawn Код:
new rand = random(sizeof(RandCp));
CreateDynamicCP(RandCp[rand][0], RandCp[rand][1], RandCp[rand][2]); // << Change to your Streaming Function



Re: Chekpoints - IceCube! - 12.02.2012

Quote:
Originally Posted by EightTwoFourThree
Посмотреть сообщение
First add that to the top of script (After includes):
pawn Код:
new Float:RandCp[] [] = {
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0}, // Change/Add X Y Z Coorinates
{0.0,0.0,0.0} // Change/Add X Y Z Coorinates
};
Then, put it On OnGameModeInit:
pawn Код:
new rand = random(sizeof(RandCp));
CreateDynamicCP(RandCp[rand][0], RandCp[rand][1], RandCp[rand][2]); // << Change to your Streaming Function

That shouldnt be under on gamemode init it should be under a forward or under a command!. You also did your array wrong as you havnt defined how meny bits of information are inside the brackets.

Again please do not post, useless, uneeded or offtopic posts


Re: Chekpoints - EightTwoFourThree - 12.02.2012

That might be true, I took it from my own script and edited it as Checkpoint.
(In my script it works well...)

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
Again please do not post, useless, uneeded or offtopic posts
I may posted something wrong mistakely, I'm taking it as an insult. Don't do that.


Re: Chekpoints - MP2 - 12.02.2012

I made this for someone a few days ago: http://pastebin.com/XLbKQvfx


Re: Chekpoints - IceCube! - 12.02.2012

Just to clarify if you had that working in your script thats a miracle. There are to meny things wrong with that for it to work


Re: Chekpoints - Alex.Cone - 12.02.2012

And how to make, that they got 40$ for evry cp?


Re: Chekpoints - EightTwoFourThree - 12.02.2012

pawn Код:
public OnPlayerEnterCheckpoint(playerid, checkpointid)
{
    if(IsPlayerInCheckPoint(playerid, CPID) // Change to your Streaming functions
    {
        GivePlayerMoney(playerid, 40);
    }
    return 1;
}



Re: Chekpoints - MP2 - 13.02.2012

You don't use a checkpoint streamer for race checkpoints. You only show one at a time..