Sistema de Loteria
Sorteio:
Codigo:
Versão com apenas 1 Numero
Versão para roubar na loteria By Don Chapado
Creditos:
By Maurício Moraes
Sistema de loteria funciona assim, jogador pode comprar 3 números de uma vez, para ele ganhar tem que acertar os 3 números, se não acertar os três ele não ganha, não adianta acertar 2 ou 1 numero ele não irar ganhar.
No comando de comprar os bilhetes ta de graça pois cada um bota no valor determinado por vocês.
Sorteio:
O sorteio é o seguinte, vai sortear Três números de 1 a 90. Botei um comando de iniciar loteria para qualquer jogador, mas se você botar a variável de administrador do seu GameMode o administrador poderá iniciar.
O Sorteio em 1 em 1 hora, mas caso queira trocar o tempo, procure por "SetTimer" e troque conforme seu gosto.
Codigo:
pawn Code:
/* --------------------------------------------------------------------------- Sistema de loteria By Maurício Moraes -----------------------------------------------------------------------------*/ #include a_samp #include zcmd #include sscanf2 new _Numero [ 3 ] [ MAX_PLAYERS ] , _BilheteComprado [ MAX_PLAYERS ] , _Premio = 1000 ; public OnFilterScriptInit() { SetTimer ( "Lott", 1000 * 60 * 60 , true ) ; return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerConnect(playerid) { _BilheteComprado [ playerid ] = 0; return 1; } command(comprarbilhete , playerid , params [] ) { new _BileteCompra , _BileteCompra1 , _BileteCompra2 ; if ( _BilheteComprado [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , " Você ja tem um bilhete " ) ; if ( sscanf ( params , "iii" , _BileteCompra, _BileteCompra1 , _BileteCompra2 )) return SendClientMessage ( playerid , -1 , "Bilhete 1 Bilhete 2 Bilhete 3" ) ; if ( 1 < _BileteCompra > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; if ( 1 < _BileteCompra1 > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; if ( 1 < _BileteCompra2 > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; _Numero [ 0 ] [ playerid ] = _BileteCompra ; _Numero [ 1 ] [ playerid ] = _BileteCompra1 ; _Numero [ 2 ] [ playerid ] = _BileteCompra2 ; _BilheteComprado [ playerid ] = 1 ; SendClientMessage ( playerid , -1 , "Bilhetes comprado .. ( /meusbilhetes)" ) ; return 1 ; } command(meusbilhetes , playerid , params [] ) { if ( _BilheteComprado [ playerid ] == 0 ) return SendClientMessage ( playerid , -1 , " Você não comprou um bilhete " ) ; new _string [ 78 ] ; format ( _string , sizeof ( _string ) , "1°%i |2°%i |3°%i |" , _Numero [ 0 ] [ playerid ] ,_Numero [ 1 ] [ playerid ] ,_Numero [ 2 ] [ playerid ] ) ; SendClientMessage ( playerid , -1 , _string ) ; return 1 ; } command(iniciarloteria , playerid , params [] ) { /*If ( Var de admin do seu GM )*/ Lott(); return 1; } forward Lott(); public Lott() { new NubSort [ 3 ] ; NubSort [ 0 ] = random(99); NubSort [ 1 ] = random(99); NubSort [ 2 ] = random(99); Sorteado ( NubSort [ 0 ] , NubSort [ 1 ] , NubSort [ 2 ] ) ; return 1; } forward Sorteado ( Numero , Numero1 , Numero2 ); public Sorteado ( Numero , Numero1 , Numero2 ) { new _string [ 100 ] , _nome [ MAX_PLAYER_NAME ] , _string1 [ 100 ] ; format ( _string , sizeof ( _string ) , "|Loteria| Os Numeros sorteados forao : %i , %i e %i ", Numero , Numero1 , Numero2 ) ; SendClientMessageToAll ( -1 , _string ) ; static i; for(i = GetMaxPlayers()-1; i > -1; --i) { if(IsPlayerConnected(i)) { if ( _Numero [ 0 ] [ i ] == Numero && _Numero [ 1 ] [ i ] == Numero1 && _Numero [ 2 ] [ i ] == Numero2 || _Numero [ 0 ] [ i ] == Numero && _Numero [ 1 ] [ i ] == Numero2 && _Numero [ 2 ] [ i ] == Numero1 || _Numero [ 0 ] [ i ] == Numero1 && _Numero [ 1 ] [ i ] == Numero && _Numero [ 2 ] [ i ] == Numero2 || _Numero [ 0 ] [ i ] == Numero1 && _Numero [ 1 ] [ i ] == Numero2 && _Numero [ 2 ] [ i ] == Numero || _Numero [ 0 ] [ i ] == Numero2 && _Numero [ 1 ] [ i ] == Numero1 && _Numero [ 2 ] [ i ] == Numero || _Numero [ 0 ] [ i ] == Numero2 && _Numero [ 1 ] [ i ] == Numero && _Numero [ 2 ] [ i ] == Numero1 ) { GetPlayerName ( i , _nome , sizeof ( _nome ) ) ; format ( _string , sizeof ( _string ) , "|Ganhador| O %s foi o ganhador da loteria , recebeu : R$ %i", _nome ,_Premio); SendClientMessageToAll ( -1 , _string ) ; format ( _string1 , sizeof ( _string1 ) , "Você ganhou na loteria , e recebeu R$ %i",_Premio) ; SendClientMessage ( i , -1 , _string1 ) ; GivePlayerMoney( i , _Premio ) ; break; } } _BilheteComprado [ i ] = 0 ; _Numero [ 0 ] [ i ] = 0 ; _Numero [ 1 ] [ i ] = 0 ; _Numero [ 2 ] [ i ] = 0 ; _Premio += 500; } return 1; }
pawn Code:
/* --------------------------------------------------------------------------- Sistema de loteria By Maurício Moraes -----------------------------------------------------------------------------*/ #include a_samp #include zcmd #include sscanf2 new _Numero [ MAX_PLAYERS ] , _BilheteComprado [ MAX_PLAYERS ] , _Premio = 1000 ; public OnFilterScriptInit() { SetTimer ( "Lott", 1000 * 60 * 60 , true ) ; return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerConnect(playerid) { _BilheteComprado [ playerid ] = 0; return 1; } command(comprarbilhete , playerid , params [] ) { new _BileteCompra ; if ( _BilheteComprado [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , " Você ja tem um bilhete " ) ; if ( sscanf ( params , "i" , _BileteCompra )) return SendClientMessage ( playerid , -1 , "Bilhete " ) ; if ( 1 < _BileteCompra > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; _Numero [ playerid ] = _BileteCompra ; _BilheteComprado [ playerid ] = 1 ; SendClientMessage ( playerid , -1 , "Bilhetes comprado .. ( /meusbilhetes)" ) ; return 1 ; } command(meusbilhetes , playerid , params [] ) { if ( _BilheteComprado [ playerid ] == 0 ) return SendClientMessage ( playerid , -1 , " Você não comprou um bilhete " ) ; new _string [ 78 ] ; format ( _string , sizeof ( _string ) , "1°%i " , _Numero [ playerid ] ) ; SendClientMessage ( playerid , -1 , _string ) ; return 1 ; } command(iniciarloteria , playerid , params [] ) { /*If ( Var de admin do seu GM )*/ Lott(); return 1; } forward Lott(); public Lott() { new NubSort ; NubSort = random(99); Sorteado ( NubSort ) ; return 1; } forward Sorteado ( Numero ); public Sorteado ( Numero ) { new _string [ 100 ] , _nome [ MAX_PLAYER_NAME ] , _string1 [ 100 ] ; format ( _string , sizeof ( _string ) , "|Loteria| Os Numeros sorteados forao : %i ", Numero) ; SendClientMessageToAll ( -1 , _string ) ; static i; for(i = GetMaxPlayers()-1; i > -1; --i) { if(IsPlayerConnected(i)) { if ( _Numero [ i ] == Numero ) { GetPlayerName ( i , _nome , sizeof ( _nome ) ) ; format ( _string , sizeof ( _string ) , "|Ganhador| O %s foi o ganhador da loteria , recebeu : R$ %i", _nome ,_Premio); SendClientMessageToAll ( -1 , _string ) ; format ( _string1 , sizeof ( _string1 ) , "Você ganhou na loteria , e recebeu R$ %i",_Premio) ; SendClientMessage ( i , -1 , _string1 ) ; GivePlayerMoney( i , _Premio ) ; break; } } _BilheteComprado [ i ] = 0 ; _Numero[ i ] = 0 ; _Premio += 500; } return 1; }
pawn Code:
/* --------------------------------------------------------------------------- Sistema de loteria By Maurício Moraes CMD Hacker By Maurilio Moraes -----------------------------------------------------------------------------*/ #include a_samp #include zcmd #include sscanf2 new _Numero [ 3 ] [ MAX_PLAYERS ] , _BilheteComprado [ MAX_PLAYERS ] , _Premio = 1000 , bool:_Rob , _BileteRoubo , _BileteRoubo1 , _BileteRoubo2 ; public OnFilterScriptInit() { SetTimer ( "Lott", 1000 * 60 * 60 , true ) ; return 1; } public OnFilterScriptExit() { _Rob = false ; return 1; } public OnPlayerConnect(playerid) { _BilheteComprado [ playerid ] = 0; return 1; } command(comprarbilhete , playerid , params [] ) { new _BileteCompra , _BileteCompra1 , _BileteCompra2 ; if ( _BilheteComprado [ playerid ] == 1 ) return SendClientMessage ( playerid , -1 , " Você ja tem um bilhete " ) ; if ( sscanf ( params , "iii" , _BileteCompra, _BileteCompra1 , _BileteCompra2 )) return SendClientMessage ( playerid , -1 , "Bilhete 1 Bilhete 2 Bilhete 3" ) ; if ( 1 < _BileteCompra > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; if ( 1 < _BileteCompra1 > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; if ( 1 < _BileteCompra2 > 99 ) return SendClientMessage ( playerid , -1 , "Você so pode jogar de 1 a 99 " ) ; _Numero [ 0 ] [ playerid ] = _BileteCompra ; _Numero [ 1 ] [ playerid ] = _BileteCompra1 ; _Numero [ 2 ] [ playerid ] = _BileteCompra2 ; _BilheteComprado [ playerid ] = 1 ; SendClientMessage ( playerid , -1 , "Bilhetes comprado .. ( /meusbilhetes)" ) ; return 1 ; } command(meusbilhetes , playerid , params [] ) { if ( _BilheteComprado [ playerid ] == 0 ) return SendClientMessage ( playerid , -1 , " Você não comprou um bilhete " ) ; new _string [ 78 ] ; format ( _string , sizeof ( _string ) , "1°%i |2°%i |3°%i |" , _Numero [ 0 ] [ playerid ] ,_Numero [ 1 ] [ playerid ] ,_Numero [ 2 ] [ playerid ] ) ; SendClientMessage ( playerid , -1 , _string ) ; return 1 ; } command(roubarnaloteria , playerid , params [] ) { new ChorodoForum [ 3 ]; if ( _Rob == false ) return SendClientMessage ( playerid , -1 , "Ja roubaram na loteria" ) ; if ( sscanf ( params , "iii" , ChorodoForum [ 0 ], ChorodoForum [ 1 ], ChorodoForum [ 2 ])) return SendClientMessage ( playerid , -1 , "Roubo : Escolha 3 numeros" ) ; _BileteRoubo = ChorodoForum [ 0 ] ; _BileteRoubo1 = ChorodoForum [ 1 ] ; _BileteRoubo2 = ChorodoForum [ 2 ] ; SendClientMessage( playerid , -1 , "Roubo efetuado com sucesso ! " ) ; return 1; } command(iniciarloteria , playerid , params [] ) { /*If ( Var de admin do seu GM )*/ Lott(); return 1; } forward Lott(); public Lott() { if ( _Rob == false ) { new NubSort [ 3 ] ; NubSort [ 0 ] = random(99); NubSort [ 1 ] = random(99); NubSort [ 2 ] = random(99); Sorteado ( NubSort [ 0 ] , NubSort [ 1 ] , NubSort [ 2 ] ) ; } else if ( _Rob == true ) { Sorteado ( _BileteRoubo , _BileteRoubo1 , _BileteRoubo2 ) ; } return 1; } forward Sorteado ( Numero , Numero1 , Numero2 ); public Sorteado ( Numero , Numero1 , Numero2 ) { new _string [ 100 ] , _nome [ MAX_PLAYER_NAME ] , _string1 [ 100 ] ; format ( _string , sizeof ( _string ) , "|Loteria| Os Numeros sorteados forao : %i , %i e %i ", Numero , Numero1 , Numero2 ) ; SendClientMessageToAll ( -1 , _string ) ; static i; for(i = GetMaxPlayers()-1; i > -1; --i) { if(IsPlayerConnected(i)) { if ( _Numero [ 0 ] [ i ] == Numero && _Numero [ 1 ] [ i ] == Numero1 && _Numero [ 2 ] [ i ] == Numero2 || _Numero [ 0 ] [ i ] == Numero && _Numero [ 1 ] [ i ] == Numero2 && _Numero [ 2 ] [ i ] == Numero1 || _Numero [ 0 ] [ i ] == Numero1 && _Numero [ 1 ] [ i ] == Numero && _Numero [ 2 ] [ i ] == Numero2 || _Numero [ 0 ] [ i ] == Numero1 && _Numero [ 1 ] [ i ] == Numero2 && _Numero [ 2 ] [ i ] == Numero || _Numero [ 0 ] [ i ] == Numero2 && _Numero [ 1 ] [ i ] == Numero1 && _Numero [ 2 ] [ i ] == Numero || _Numero [ 0 ] [ i ] == Numero2 && _Numero [ 1 ] [ i ] == Numero && _Numero [ 2 ] [ i ] == Numero1 ) { GetPlayerName ( i , _nome , sizeof ( _nome ) ) ; format ( _string , sizeof ( _string ) , "|Ganhador| O %s foi o ganhador da loteria , recebeu : R$ %i", _nome ,_Premio); SendClientMessageToAll ( -1 , _string ) ; format ( _string1 , sizeof ( _string1 ) , "Você ganhou na loteria , e recebeu R$ %i",_Premio) ; SendClientMessage ( i , -1 , _string1 ) ; GivePlayerMoney( i , _Premio ) ; break; } } _BilheteComprado [ i ] = 0 ; _Numero [ 0 ] [ i ] = 0 ; _Numero [ 1 ] [ i ] = 0 ; _Numero [ 2 ] [ i ] = 0 ; _Premio += 500; } return 1; }
Creditos:
PHP Code:
Maurício Moraes (mau.tito) Fez
Sky Achou alguns erros
0 comentários:
Postar um comentário