Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new numberLopped[MAX_TEAMS_FOOTBALL];
- timer onMatch[30*1000](id) {
- if(numberLopped[id] == 0 || numberLopped[id] == 1 || numberLopped[id] == 2) {
- new szMessage[256];
- szMessage[0] = EOS;
- new sansaHome = random(100) - floatround(matchVariables[id][cota1]);
- new sansaAway = random(100) - floatround(matchVariables[id][cota2]);
- new sansaEqual = random(100) - floatround(matchVariables[id][cotaX]);
- new cases;
- if(sansaHome > sansaAway > sansaEqual) cases = 1;
- else if(sansaAway > sansaHome > sansaEqual) cases = 3;
- else if((sansaEqual > sansaHome > sansaAway) && numberLopped[id] != 0) cases = 2;
- else if(numberLopped[id] != 0) cases = 2;
- else cases = 1;
- switch(cases) {
- case 1: {
- goalshome[id]++;
- foreach(new x : betTeam[id]) {
- format(szMessage, 256, "{52d467}[BET UPDATE] %s just scored! The score is now %d - %d (%s). Your bet: %s.", matchVariables[id][home], goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
- SCM(x, -1, szMessage);
- }
- }
- case 2: {
- foreach(new x : betTeam[id]) {
- format(szMessage, 256, "{52d467}[BET UPDATE] The score is still %d - %d (%s). Your bet: %s.", goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
- SCM(x, -1, szMessage);
- }
- }
- case 3: {
- goalsaway[id]++;
- foreach(new x : betTeam[id]) {
- format(szMessage, 256, "{52d467}[BET UPDATE] %s just scored! The score is now %d - %d (%s). Your bet: %s.", matchVariables[id][away], goalshome[id], goalsaway[id], matchVariables[id][nameplm], getMyBet(x));
- SCM(x, -1, szMessage);
- }
- }
- }
- }
- else if(numberLopped[id] == 3) {
- new szFinal[256];
- new win = -1;
- szFinal[0] = EOS;
- if(goalsaway[id] > goalshome[id]) {
- win = 2;
- format(szFinal, 256, "[MATCH OVER]{dad953} %s won against %s. Final score: %d - %d. ", matchVariables[id][away], matchVariables[id][home], goalshome[id], goalsaway[id]);
- }
- else if(goalsaway[id] < goalshome[id]) {
- win = 0;
- format(szFinal, 256, "[MATCH OVER]{dad953} %s won against %s. Final score: %d - %d. ", matchVariables[id][home], matchVariables[id][away], goalshome[id], goalsaway[id]);
- }
- else {
- win = 1;
- format(szFinal, 256, "[MATCH OVER]{dad953} %s has ended equally. Final score: %d - %d. ", matchVariables[id][nameplm], goalshome[id], goalsaway[id]);
- }
- foreach(new x : betTeam[id]) {
- new szMessage[20];
- szMessage[0] = EOS;
- format(szMessage, 20, "Your bet: %s.", getMyBet(x));
- strcat(szFinal, szMessage);
- SCM(x, COLOR_RED, szFinal);
- if(win == GetPVarInt(x, "betCota")) {
- new payment = floatround(GetPVarFloat(x, "betPossibleWin")*GetPVarInt(x, "betMoney"));
- GivePlayerMoney(x, payment);
- new string[256];
- format(string, 256, "(+) You've won $%s.", FormatNumber(floatround(GetPVarFloat(x, "betPossibleWin")*GetPVarInt(x, "betMoney"))));
- SCM(x, COLOR_RED, string);
- }
- else SCM(x, COLOR_RED, "(-) You've lost. Try again next time!");
- deleteBetPVars(x);
- Iter_SafeRemove(betTeam[id], x, x);
- }
- stop playingMatch[id];
- playingMatch[id] = Timer:-1;
- prepareTeams(id);
- }
- numberLopped[id]++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement