Bet System
#2

First, have some global variables.
PHP код:
 new PlayerBet[MAX_PLAYERS];
new 
RaceWinner
Set that value to -1 Under OnPlayerConnect to you know, reset the variable.
PHP код:
 PlayerBet[playerid] = -1
then, inside /bet command, set PlayerBet[playerid] to the a playerid he put the bet on.
after that when a player finishes the race, make it automatically by entering the CP or something or manually by using, /setwinner for admins.

Then, using a loop, just check what player had win.
PHP код:
new pCount;
foreach(new 
Player)
{
      if(
PlayerBet[i] >= 0)
           
pcount++;
}

for(new 
0;i<pCount;i++)
{
         if(
PlayerBet[i] == RaceWinner)
           {
                   
SCM(i, -1"You won the bet!");
                   
GivePlayerMoney(i,5000); //You can give em money or something.
            
}
          else if(
PlayerBet[i] == -1) continue; //People who didnt placed bet.
           
else SCM(i, -1"Sorry you lost the bet.");
        
           
PlayerBet[i] = -1//We gotta reset the variable, making it ready for next race, right!!

Well, thats the rough idea of how to do it.. I hope you get the idea.. if some problem comes, you can ask again.
Reply


Messages In This Thread
Bet System - by TadePoleMG - 14.05.2018, 12:37
Re: Bet System - by GTLS - 14.05.2018, 14:50
Re: Bet System - by TadePoleMG - 16.05.2018, 08:30

Forum Jump:


Users browsing this thread: 1 Guest(s)