Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- publics boxbet( score )
- {
- new rows,
- string[256];
- rows = cache_get_row_count(Mysql);
- if(rows)
- {
- for(new id; id < rows; id++)
- {
- new com_1[32],
- com_2[32],
- name_player[24];
- new idx = cache_get_field_content_int(id, "ID");
- cache_get_field_content(id, "Command_Name_1", com_1, Mysql);
- cache_get_field_content(id, "Command_Name_2", com_2, Mysql);
- new Float:cof_1 = cache_get_field_content_float(id, "Command_1", Mysql);
- new Float:cof_2 = cache_get_field_content_float(id, "Command_2", Mysql);
- new Float:cof_3 = cache_get_field_content_float(id, "Command_X", Mysql);
- cache_get_field_content(id, "Name_Player", name_player, Mysql);
- new money = cache_get_field_content_int(id, "Money");
- switch( score )
- {
- case 1:
- {
- if( cof_1 )
- {
- new online;
- for(new i; i < MAX_PLAYERS; i++)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(i, name, sizeof(name));
- if(PlayerLogin[i])
- {
- if(!strcmp(name, name_player, true)) online = i + 1;
- }
- }
- if( online )
- {
- SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
- Player[online-1][pBank] += floatround( money * cof_1 );
- updatePlayer( online-1, "Bank", Player[online-1][pBank] );
- }
- if( !online )
- {
- mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_1 ), name_player);
- mysql_tquery( Mysql, string );
- }
- }
- }
- case 2:
- {
- if( cof_2 )
- {
- new online;
- for(new i; i < MAX_PLAYERS; i++)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(i, name, sizeof(name));
- if(PlayerLogin[i])
- {
- if(!strcmp(name, name_player, true)) online = i + 1;
- }
- }
- if( online )
- {
- SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
- Player[online-1][pBank] += floatround( money * cof_2 );
- updatePlayer( online-1, "Bank", Player[online-1][pBank] );
- }
- if( !online )
- {
- mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_2 ), name_player);
- mysql_tquery( Mysql, string );
- }
- }
- }
- case 3:
- {
- if( cof_3 )
- {
- new online;
- for(new i; i < MAX_PLAYERS; i++)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(i, name, sizeof(name));
- if(PlayerLogin[i])
- {
- if(!strcmp(name, name_player, true)) online = i + 1;
- }
- }
- if( online )
- {
- SendClientMessage(online-1, COLOR_RED, "Вы выиграли ставку на матч. Вам были перечислены деньги в банк.");
- Player[online-1][pBank] += floatround( money * cof_3 );
- updatePlayer( online-1, "Bank", Player[online-1][pBank] );
- }
- if( !online )
- {
- mysql_format(Mysql, string, sizeof(string),"UPDATE `players` SET `Bank` = '%d' WHERE `Names` = '%s'", floatround( money * cof_3 ), name_player);
- mysql_tquery( Mysql, string );
- }
- }
- }
- }
- format(string, sizeof(string), "DELETE FROM `boxbet` WHERE `ID` = '%i'", idx);
- mysql_tquery(Mysql, string, "","");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement