#define prizedollars 500//Prize $ #define costor 500//Command Cost #define OREL_RESHKA_DL 123//Dialog #define OREL_RESHKA_DL_1 1231//Dialog 1_1 #define OREL_RESHKA_DL_2 1232//Dialog 1_2
new lucky[MAX_PLAYERS]; new choose[MAX_PLAYERS];
if(strcmp(cmd, "/lucky", true) == 0) { if(GetPlayerMoney(playerid) < costor){ new str[128]; format(str,sizeof(str),"You don`t have %d dollars!",costor); SendClientMessage(playerid,-1,str); return 1;} else{ GivePlayerMoney(playerid,costor); ShowPlayerDialog(playerid,OREL_RESHKA_DL,DIALOG_STYLE_MSGBOX,"Orel Reshka","Choose:","Orel","Reshka"); return 1;} }
if(dialogid == OREL_RESHKA_DL) { new str[256]; if(response) { choose[playerid] = 1; new rand = random(7); new stringer[10]; switch(rand) { case 0:lucky[playerid] = 1,stringer = "Orel"; case 1:lucky[playerid] = 2,stringer = "Reshka"; case 2:lucky[playerid] = 2,stringer = "Reshka"; case 3:lucky[playerid] = 2,stringer = "Reshka"; case 4:lucky[playerid] = 2,stringer = "Reshka"; case 5:lucky[playerid] = 2,stringer = "Reshka"; case 6:lucky[playerid] = 1,stringer = "Orel"; } new str1[64]; format(str1,sizeof(str1),"%s",stringer); if(lucky[playerid] == choose[playerid]){ format(str,sizeof(str),"Answer: %s\nCongratulations, you guessed it!",str1); ShowPlayerDialog(playerid,OREL_RESHKA_DL_1,DIALOG_STYLE_MSGBOX,"Orel Reshka",str,"Thank",""); } else if(lucky[playerid] != choose[playerid]){ format(str,sizeof(str),"Answer: %s\nSorry you are wrong!",str1); ShowPlayerDialog(playerid,OREL_RESHKA_DL_2,DIALOG_STYLE_MSGBOX,"Orel Reshka",str,"Falied",""); } } else { choose[playerid] = 2; new rand = random(7); new stringer[10]; switch(rand) { case 0:lucky[playerid] = 1,stringer = "Orel"; case 1:lucky[playerid] = 1,stringer = "Orel"; case 2:lucky[playerid] = 2,stringer = "Reshka"; case 3:lucky[playerid] = 2,stringer = "Reshka"; case 4:lucky[playerid] = 1,stringer = "Orel"; case 5:lucky[playerid] = 1,stringer = "Orel"; case 6:lucky[playerid] = 1,stringer = "Orel"; } new str1[64]; format(str1,sizeof(str1),"%s",stringer); if(lucky[playerid] == choose[playerid]){ format(str,sizeof(str),"Answer: %s\nCongratulations, you guessed it!",str1); ShowPlayerDialog(playerid,OREL_RESHKA_DL_1,DIALOG_STYLE_MSGBOX,"Orel Reshka",str,"Thank",""); } else if(lucky[playerid] != choose[playerid]){ format(str,sizeof(str),"Answer: %s\nSorry you are wrong!",str1); ShowPlayerDialog(playerid,OREL_RESHKA_DL_2,DIALOG_STYLE_MSGBOX,"Orel Reshka",str,"Falied",""); } } } if(dialogid == OREL_RESHKA_DL_1){ new money = prizedollars;//Prize GivePlayerMoney(playerid,money); SendClientMessage(playerid,-1,"You can also test your luck again!:)"); return 1; } if(dialogid == OREL_RESHKA_DL_2){ SendClientMessage(playerid,-1,"Do not worry, you can be lucky next time!:("); return 1; }
switch(rand)
{
case 0:lucky[playerid] = 1,stringer = "Orel";
case 1:lucky[playerid] = 2,stringer = "Reshka";
case 2:lucky[playerid] = 2,stringer = "Reshka";
case 3:lucky[playerid] = 2,stringer = "Reshka";
case 4:lucky[playerid] = 2,stringer = "Reshka";
case 5:lucky[playerid] = 2,stringer = "Reshka";
case 6:lucky[playerid] = 1,stringer = "Orel";
}
switch(rand)
{
case 0,6:lucky[playerid] = 1,stringer = "Orel";
case 1..5:lucky[playerid] = 2,stringer = "Reshka";
default: return 0; // This shouldn't be called but just in case let's have it return 0.
}
Hello OP, it's cool you shared what you've learned, I have a few issues though:
1. Please for the love of God, use indentation properly 2. You gave player money even before the flip was made, that's not a good casino rule... 3. This casino cheats as hell: if I bet I have only 29% chance of winning? HEY! |
Hello OP, it's cool you shared what you've learned, I have a few issues though:
1. Please for the love of God, use indentation properly 2. You gave player money even before the flip was made, that's not a good casino rule... 3. This casino cheats as hell: if I bet I have only 29% chance of winning? HEY! |
This isn't a tutorial! You explained nothing, and just gave us code. You cannot do that in this section - either change it to a tutorial form or request a thread move to an appropriate section(such as the filterscript / release section).
You also have some bad scripting habits going on, for example the switch. pawn Code:
pawn Code:
|
It`s my first system.
Of course there will be mistakes, not everything is perfect) |