SA-MP Forums Archive
need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help (/showthread.php?tid=279078)



need help - Rafa - 25.08.2011

hello guys i have made the basic of this system now i need help...
when the player will tupe /game [num1] [num2] [price] to show the numbers with text draw from the right side of the monitor or near map like dices 1 to 6... but i have one bug here any number i write i says me the numbers is correct and the winning price coming to me
look the code and pls tell me how to make that...
pawn Код:
CMD:game(playerid, params[])
{
    new number, number2, price, msg[125];
    if(sscanf(params, "ddd", number, number2, price)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE:/game [num1] [num2] [price]");
    SendClientMessage(playerid, COLOR_YELLOW, "Remember that the price is automaticly multiplied with 10");
    new dice = random(6)+1; // 0-5 +1 = 1-6
    if(dice == number, number2)
    {
        format(msg, sizeof(msg), "You won $%d, you can come again in 2 hours to play again this game.", price*10);
        SendClientMessage(playerid, COLOR_GREEN, msg);
        GivePlayerMoney(playerid, price*10);
    }
    else
    {
        format(msg, sizeof(msg), "You have lose $%d Have a nice day. Come back in 2 hours.", price);
        SendClientMessage(playerid, COLOR_RED, msg);
        GivePlayerMoney(playerid, - price);
    }
    return 1;
}
Thanks.


Re: need help - iMonk3y - 25.08.2011

Код:
CMD:game(playerid, params[])
{
    new number, number2, price, msg[125];
    if(sscanf(params, "ddd", number, number2, price)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE:/game [num1] [num2] [price]");
    SendClientMessage(playerid, COLOR_YELLOW, "Remember that the price is automaticly multiplied with 10");
    new dice = random(6)+1; // 0-5 +1 = 1-6
    if(dice == number || dice == number2)
    {
        format(msg, sizeof(msg), "You won $%d, you can come again in 2 hours to play again this game.", price*10);
        SendClientMessage(playerid, COLOR_GREEN, msg);
        GivePlayerMoney(playerid, price*10);
    }
    else
    {
        format(msg, sizeof(msg), "You have lose $%d Have a nice day. Come back in 2 hours.", price);
        SendClientMessage(playerid, COLOR_RED, msg);
        GivePlayerMoney(playerid, - price); 
    }
    return 1;
}
The best thing about the game is that you can play it non-stop!(even when you have cash on negative side). Odds to guess correct are like 1/3... If you play 10 game on the same bet, one win is enough to win all the cash back..


Re: need help - Rafa - 25.08.2011

ok dude but i want to make to have chances to win 30% and to lose 70% to be hard to win cause with this random its very eazy to win :/ if is possible to make that please give me some code or something...


Re: need help - Dragony92 - 25.08.2011

new dice = random(6)+1;
new dice2 = random(6)+1;
if(dice == number && dice2 == number2)


Re: need help - Rafa - 25.08.2011

anyone know how to make the percentage more higer than the wining ?


Re: need help - Pinguinn - 25.08.2011

Maybe you can use 'switch(dice)'


Re: need help - iMonk3y - 25.08.2011

Quote:
Originally Posted by Dragony92
Посмотреть сообщение
new dice = random(6)+1;
new dice2 = random(6)+1;
if(dice == number && dice2 == number2)
Probability to win is like 5%

Make one dice, one guess = ~17% Simple!


Re: need help - Rafa - 25.08.2011

i dont get it :/


Re: need help - =WoR=Varth - 27.08.2011

pawn Код:
new dice = random(15)+1; //Increase the random size