SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/05/2020, 05:48 PM   #1
Relic
Little Clucker
 
Join Date: May 2013
Posts: 33
Reputation: 13
Default Dice command problem

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?

__________________
Relic is offline   Reply With Quote
Old 29/05/2020, 06:07 PM   #2
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 275
Reputation: 41
Default Re: Dice command problem

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;
}
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline   Reply With Quote
Old 29/05/2020, 08:06 PM   #3
Relic
Little Clucker
 
Join Date: May 2013
Posts: 33
Reputation: 13
Default Re: Dice command problem

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.
__________________
Relic is offline   Reply With Quote
Old 29/05/2020, 08:08 PM   #4
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 275
Reputation: 41
Thumbs up Re: Dice command problem

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

Thanks bruda, +repped you.
Enjoy, mate! Always ready to help 🙂
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline   Reply With Quote
Old 29/05/2020, 08:01 PM   #5
Cell_
Big Clucker
 
Join Date: May 2012
Posts: 160
Reputation: 50
Default Re: Dice command problem

pawn Code:
format(string, sizeof(string), "%s", dice[randomMSG]);
Also, next time post your code rather than taking a screenshot.
Cell_ is offline   Reply With Quote
Old 29/05/2020, 08:10 PM   #6
Adamoneoone
Huge Clucker
 
Join Date: Sep 2014
Posts: 489
Reputation: 37
Default Re: Dice command problem

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)
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!
Adamoneoone is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help me dice command Osamakurdi Scripting Help 8 03/01/2018 05:51 PM
/dice command Osamakurdi Scripting Help 6 21/12/2017 11:49 AM
Dice command. GabiXx Scripting Help 7 26/12/2015 11:57 AM
command /dice. capsator10 Scripting Help 30 14/08/2014 06:28 PM
Dice command friezakinght Scripting Help 2 10/07/2014 02:01 PM


All times are GMT. The time now is 04:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.