Advertisement
Guest User

Untitled

a guest
May 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.53 KB | None | 0 0
  1. publics boxbet( score )
  2. {
  3.     new rows,
  4.         string[256];
  5.  
  6.     rows = cache_get_row_count(Mysql);
  7.     if(rows)
  8.     {
  9.         for(new id; id < rows; id++)
  10.         {
  11.             new com_1[32],
  12.                 com_2[32],
  13.                 name_player[24];
  14.  
  15.             new idx = cache_get_field_content_int(id, "ID");   
  16.             cache_get_field_content(id, "Command_Name_1", com_1, Mysql);
  17.             cache_get_field_content(id, "Command_Name_2", com_2, Mysql);
  18.             new Float:cof_1 = cache_get_field_content_float(id, "Command_1", Mysql);
  19.             new Float:cof_2 = cache_get_field_content_float(id, "Command_2", Mysql);
  20.             new Float:cof_3 = cache_get_field_content_float(id, "Command_X", Mysql);
  21.             cache_get_field_content(id, "Name_Player", name_player, Mysql);
  22.             new money = cache_get_field_content_int(id, "Money");  
  23.  
  24.             switch( score )
  25.             {
  26.                 case 1:
  27.                 {
  28.                     if( cof_1 )
  29.                     {
  30.                         new online;
  31.                         for(new i; i < MAX_PLAYERS; i++)
  32.                         {
  33.                             new name[MAX_PLAYER_NAME];
  34.                             GetPlayerName(i, name, sizeof(name));
  35.                             if(PlayerLogin[i])
  36.                             {
  37.                                 if(!strcmp(name, name_player, true)) online = i + 1;
  38.                             }
  39.                         }
  40.                         if( online )
  41.                         {
  42.                             SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
  43.                             Player[online-1][pBank] += floatround( money * cof_1 );
  44.                             updatePlayer( online-1, "Bank", Player[online-1][pBank] );
  45.                         }
  46.                         if( !online )
  47.                         {
  48.                             mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_1 ), name_player);
  49.                             mysql_tquery( Mysql, string );
  50.                         }  
  51.                     }
  52.                 }
  53.                 case 2:
  54.                 {
  55.                     if( cof_2 )
  56.                     {
  57.                         new online;
  58.                         for(new i; i < MAX_PLAYERS; i++)
  59.                         {
  60.                             new name[MAX_PLAYER_NAME];
  61.                             GetPlayerName(i, name, sizeof(name));
  62.                             if(PlayerLogin[i])
  63.                             {
  64.                                 if(!strcmp(name, name_player, true)) online = i + 1;
  65.                             }
  66.                         }
  67.                         if( online )
  68.                         {
  69.                             SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
  70.                             Player[online-1][pBank] += floatround( money * cof_2 );
  71.                             updatePlayer( online-1, "Bank", Player[online-1][pBank] );
  72.                         }
  73.                         if( !online )
  74.                         {
  75.                             mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_2 ), name_player);
  76.                             mysql_tquery( Mysql, string );
  77.                         }  
  78.                     }
  79.                 }
  80.                 case 3:
  81.                 {
  82.                     if( cof_3 )
  83.                     {
  84.                         new online;
  85.                         for(new i; i < MAX_PLAYERS; i++)
  86.                         {
  87.                             new name[MAX_PLAYER_NAME];
  88.                             GetPlayerName(i, name, sizeof(name));
  89.                             if(PlayerLogin[i])
  90.                             {
  91.                                 if(!strcmp(name, name_player, true)) online = i + 1;
  92.                             }
  93.                         }
  94.                         if( online )
  95.                         {
  96.                             SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
  97.                             Player[online-1][pBank] += floatround( money * cof_3 );
  98.                             updatePlayer( online-1, "Bank", Player[online-1][pBank] );
  99.                         }
  100.                         if( !online )
  101.                         {
  102.                             mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_3 ), name_player);
  103.                             mysql_tquery( Mysql, string );
  104.                         }  
  105.                     }
  106.                 }
  107.             }
  108.             format(string, sizeof(string), "DELETE FROM `boxbet` WHERE `ID` = '%i'", idx);
  109.             mysql_tquery(Mysql, string, "","");
  110.         }  
  111.     }
  112.     return 1;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement