Dice command problem - 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: Dice command problem (
/showthread.php?tid=676096)
Dice command problem -
Relic - 29.05.2020
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?
Re: Dice command problem -
Nexotronix - 29.05.2020
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;
}
Re: Dice command problem -
Cell_ - 29.05.2020
pawn Code:
format(string, sizeof(string), "%s", dice[randomMSG]);
Also, next time post your code rather than taking a screenshot.
Re: Dice command problem -
Relic - 29.05.2020
Quote:
Originally Posted by Nexotronix
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.
Re: Dice command problem -
Nexotronix - 29.05.2020
Quote:
Originally Posted by Relic
Works smoothly man!
Thanks bruda, +repped you.
|
Enjoy, mate! Always ready to help 🙂
Re: Dice command problem -
Adamoneoone - 29.05.2020
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)