Dice command problem
#1

Hello lovely scripters,

I'm a massive rookie to pawno scripting, i'd like a little bit of assistance ^^

What am I doing wrong here?

Reply
#2

Try this:

pawn Code:
CMD:dice(playerid,params[])
{
    new string[128];
    if(HasDice[playerid] == 0) return SendClientMessage(playerid, -1, "You don't have a pair of dices");
    format(string, sizeof(string), "You throwed dices and it stands to: %i", random(12));//12 'cause you throwed a pair of it
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply
#3

pawn Code:
format(string, sizeof(string), "%s", dice[randomMSG]);
Also, next time post your code rather than taking a screenshot.
Reply
#4

Quote:
Originally Posted by Nexotronix
View Post
Try this:

pawn Code:
CMD:dice(playerid,params[])
{
    new string[128];
    if(HasDice[playerid] == 0) return SendClientMessage(playerid, -1, "You don't have a pair of dices");
    format(string, sizeof(string), "You throwed dices and it stands to: %i", random(12));//12 'cause you throwed a pair of it
    SendClientMessage(playerid, -1, string);
    return 1;
}
Works smoothly man!

Thanks bruda, +repped you.
Reply
#5

Quote:
Originally Posted by Relic
View Post
Works smoothly man!

Thanks bruda, +repped you.
Enjoy, mate! Always ready to help 🙂
Reply
#6

Little correction, random's range is [0, max-1], so random(12) will never give out 12. If you want it to be the case, just change it to random(13)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)