Created
June 27, 2016 12:55
-
-
Save anonymous/96fda674aae88f388013ddff52140a08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
(c)Syme | |
*/ | |
/* includes */ | |
#include <a_samp> | |
#include <streamer> | |
/* combo defines */ | |
#define COMBO_DOUBLE_GOLD 1 | |
#define COMBO_GOLD 2 | |
#define COMBO_CHERRY 3 | |
#define COMBO_BELL 4 | |
#define COMBO_69 5 | |
#define COMBO_GRAPES 6 | |
#define sm_count 6 // кол-во слот-машин | |
main(){} | |
/* rotation info */ | |
new Float: image_rot [ ] ={ 3.00, 23.00, 43.00, 63.00, 83.00, 103.00, 123.00, 143.00, 163.00, 183.00, 203.00, 223.00, 243.00, 263.00, 283.00, 303.00, 323.00, 343.00, 363.00 } ; | |
new Float: cherry_combo [ 4 ] ={ 23.00, 163.00, 223.00, 343.00 } ; | |
new Float: gold_combo [ 2 ] ={ 183.00, 303.00 } ; | |
new Float: bell_combo [ 4 ] ={ 63.00, 103.00, 243.00, 323.00 } ; | |
new Float: grapes_combo [ 5 ] ={ 3.00, 83.00, 143.00, 283.00, 363.00 } ; | |
new Float: sn_combo [ 3 ] ={ 43.00, 123.00, 263.00 } ; | |
/* Стат автомата */ | |
new bool: sm_used [ sm_count ] ; | |
/* Ручки автоматов */ | |
new sm_hand [ sm_count ] ; | |
new Float: sm_hand_coord [ sm_count ] [ 6 ] ={ | |
{ 2255.27051, 1609.61804, 1005.81678, 15.00000, 0.00000, 0.00000 }, | |
{ 2255.23047, 1610.11804, 1005.81678, 15.00000, 0.00000, 180.00000 }, | |
{ 2255.27051, 1613.65796, 1005.81678, 15.00000, 0.00000, 0.00000 }, | |
{ 2255.23047, 1614.15796, 1005.81678, 15.00000, 0.00000, 180.00000 }, | |
{ 2255.27051, 1617.55798, 1005.81678, 15.00000, 0.00000, 0.00000 }, | |
{ 2255.23047, 1618.05798, 1005.81678, 15.00000, 0.00000, 180.00000 } | |
} ; | |
/* Слот-механизмы автоматов */ | |
new sm_slot [ sm_count * 3 ] ; | |
new Float: sm_slot_coord [ sm_count * 3 ] [ 6 ] ={ | |
{ 2255.15039, 1609.70215, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.26050, 1609.70215, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.37061, 1609.70215, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.3599, 1610.0387, 1006.7222, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.25000, 1610.03870, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.13989, 1610.03870, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.15039, 1613.74207, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.26050, 1613.74207, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.37061, 1613.74207, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.35986, 1614.07874, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.25000, 1614.07874, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.13989, 1614.07874, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.15039, 1617.64209, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.26050, 1617.64209, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.37061, 1617.64209, 1006.72223, 3.00000, 0.00000, 0.00000 }, | |
{ 2255.35986, 1617.97876, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.25000, 1617.97876, 1006.72223, 3.00000, 0.00000, 180.00000 }, | |
{ 2255.13989, 1617.97876, 1006.72223, 4.00000, 0.00000, 180.00000 } | |
} ; | |
/* Зона использования автомата */ | |
new Float: sm_coord [ sm_count ] [ 3 ] = { | |
{ 2255.3538, 1608.2896, 1006.1860 }, | |
{ 2255.2034, 1611.2628, 1006.1797 }, | |
{ 2255.3030, 1612.6776, 1006.1797 }, | |
{ 2255.1860, 1615.4429, 1006.1797 }, | |
{ 2255.2361, 1616.5598, 1006.1797 }, | |
{ 2255.2834, 1618.9281, 1006.1797 } | |
} ; | |
/* TextDraws */ | |
new Text: sm_td [ 4 ] ; | |
new PlayerText: sm_ptd [ MAX_PLAYERS ] = {PlayerText:-1, ...} ; | |
public OnGameModeInit() | |
{ | |
AddPlayerClass ( 0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0 ) ; | |
/* Коробки автоматов */ | |
CreateDynamicObject ( 1948, 2255.22510, 1609.66577, 1006.73523, 0.00000, 0.00000, 0.00000 ) ; | |
CreateDynamicObject ( 1948, 2255.28516, 1610.07581, 1006.73523, 0.00000, 0.00000, 180.00000 ) ; | |
CreateDynamicObject ( 1948, 2255.22510, 1613.70593, 1006.73523, 0.00000, 0.00000, 0.00000 ) ; | |
CreateDynamicObject ( 1948, 2255.28516, 1614.11584, 1006.73523, 0.00000, 0.00000, 180.00000 ) ; | |
CreateDynamicObject ( 1948, 2255.22510, 1617.60596, 1006.73523, 0.00000, 0.00000, 0.00000 ) ; | |
CreateDynamicObject ( 1948, 2255.28516, 1618.01587, 1006.73523, 0.00000, 0.00000, 180.00000 ) ; | |
/* Ручки автоматов */ | |
for ( new i = 0 ; i < sm_count; i ++ ) | |
{ | |
sm_hand [ i ] = CreateDynamicObject ( 1832, sm_hand_coord [ i ] [ 0 ], sm_hand_coord [ i ] [ 1 ], sm_hand_coord [ i ] [ 2 ], sm_hand_coord [ i ] [ 3 ], sm_hand_coord [ i ] [ 4 ], sm_hand_coord [ i ] [ 5 ] ) ; | |
SetDynamicObjectMaterial ( sm_hand [ i ], 0, -1, "none", "none", 255 ) ; | |
SetDynamicObjectMaterial ( sm_hand [ i ], 2, -1, "none", "none", 255 ) ; | |
} | |
/* Слот-механизмы автоматов */ | |
for ( new i = 0 ; i < sm_count * 3; i ++ ) | |
{ | |
sm_slot [ i ] = CreateDynamicObject ( 2349, sm_slot_coord [ i ] [ 0 ], sm_slot_coord [ i ] [ 1 ], sm_slot_coord [ i ] [ 2 ], sm_slot_coord [ i ] [ 3 ], sm_slot_coord [ i ] [ 4 ], sm_slot_coord [ i ] [ 5 ] ) ; | |
} | |
/* Текстдравы */ | |
sm_td [ 0 ] = TextDrawCreate ( 276.000000, 355.000000, " SET" ) ; | |
TextDrawBackgroundColor ( sm_td [ 0 ], 255 ) ; | |
TextDrawFont ( sm_td [ 0 ], 2 ) ; | |
TextDrawLetterSize ( sm_td [ 0 ], 0.419999, 2.099999 ) ; | |
TextDrawColor ( sm_td [ 0 ], -2711041 ) ; | |
TextDrawSetOutline ( sm_td [ 0 ], 0 ) ; | |
TextDrawSetProportional ( sm_td [ 0 ], 1 ) ; | |
TextDrawSetShadow ( sm_td [ 0 ], 1 ) ; | |
TextDrawBoxColor ( sm_td [ 0 ], 255 ) ; | |
TextDrawTextSize ( sm_td [ 0 ], 336.000000, 12.000000 ) ; | |
TextDrawSetSelectable ( sm_td [ 0 ], 1 ) ; | |
sm_td [ 1 ] = TextDrawCreate ( 375.000000, 355.000000, " RESET" ) ; | |
TextDrawBackgroundColor ( sm_td [ 1 ], 255 ) ; | |
TextDrawFont ( sm_td [ 1 ], 2 ) ; | |
TextDrawLetterSize ( sm_td [ 1 ], 0.419999, 2.099999 ) ; | |
TextDrawColor ( sm_td [ 1 ], -2711041 ) ; | |
TextDrawSetOutline ( sm_td [ 1 ], 0 ) ; | |
TextDrawSetProportional ( sm_td [ 1 ], 1 ) ; | |
TextDrawSetShadow ( sm_td [ 1 ], 1 ) ; | |
TextDrawBoxColor ( sm_td [ 1 ], 255 ) ; | |
TextDrawTextSize ( sm_td [ 1 ], 436.000000, 12.000000 ) ; | |
TextDrawSetSelectable ( sm_td [ 1 ], 1 ) ; | |
sm_td [ 2 ] = TextDrawCreate ( 182.000000, 355.000000, " ~r~Exit" ) ; | |
TextDrawBackgroundColor ( sm_td [ 2 ], 255 ) ; | |
TextDrawFont ( sm_td [ 2 ], 2 ) ; | |
TextDrawLetterSize ( sm_td [ 2 ], 0.419999, 2.099999 ) ; | |
TextDrawColor ( sm_td [ 2 ], -2711041 ) ; | |
TextDrawSetOutline ( sm_td [ 2 ], 0 ) ; | |
TextDrawSetProportional ( sm_td [ 2 ], 1 ) ; | |
TextDrawSetShadow ( sm_td [ 2 ], 1 ) ; | |
TextDrawBoxColor ( sm_td [ 2 ], 255 ) ; | |
TextDrawTextSize ( sm_td [ 2 ], 244.000000, 12.000000 ) ; | |
TextDrawSetSelectable ( sm_td [ 2 ], 1 ) ; | |
sm_td [ 3 ] = TextDrawCreate ( 554.000000, 123.000000, "slot hand" ) ; | |
TextDrawBackgroundColor ( sm_td [ 3 ], 0 ) ; | |
TextDrawFont ( sm_td [ 3 ], 5 ) ; | |
TextDrawLetterSize ( sm_td [ 3 ], 0.500000, 1.000000 ) ; | |
TextDrawColor ( sm_td [ 3 ], 16711935 ) ; | |
TextDrawSetOutline ( sm_td [ 3 ], 0 ) ; | |
TextDrawSetProportional ( sm_td [ 3 ], 1 ) ; | |
TextDrawSetShadow ( sm_td [ 3 ], 1 ) ; | |
TextDrawUseBox ( sm_td [ 3 ], 1 ) ; | |
TextDrawBoxColor ( sm_td [ 3 ], 255 ) ; | |
TextDrawTextSize ( sm_td [ 3 ], 86.000000, 260.000000 ) ; | |
TextDrawSetPreviewModel ( sm_td [ 3 ], 1 ) ; | |
TextDrawSetPreviewRot ( sm_td [ 3 ], -16.000000, 0.000000, -55.000000, -1.000000 ) ; | |
TextDrawSetSelectable ( sm_td [ 3 ], 1 ) ; | |
return 1; | |
} | |
public OnPlayerRequestClass(playerid, classid) | |
{ | |
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746 ) ; | |
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746 ) ; | |
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746 ) ; | |
return 1; | |
} | |
public OnPlayerConnect(playerid) | |
{ | |
/* caligula remove info */ | |
RemoveBuildingForPlayer(playerid, 1836, 2253.1250, 1609.6406, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1563, 1609.6016, 1006.7656, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1836, 2257.2422, 1609.6406, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2253.1016, 1610.1172, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2257.2500, 1610.1172, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1875, 1610.1250, 1006.7656, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2253.1016, 1614.1641, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1836, 2253.1250, 1613.6875, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1563, 1613.6484, 1006.7656, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2257.2500, 1614.1641, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1836, 2257.2422, 1613.6875, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1875, 1614.1719, 1006.7656, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1836, 2253.1250, 1617.5781, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1836, 2257.2422, 1617.5781, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1563, 1617.5469, 1006.7656, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2253.1016, 1618.0547, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 1837, 2257.2500, 1618.0547, 1006.0000, 0.25 ) ; | |
RemoveBuildingForPlayer(playerid, 2325, 2255.1875, 1618.0703, 1006.7656, 0.25 ) ; | |
return 1; | |
} | |
public OnPlayerDisconnect(playerid, reason) | |
{ | |
if ( GetPVarInt ( playerid, "p_sm_used" ) ) | |
{ | |
PlayerTextDrawDestroy ( playerid, sm_ptd [ playerid ] ) ; | |
sm_ptd [ playerid ] = PlayerText:INVALID_TEXT_DRAW ; | |
for ( new i = 0 ; i < 4 ; i ++ ) | |
{ | |
TextDrawHideForPlayer ( playerid, sm_td [ i ] ) ; | |
} | |
new p_sm = GetPVarInt ( playerid, "p_sm_used" ) ; | |
new i = ( p_sm * 2 + ( p_sm - 2 ) ) - 1 ; | |
MoveDynamicObject ( sm_slot [ i ], sm_slot_coord [ i ] [ 0 ], sm_slot_coord [ i ] [ 1 ], sm_slot_coord [ i ] [ 2 ], 1, sm_slot_coord [ i ] [ 3 ], sm_slot_coord [ i ] [ 4 ], sm_slot_coord [ i ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 1 ], sm_slot_coord [ i + 1 ] [ 0 ], sm_slot_coord [ i + 1 ] [ 1 ], sm_slot_coord [ i + 1 ] [ 2 ], 1, sm_slot_coord [ i + 1 ] [ 3 ], sm_slot_coord [ i + 1 ] [ 4 ], sm_slot_coord [ i + 1 ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 2 ], sm_slot_coord [ i + 2 ] [ 0 ], sm_slot_coord [ i + 2 ] [ 1 ], sm_slot_coord [ i + 2 ] [ 2 ], 1, sm_slot_coord [ i + 2 ] [ 3 ], sm_slot_coord [ i + 2 ] [ 4 ], sm_slot_coord [ i + 2 ] [ 5 ] ) ; | |
sm_used [ p_sm - 1 ] = false ; | |
} | |
return 1 ; | |
} | |
public OnPlayerSpawn(playerid) | |
{ | |
GivePlayerMoney ( playerid, 999999 ) ; | |
SetPlayerSkin ( playerid, 77 ) ; | |
return 1; | |
} | |
public OnPlayerCommandText(playerid, cmdtext[]) | |
{ | |
if (strcmp("/gotocasino", cmdtext, true, 10) == 0) | |
{ | |
SetPlayerPos ( playerid, 2255.3538, 1608.2896, 1006.1860 ) ; | |
SetPlayerInterior ( playerid, 1 ) ; | |
return 1; | |
} | |
return 0; | |
} | |
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) | |
{ | |
if ( GetPlayerState ( playerid ) == PLAYER_STATE_ONFOOT ) | |
{ | |
if ( newkeys == KEY_WALK ) | |
{ | |
if ( GetPlayerInterior ( playerid ) != 1 ) return 1 ; | |
if ( GetPVarInt ( playerid, "p_sm_used" ) != 0 ) return 1 ; | |
for ( new sm = 0; sm < sm_count; sm ++ ) | |
{ | |
if ( sm_used [ sm ] != false ) continue ; | |
if ( ! IsPlayerInRangeOfPoint ( playerid, 1.50, sm_coord [ sm ] [ 0 ], sm_coord [ sm ] [ 1 ], sm_coord [ sm ] [ 2 ] ) ) continue ; | |
SetPVarInt ( playerid, "p_sm_used", sm + 1 ) ; | |
TogglePlayerControllable ( playerid, false ) ; | |
sm_used [ sm ] = true ; | |
sm_ptd [ playerid ] = CreatePlayerTextDraw ( playerid, 266.000000, 272.000000, "BET: 0$" ) ; | |
PlayerTextDrawBackgroundColor ( playerid, sm_ptd [ playerid ] , 255 ) ; | |
PlayerTextDrawFont ( playerid, sm_ptd [ playerid ] , 2 ) ; | |
PlayerTextDrawLetterSize ( playerid, sm_ptd [ playerid ] , 0.310000, 2.700000 ) ; | |
PlayerTextDrawColor ( playerid, sm_ptd [ playerid ] , -2711041 ) ; | |
PlayerTextDrawSetOutline ( playerid, sm_ptd [ playerid ] , 1 ) ; | |
PlayerTextDrawSetProportional ( playerid, sm_ptd [ playerid ] , 1 ) ; | |
PlayerTextDrawSetSelectable ( playerid, sm_ptd [ playerid ] , 0 ) ; | |
for ( new i = 0 ; i < 4 ; i ++ ) | |
{ | |
TextDrawShowForPlayer ( playerid, sm_td [ i ] ) ; | |
} | |
PlayerTextDrawShow ( playerid, sm_ptd [ playerid ] ) ; | |
SelectTextDraw ( playerid, 0xFFDA82FF ) ; | |
if ( sm & 1 == 0 ) SetPlayerCameraPos(playerid, sm_hand_coord [ sm ] [ 0 ], sm_hand_coord [ sm ] [ 1 ] - 0.65, sm_hand_coord [ sm ] [ 2 ] + 1 ), SetPlayerCameraLookAt ( playerid, sm_hand_coord [ sm ] [ 0 ], sm_hand_coord [ sm ] [ 1 ] + 1, sm_hand_coord [ sm ] [ 2 ] + 0.6 ) ; | |
else SetPlayerCameraPos(playerid, sm_hand_coord [ sm ] [ 0 ], sm_hand_coord [ sm ] [ 1 ] + 0.65, sm_hand_coord [ sm ] [ 2 ] + 1 ), SetPlayerCameraLookAt ( playerid, sm_hand_coord [ sm ] [ 0 ], sm_hand_coord [ sm ] [ 1 ] - 1, sm_hand_coord [ sm ] [ 2 ] + 0.6 ) ; | |
break ; | |
} | |
} | |
} | |
return 1; | |
} | |
public OnPlayerClickTextDraw ( playerid, Text:clickedid ) | |
{ | |
if ( GetPVarInt ( playerid, "p_sm_used" ) ) | |
{ | |
if(!(_:clickedid ^ 0xFFFF))return SelectTextDraw ( playerid, 0xFFDA82FF ) ; | |
} | |
if ( clickedid == sm_td [ 2 ] ) | |
{ | |
if ( GetPVarInt ( playerid, "sm_started" ) ) return 1 ; | |
SetCameraBehindPlayer ( playerid ) ; | |
TogglePlayerControllable ( playerid, true ) ; | |
CancelSelectTextDraw ( playerid ) ; | |
PlayerTextDrawDestroy ( playerid, sm_ptd [ playerid ] ) ; | |
sm_ptd [ playerid ] = PlayerText:INVALID_TEXT_DRAW ; | |
for ( new i = 0 ; i < 4 ; i ++ ) | |
{ | |
TextDrawHideForPlayer ( playerid, sm_td [ i ] ) ; | |
} | |
sm_used [ GetPVarInt ( playerid, "p_sm_used" ) - 1 ] = false ; | |
DeletePVar ( playerid, "p_sm_used" ) ; | |
return 1 ; | |
} | |
else if ( clickedid == sm_td [ 0 ] ) | |
{ | |
if ( GetPVarInt ( playerid, "sm_started" ) ) return 1 ; | |
ShowPlayerDialog ( playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Размер ставки", "{FFFFFF}Введите размер Вашей ставки:", "Принять", "Отмена" ) ; | |
return 1 ; | |
} | |
else if ( clickedid == sm_td [ 1 ] ) | |
{ | |
if ( GetPVarInt ( playerid, "sm_started" ) ) return 1 ; | |
DeletePVar ( playerid, "sm_bet" ) ; | |
new i = ( GetPVarInt ( playerid, "p_sm_used" ) * 2 + ( GetPVarInt ( playerid, "p_sm_used" ) - 2 ) ) - 1 ; | |
MoveDynamicObject ( sm_slot [ i ], sm_slot_coord [ i ] [ 0 ], sm_slot_coord [ i ] [ 1 ], sm_slot_coord [ i ] [ 2 ], 1, sm_slot_coord [ i ] [ 3 ], sm_slot_coord [ i ] [ 4 ], sm_slot_coord [ i ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 1 ], sm_slot_coord [ i + 1 ] [ 0 ], sm_slot_coord [ i + 1 ] [ 1 ], sm_slot_coord [ i + 1 ] [ 2 ], 1, sm_slot_coord [ i + 1 ] [ 3 ], sm_slot_coord [ i + 1 ] [ 4 ], sm_slot_coord [ i + 1 ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 2 ], sm_slot_coord [ i + 2 ] [ 0 ], sm_slot_coord [ i + 2 ] [ 1 ], sm_slot_coord [ i + 2 ] [ 2 ], 1, sm_slot_coord [ i + 2 ] [ 3 ], sm_slot_coord [ i + 2 ] [ 4 ], sm_slot_coord [ i + 2 ] [ 5 ] ) ; | |
PlayerTextDrawSetString ( playerid, sm_ptd [ playerid ], "bet: 0$" ) ; | |
return 1 ; | |
} | |
else if ( clickedid == sm_td [ 3 ] ) | |
{ | |
if ( GetPVarInt ( playerid, "sm_started" ) ) return 1 ; | |
if ( GetPVarInt ( playerid, "sm_bet" ) == 0 ) return SendClientMessage ( playerid, -1, "* Вы не сделали ставку!" ) ; | |
SetPVarInt ( playerid, "sm_started", 1 ) ; | |
new i = GetPVarInt ( playerid, "p_sm_used" ) - 1 ; | |
if ( i & 1 == 0 ) MoveDynamicObject ( sm_hand [ i ], sm_hand_coord [ i ] [ 0 ], sm_hand_coord [ i ] [ 1 ], sm_hand_coord [ i ] [ 2 ] - 0.30, 1, sm_hand_coord [ i ] [ 3 ] + 20, sm_hand_coord [ i ] [ 4 ], sm_hand_coord [ i ] [ 5 ] ) ; | |
else MoveDynamicObject ( sm_hand [ i ], sm_hand_coord [ i ] [ 0 ], sm_hand_coord [ i ] [ 1 ], sm_hand_coord [ i ] [ 2 ] - 0.30, 1, sm_hand_coord [ i ] [ 3 ] + 20, sm_hand_coord [ i ] [ 4 ], sm_hand_coord [ i ] [ 5 ] ) ; | |
SetTimerEx ( "sm_hand_back", 1000, false, "idd", playerid, sm_hand [ i ], i ) ; | |
} | |
return 1 ; | |
} | |
forward sm_hand_back ( playerid, objectid, i ) ; | |
public sm_hand_back ( playerid, objectid, i ) | |
{ | |
MoveDynamicObject ( objectid, sm_hand_coord [ i ] [ 0 ], sm_hand_coord [ i ] [ 1 ], sm_hand_coord [ i ] [ 2 ], 2, sm_hand_coord [ i ] [ 3 ], sm_hand_coord [ i ] [ 4 ], sm_hand_coord [ i ] [ 5 ] ) ; | |
i = ( ( i + 1 ) * 2 + ( ( i + 1 ) - 2 ) ) - 1 ; | |
SetTimerEx ( "sm_move", 348, false, "id", playerid, i ) ; | |
return 1 ; | |
} | |
forward sm_move ( playerid, i ) ; | |
public sm_move ( playerid, i ) | |
{ | |
new Float: obj_pos_z ; | |
new move_time ; | |
GetDynamicObjectPos ( sm_slot [ i ], obj_pos_z, obj_pos_z, obj_pos_z ) ; | |
if ( sm_slot_coord [ i ] [ 2 ] != obj_pos_z ) | |
{ | |
move_time = MoveDynamicObject ( sm_slot [ i ], sm_slot_coord [ i ] [ 0 ], sm_slot_coord [ i ] [ 1 ], sm_slot_coord [ i ] [ 2 ], 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i ] [ 4 ], sm_slot_coord [ i ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 1 ], sm_slot_coord [ i + 1 ] [ 0 ], sm_slot_coord [ i + 1 ] [ 1 ], sm_slot_coord [ i + 1 ] [ 2 ], 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i + 1 ] [ 4 ], sm_slot_coord [ i + 1 ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 2 ], sm_slot_coord [ i + 2 ] [ 0 ], sm_slot_coord [ i + 2 ] [ 1 ], sm_slot_coord [ i + 2 ] [ 2 ], 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i + 2 ] [ 4 ], sm_slot_coord [ i + 2 ] [ 5 ] ) ; | |
} | |
else | |
{ | |
move_time = MoveDynamicObject ( sm_slot [ i ], sm_slot_coord [ i ] [ 0 ], sm_slot_coord [ i ] [ 1 ], sm_slot_coord [ i ] [ 2 ] + 0.02, 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i ] [ 4 ], sm_slot_coord [ i ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 1 ], sm_slot_coord [ i + 1 ] [ 0 ], sm_slot_coord [ i + 1 ] [ 1 ], sm_slot_coord [ i + 1 ] [ 2 ] + 0.02, 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i + 1 ] [ 4 ], sm_slot_coord [ i + 1 ] [ 5 ] ) ; | |
MoveDynamicObject ( sm_slot [ i + 2 ], sm_slot_coord [ i + 2 ] [ 0 ], sm_slot_coord [ i + 2 ] [ 1 ], sm_slot_coord [ i + 2 ] [ 2 ] + 0.02, 0.04, image_rot [ random ( sizeof ( image_rot ) ) ], sm_slot_coord [ i + 2 ] [ 4 ], sm_slot_coord [ i + 2 ] [ 5 ] ) ; | |
} | |
SetTimerEx ( "sm_check", move_time + 100, false, "iddd", playerid, sm_slot [ i ], sm_slot [ i + 1 ], sm_slot [ i + 2 ] ) ; | |
return 1 ; | |
} | |
forward sm_check ( playerid, obj_1, obj_2, obj_3 ) ; | |
public sm_check ( playerid, obj_1, obj_2, obj_3 ) | |
{ | |
if ( GetPVarInt ( playerid, "sm_bet" ) == 0 ) return 1 ; | |
new result = get_result ( obj_1, obj_2, obj_3 ) ; | |
if ( ! result ) | |
{ | |
PlayerTextDrawSetString ( playerid, sm_ptd [ playerid ], "bet: 0$" ) ; | |
GivePlayerMoney ( playerid, - GetPVarInt ( playerid, "sm_bet" ) ) ; | |
DeletePVar ( playerid, "sm_bet" ) ; | |
SendClientMessage ( playerid, -1, "* Вы ничего не выиграли!" ) ; | |
GameTextForPlayer(playerid, "~r~LOSE", 5000, 3 ) ; | |
} | |
else | |
{ | |
new win_cash = GetPVarInt ( playerid, "sm_bet" ) * ( 7 - result ) ; | |
GivePlayerMoney ( playerid, win_cash ) ; | |
SendClientMessage ( playerid, -1, "* Вы выиграли!" ) ; | |
DeletePVar ( playerid, "sm_bet" ) ; | |
new gt_string [ 18 ] ; | |
format ( gt_string, 18, "~g~WIN: %d$", win_cash ) ; | |
GameTextForPlayer(playerid, gt_string, 5000, 3 ) ; | |
PlayerTextDrawSetString ( playerid, sm_ptd [ playerid ], "bet: 0$" ) ; | |
} | |
DeletePVar ( playerid, "sm_started" ) ; | |
return 1 ; | |
} | |
stock get_result ( obj_1, obj_2, obj_3 ) | |
{ | |
new Float: rot_pos [ 4 ]; | |
GetDynamicObjectRot ( obj_1, rot_pos [ 0 ], rot_pos [ 3 ], rot_pos [ 3 ] ) ; | |
GetDynamicObjectRot ( obj_2, rot_pos [ 1 ], rot_pos [ 3 ], rot_pos [ 3 ] ) ; | |
GetDynamicObjectRot ( obj_3, rot_pos [ 2 ], rot_pos [ 3 ], rot_pos [ 3 ] ) ; | |
if ( rot_pos [ 0 ] == rot_pos [ 1 ] && rot_pos [ 0 ] == rot_pos [ 2 ] && rot_pos [ 0 ] && rot_pos [ 0 ] == 200 ) return COMBO_DOUBLE_GOLD; | |
new combo_points = 0; | |
for ( new i = 0; i < sizeof ( cherry_combo ) ; i++ ) | |
{ | |
for ( new f = 0; f < sizeof ( rot_pos ) - 1; f++ ) | |
{ | |
if ( rot_pos [ f ] == cherry_combo [ i ] )combo_points ++ ; | |
} | |
} | |
if ( combo_points == 3 ) return COMBO_CHERRY; | |
combo_points = 0; | |
for ( new i = 0; i < sizeof ( gold_combo ) ; i++ ) | |
{ | |
for ( new f = 0; f < sizeof ( rot_pos ) - 1; f++ ) | |
{ | |
if ( rot_pos [ f ] == gold_combo [ i ] )combo_points ++ ; | |
} | |
} | |
if ( combo_points == 3 ) return COMBO_GOLD; | |
combo_points = 0; | |
for ( new i = 0; i < sizeof ( bell_combo ) ; i++ ) | |
{ | |
for ( new f = 0; f < sizeof ( rot_pos ) - 1; f++ ) | |
{ | |
if ( rot_pos [ f ] == bell_combo [ i ] )combo_points ++ ; | |
} | |
} | |
if ( combo_points == 3 ) return COMBO_BELL; | |
combo_points = 0; | |
for ( new i = 0; i < sizeof ( grapes_combo ) ; i++ ) | |
{ | |
for ( new f = 0; f < sizeof ( rot_pos ) - 1; f++ ) | |
{ | |
if ( rot_pos [ f ] == grapes_combo [ i ] )combo_points ++ ; | |
} | |
} | |
if ( combo_points == 3 ) return COMBO_GRAPES; | |
combo_points = 0; | |
for ( new i = 0; i < sizeof ( sn_combo ) ; i++ ) | |
{ | |
for ( new f = 0; f < sizeof ( rot_pos ) - 1; f++ ) | |
{ | |
if ( rot_pos [ f ] == sn_combo [ i ] )combo_points ++ ; | |
} | |
} | |
if ( combo_points == 3 ) return COMBO_69; | |
return false; | |
} | |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) | |
{ | |
if ( dialogid == 1 ) | |
{ | |
if ( ! response ) return 1 ; | |
new bet_amount = strval ( inputtext ) ; | |
if ( bet_amount < 0 || bet_amount > 100000 ) return SendClientMessage ( playerid, -1, "* Размер ставки не может быть меньше 0$ или больше 100000$!" ) ; | |
if ( GetPlayerMoney ( playerid ) < bet_amount ) return SendClientMessage ( playerid, -1, "* У Вас нет такого количества денег!" ) ; | |
SetPVarInt ( playerid, "sm_bet", bet_amount ) ; | |
new td_string [ 14 ] ; | |
format ( td_string, 14, "bet: %d$", bet_amount ) ; | |
PlayerTextDrawSetString ( playerid, sm_ptd [ playerid ], td_string ) ; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment