SA-MP Forums Archive
How to make, wait for other player to join ? - 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: How to make, wait for other player to join ? (/showthread.php?tid=498572)



How to make, wait for other player to join ? - Dipto - 04.03.2014

Hi,
i am making a race with check points, now i made /race to join the race, but how to make the player wait, until other player join. any idea ? please answer me with a reply, thanks

regards Dipto


Re: How to make, wait for other player to join ? - rangerxxll - 04.03.2014

Not too sure what you're asking.

You're trying to make it so you need more than 1 player to begin a race? That's quite easy. Simply create a variable. And once the variable turns to 2 begin the race.

pawn Код:
new pcount; //Just raise this variable when someone joins the race lobby. To raise it simply do pcount++;
Once the pcount hits 2, begin the race. You can check if it's 2 or not with timers. https://sampwiki.blast.hk/wiki/SetTimer

If you need more assistance, let me know.


Re: How to make, wait for other player to join ? - Nurgle4 - 04.03.2014

You can make it like when someone join the race the raceplayers will get +1 so add this under your /race:
pawn Код:
raceplayers ++:
And add this near the other news...
pawn Код:
new raceplayers = 0:
And if you want the race to start ,just add
pawn Код:
if(raceplayers >=2)
{
    The code
}



Re: How to make, wait for other player to join ? - Dipto - 04.03.2014

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Not too sure what you're asking.

You're trying to make it so you need more than 1 player to begin a race? That's quite easy. Simply create a variable. And once the variable turns to 2 begin the race.

pawn Код:
new pcount; //Just raise this variable when someone joins the race lobby. To raise it simply do pcount++;
Once the pcount hits 2, begin the race. You can check if it's 2 or not with timers. https://sampwiki.blast.hk/wiki/SetTimer

If you need more assistance, let me know.
yo, u helped me so much, as i m new to scripting


Re: How to make, wait for other player to join ? - rangerxxll - 04.03.2014

Not a problem. I know how it feels to be new. Quite overwhelming.