[Pawn] Help with race - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Help with race (/showthread.php?tid=1313) |
Help with race - FeNiixX - 2020-11-05 Hello everyone, I have the following question ... How can I achieve that if a player types /enter and if a race is already in progress that the player is put in spectator mode of some user who is in the current race and if he presses enter, specifies another user and so on until that the current race ends and he enters the race ... The other thing is that if there is no race in progress and the user types /enter the race start and the user enters the race automatically ... Thanks RE: Help with race - dwp12345 - 2020-11-06 make new variable,?new bool:RaceStarted; if(RaceStarted == true) { ? ? ? ? ?// Spectate code } else if(RaceStarted == false) { // enter race code } RE: Help with race - FeNiixX - 2020-11-06 Hi, thanks for your response I understand that, the detail is how to make the code to specify a random player that is already within a race, if I explain myself? and if I press enter, it specifies another player who is already within a race if(RaceStarted == true) { //What would be the code here that is going to show a random player who is in a race in progress? } else if(RaceStarted == false) { // enter race code } And if I press enter to switch me to another random player that is still within a race? RE: Help with race - Pinch - 2020-11-06 Code: // Change 20 to max race entries or MAX_PLAYERS if it's not limited Also, don't forget to add PlayerSpectatePlayer(playerid, Iter_Random(RaceMembers)); to the OnPlayerKeyStateChange RE: Help with race - dwp12345 - 2020-11-06 if(RaceStarted == true) { ? ? ? ? ?for(new i = 0 i < MAX_PLAYERS; i ) ? ? ? ? ?{ ? ? ? ? ? ? ? ? If(IsPlayerConnected(i) && PlayerOnRace[playerid] == true) ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ?new rand =?Random(i); ? ? ? ? ? ? ? ? ? ? ? ? ? ?TogglePlayerSpectating(playerid,1);? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PlayerSpectatePlayer(playerid,rand); ? ? ? ? ? ? ? ? } ? ? ? ? ?} } else if(RaceStarted == false) { // enter race code } RE: Help with race - Pinch - 2020-11-06 (2020-11-06, 11:20 AM)dwp12345 Wrote: if(RaceStarted == true) This is just...no...?? RE: Help with race - FeNiixX - 2020-11-06 (2020-11-06, 12:23 PM)Pinch Wrote:(2020-11-06, 11:20 AM)dwp12345 Wrote: if(RaceStarted == true) Which one should work? RE: Help with race - Pinch - 2020-11-06 (2020-11-06, 07:38 PM)FeNiixX Wrote:(2020-11-06, 12:23 PM)Pinch Wrote:(2020-11-06, 11:20 AM)dwp12345 Wrote: if(RaceStarted == true) If you're using mine, it should work if you have YSI included, their solution is terrible and it won't work at al... Just be smart and cautious while using mine because you need to handle iterators RE: Help with race - FeNiixX - 2020-11-06 I try, but it does not specify the players who are in the race, that is, if I put the / enter command and if there are already players participating in the race, it does not specify them ... what can it be? |