Loop - not working. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Loop - not working. (
/showthread.php?tid=99782)
Loop - not working. -
Striker_Moe - 30.09.2009
Код:
public turfwar()
{
new rand = random(sizeof(checkpoints));
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerCheckpoint(i,2,checkpoints[rand][0],0,0,0,5.0);
}
SendClientMessageToAll(COLOR_YELLOW,"[INFO] A enemy area is now avaible to take over. Go, find it and take it!");
SendClientMessageToAll(COLOR_YELLOW,"[INFO] The area is marked on your map! Go there and enter the checkpoint.");
}
Aight I got this to show a checkpoint for everyone, but it doesnt want to show up. I was ID 0 on my test server, maybe thats why?
Re: Loop - not working. -
Correlli - 30.09.2009
You're not using SetPlayerCheckpoint correctly.
SetPlayerCheckpoint(playerid, Float
, Float:y, Float:z, Float
ize);
Re: Loop - not working. -
Striker_Moe - 30.09.2009
I dont know, Iґve never worked with random before. Thats what I got:
new Float: checkpoints[][4] =
{
{ -18.4717,2349.4331,24.1406 },
{ -439.3994,2229.5598,42.3833 },
{ -793.1042,2772.0095,45.6958 },
{ 637.9069,1686.1379,6.9871 }
};
The public is supposed to take a random checkpoint from there and show it to all players.
Re: Loop - not working. -
dice7 - 30.09.2009
pawn Код:
SetPlayerCheckpoint(i,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],5.0);
Re: Loop - not working. -
Correlli - 30.09.2009
Try this:
pawn Код:
new Float:checkpoints[4][3] =
{
{-18.4717, 2349.4331, 24.1406},
{-439.3994, 2229.5598, 42.3833},
{-793.1042, 2772.0095, 45.6958},
{637.9069, 1686.1379, 6.9871}
};
new randomCheckpoint = random(sizeof(checkpoints));
SetPlayerCheckpoint(i, checkpoints[randomCheckpoint][0], checkpoints[randomCheckpoint][1], checkpoints[randomCheckpoint][2], 5.0);