Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <zcmd>
- #define MSGFAIL_COLOR 0xFF3233FF //RED
- #define MSGCMDS_COLOR 0xFFFFFFFF
- #define MSGSUCC_COLOR 0x00FF00FF//GREEN
- #define MSGINFO_COLOR 0x3C93FFFF//TYRKYS
- #define DIALOG_MINCA 1
- #define DIALOG_KOCKATOP 2
- new betminca;
- CMD:kocka(playerid, params[]){ //FUNGUJE
- new string[128];
- new bet;
- new number;//0-5,Musím nejako pridať +1
- if (sscanf(params, "ii",number,bet)){
- SendClientMessage(playerid,MSGCMDS_COLOR, "Použitie: \"/kocka <tvoje číslo> <suma stávky>\"");
- }else{
- if(number > 6 || number < 1){
- SendClientMessage(playerid,MSGFAIL_COLOR, "Neplatné číslo!(1-6).");
- }else if (bet<1){
- SendClientMessage(playerid,MSGFAIL_COLOR, "Nezadal si čiastku.");
- }else if (bet>1000000){
- SendClientMessage(playerid,MSGFAIL_COLOR, "Nemôžeš staviť viac ako 1 000 000 bez VIP!");
- }else{
- if (Money(playerid)<bet){
- format(string,sizeof(string),"Nemáš peniaze!.Stav: $%i",Money(playerid));
- SendClientMessage(playerid,MSGFAIL_COLOR,string);
- }else{
- new randomnumber = random(6)+1;
- if (randomnumber==number){
- string[0] = EOS;
- format(string,sizeof(string),"Vylosované číslo je %d",randomnumber);
- SendClientMessage(playerid,MSGSUCC_COLOR,string);
- format(string,sizeof(string),"Vyhral si $%d!",bet*6);
- SendClientMessage(playerid,MSGSUCC_COLOR,string);
- GivePlayerMoneyEx(playerid,bet*6);
- }else{
- string[0] = EOS;
- format(string,sizeof(string),"Vylosované číslo je %d",randomnumber);
- SendClientMessage(playerid,MSGFAIL_COLOR,string);
- format(string,sizeof(string),"Prehral si %d...",bet);
- SendClientMessage(playerid,MSGFAIL_COLOR,string);
- GivePlayerMoneyEx(playerid,-bet);
- }
- }
- }
- }
- if (bet >10000){
- new stringkockatop[MAX_PLAYER_NAME + 7];
- format(stringkockatop,sizeof(stringkockatop),"%s\r\n",Name(playerid));
- new File:kockatop = fopen("kockatop.txt", io_append);
- if (kockatop){
- fwrite(kockatop, stringkockatop);
- fclose(kockatop);
- }
- }
- return 1;
- }
- CMD:minca(playerid, params[]){
- if (sscanf(params, "i",betminca)){
- SendClientMessage(playerid,MSGCMDS_COLOR, "Použitie: \"/minca <suma stávky>\"");
- }else{
- ShowPlayerDialog(playerid,DIALOG_MINCA,DIALOG_STYLE_MSGBOX,"Minca", "Orol alebo Panna?","Orol","Panna");
- }
- return 1;
- }
- CMD:kockatop(playerid,params[]){
- if(fexist("kockatop.txt")){
- new File:kockatop = fopen("kockatop.txt", io_read);
- new str[256], str2[3000];
- while(fread(kockatop, str, sizeof(str))){
- strcat(str2, str);
- }
- ShowPlayerDialog(playerid,DIALOG_KOCKATOP,DIALOG_STYLE_MSGBOX,"Hráči ktorí vložili nad 10000",str2,"Zrušiť","");
- fclose(kockatop);
- }
- return 1;
- }
- public OnPlayerConnect(playerid){
- GivePlayerMoney(playerid, 50000);
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- new string[18];
- new randomnumber = random(2)+1;
- switch(dialogid){
- case DIALOG_MINCA:{
- switch(response){
- case 0:{ //panna dialog click
- if (randomnumber==1){
- SendClientMessage(playerid,MSGSUCC_COLOR,"Padla panna!");
- //SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);
- GivePlayerMoney(playerid,betminca*2);
- string[0] = EOS;
- format(string,sizeof(string),"Vyhral si %d...",betminca*2);
- SendClientMessage(playerid,MSGSUCC_COLOR,string);
- }else{
- SendClientMessage(playerid,MSGFAIL_COLOR,"Padol orol!");
- //SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")-bet);
- GivePlayerMoney(playerid,-betminca);
- string[0] = EOS;
- format(string,sizeof(string),"Prehral si %d...",betminca);
- SendClientMessage(playerid,MSGFAIL_COLOR,string);
- }
- }case 1:{// Orol dialog click
- if (randomnumber==2){
- SendClientMessage(playerid,MSGSUCC_COLOR,"Padol orol!");
- //SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")+bet*2);
- GivePlayerMoney(playerid,betminca*2);
- string[0] = EOS;
- format(string,sizeof(string),"Vyhral si %d...",betminca*2);
- SendClientMessage(playerid,MSGSUCC_COLOR,string);
- }else{
- SendClientMessage(playerid,MSGFAIL_COLOR,"Padla panna!");
- //SetPVarInt(playerid,"Money",GetPVarInt(playerid,"Money")-bet);
- GivePlayerMoney(playerid,-betminca);
- string[0] = EOS;
- format(string,sizeof(string),"Prehral si %d...",betminca);
- SendClientMessage(playerid,MSGFAIL_COLOR,string);
- }//ELSE
- }//CASE 1
- }//switch response
- }//dialog minca
- case DIALOG_KOCKATOP:{
- }
- }//SWITCH UKONčENý
- return 1;
- }
- stock Name(playerid){
- new nname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nname, sizeof(nname));
- return nname;
- }
- stock Money(playerid){//moc mi to prácu neulahčilo? lepšie #define
- return GetPlayerMoney(playerid);
- }
- stock GivePlayerMoneyEx(playerid, money){
- new pMoney = GetPVarInt(playerid, "Money"); // Zistenie, koľko má hráč uložené v PVare
- SetPVarInt(playerid, "Money", pMoney + money); // Nové uloženie do PVaru -> hodnota v starom PVare navýšená o peniaze, ktoré si hráčovi dal (parameter money)
- GivePlayerMoney(playerid, money); // Dáš hráčovi peniaze
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement