09.06.2015, 18:50
Quote:
|
Lottery number between 1 - 30
What i want to do it that it selects any number that is free for the player here PlayerInfo[i][pLottoNumber] this stores players lotto number I can't really make the logic for it tired of thinking how it will work. pawn Код:
|
Quote:
|
No that's not what i am trying to do i have a lottery system with a draw at certain time we need to buy tickets for it. There are 3 options to buy tickets 1 select number our own self, 2 get a random number and 3 get a number that is free starting from 1 - 30 in sequence.
So the part i can't figure out is 3rd one i tried that code i posted up |
I have one!
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/lotto", cmdtext, true) == 0)
{
new tmp[256];
new Ergebniss;
GivePlayerMoney(playerid, -2000);
Jackpot = Jackpot + 2000;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Benutzung: /lotto [Choose a number 1-99]");
return 1;
}
if (GetPlayerMoney(playerid)>=0 && GetPlayerMoney(playerid)<=100000)
{
Ergebniss = 9;
Lottozahl = Lottozahl + Ergebniss;
if(Lottozahl >=100)
{
Lottozahl = 0 + Ergebniss;
}
}
if (GetPlayerMoney(playerid)>=100000 && GetPlayerMoney(playerid)<=1000000)
{
Ergebniss = 8;
Lottozahl = Lottozahl + Ergebniss;
if(Lottozahl >=100)
{
Lottozahl = 0 + Ergebniss;
}
}
if (GetPlayerMoney(playerid)>=1000000 && GetPlayerMoney(playerid)<=999999999)
{
Ergebniss = 7;
Lottozahl = Lottozahl + Ergebniss;
if(Lottozahl >=100)
{
Lottozahl = 0 + Ergebniss;
}
}
if(strval(tmp) == Lottozahl)
{
GivePlayerMoney(playerid, Jackpot);
}
return 1;
}
return 0;
}

