12.02.2012, 12:24
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?
new Sweeper[][3]
{
{X, Y, Z},
{X, Y, Z}
};
new rand = random(sizeof(Sweeper));
Stting the checkpoint - Use Sweeper[rand][0], 0 = X 1 = Y 2 = Z etc
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
};
new rand = random(sizeof(RandCp));
CreateDynamicCP(RandCp[rand][0], RandCp[rand][1], RandCp[rand][2]); // << Change to your Streaming Function
First add that to the top of script (After includes):
pawn Код:
pawn Код:
|
public OnPlayerEnterCheckpoint(playerid, checkpointid)
{
if(IsPlayerInCheckPoint(playerid, CPID) // Change to your Streaming functions
{
GivePlayerMoney(playerid, 40);
}
return 1;
}