SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 25/12/2015, 11:56 PM   #1
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default Dice command.

Hei. I'm here because i search a command for /dice just in casino.
Who can help me with a command like that.
Coordonates for casino: 2016.2699 1017.7790 996.8750 10
GabiXx is offline   Reply With Quote
Old 26/12/2015, 12:07 AM   #2
xXRevolverXx
Big Clucker
 
xXRevolverXx's Avatar
 
Join Date: Dec 2015
Location: Egypt
Posts: 78
Reputation: 14
Default Re: Dice command.

Can you explain more what do you need obviously ?. Thanks.
xXRevolverXx is offline   Reply With Quote
Old 26/12/2015, 12:45 AM   #3
RaajParker
Big Clucker
 
RaajParker's Avatar
 
Join Date: Oct 2015
Posts: 156
Reputation: 6
Default Re: Dice command.

Code:
#include <strlib>
Code:
public onPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/dice", cmdtext))
   {
    new dicenumber = random(6) + 1; // this is the variable
    new strdicenumber[2] // the String
    valstr(strdicenumber, dicenumber); // this is the valstr function
  SendClientMessage(playerid, COLOR_GREEN, str_replace("DICENUMBER", strdicenumber, "You rolled #DICENUMBER);
   for(new player = 0; player < MAX_PLAYERS; player++){
   SendClientMessage(player, COLOR_RED, str_replace("DICENUMBER", strdicenumber, "Someone rolled #DICENUMBER);

  
              }
               return 1; // The return statement is going to signal to the command was executed properly
         }
         return 0; // the return 0; is not going to be executed.
}
http://forum.sa-mp.com/showthread.php?t=85697 <<< Download the include

Enjoy
RaajParker is offline   Reply With Quote
Old 26/12/2015, 06:01 AM   #4
IceBilizard
Gangsta
 
Join Date: Feb 2012
Posts: 869
Reputation: 47
Default Re: Dice command.

Quote:
Originally Posted by RaajParker View Post
Code:
#include <strlib>
Code:
public onPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/dice", cmdtext))
   {
    new dicenumber = random(6) + 1; // this is the variable
    new strdicenumber[2] // the String
    valstr(strdicenumber, dicenumber); // this is the valstr function
  SendClientMessage(playerid, COLOR_GREEN, str_replace("DICENUMBER", strdicenumber, "You rolled #DICENUMBER);
   for(new player = 0; player < MAX_PLAYERS; player++){
   SendClientMessage(player, COLOR_RED, str_replace("DICENUMBER", strdicenumber, "Someone rolled #DICENUMBER);

  
              }
               return 1; // The return statement is going to signal to the command was executed properly
         }
         return 0; // the return 0; is not going to be executed.
}
http://forum.sa-mp.com/showthread.php?t=85697 <<< Download the include

Enjoy
Why he must download include and using strcmp?
He can use ZCMD its easy and use IsPlayerInRangeOfPoint without any problem you can do it.
__________________


IceBilizard is offline   Reply With Quote
Old 26/12/2015, 06:03 AM   #5
xTURBOx
Huge Clucker
 
xTURBOx's Avatar
 
Join Date: Aug 2015
Location: Earth
Posts: 378
Reputation: 49
Default Re: Dice command.

Quote:
Originally Posted by RaajParker View Post
Code:
#include <strlib>
Code:
public onPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/dice", cmdtext))
   {
    new dicenumber = random(6) + 1; // this is the variable
    new strdicenumber[2] // the String
    valstr(strdicenumber, dicenumber); // this is the valstr function
  SendClientMessage(playerid, COLOR_GREEN, str_replace("DICENUMBER", strdicenumber, "You rolled #DICENUMBER);
   for(new player = 0; player < MAX_PLAYERS; player++){
   SendClientMessage(player, COLOR_RED, str_replace("DICENUMBER", strdicenumber, "Someone rolled #DICENUMBER);

  
              }
               return 1; // The return statement is going to signal to the command was executed properly
         }
         return 0; // the return 0; is not going to be executed.
}
http://forum.sa-mp.com/showthread.php?t=85697 <<< Download the include

Enjoy
nice copy from http://forum.sa-mp.com/showthread.php?t=528062
you did not even edit it a little bit to fit for his needs. He said he wants player IN the casino to use the cmd
PHP Code:
CMD:dice(playerid,params[])
{
    if(!
IsPlayerInRangeOfPoint(playerid10.0/*Change this if required*/2016.2699,1017.7790,996.8750)) return SendClientMessage(playerid, -1"You need to be in casino to use this command");
    
// dice command script here, just not sure what kind of dice commnad you need
    
return 1;

this may help you
__________________
xTURBOx is offline   Reply With Quote
Old 26/12/2015, 10:53 AM   #6
GabiXx
Huge Clucker
 
GabiXx's Avatar
 
Join Date: Aug 2014
Location: Constanta, Romania
Posts: 222
Reputation: 0
Default Re: Dice command.

I have some errors.
PHP Code:
C:\Users\SebyIonut\Desktop\Test\gamemodes\buggedv330.pwn(1930) : error 001expected token";"but found "-identifier-"
C:\Users\SebyIonut\Desktop\Test\gamemodes\buggedv330.pwn(1931) : error 017undefined symbol "str_replace"
C:\Users\SebyIonut\Desktop\Test\gamemodes\buggedv330.pwn(1931) : error 017undefined symbol "You"
C:\Users\SebyIonut\Desktop\Test\gamemodes\buggedv330.pwn(1931) : error 017undefined symbol "rolled"
C:\Users\SebyIonut\Desktop\Test\gamemodes\buggedv330.pwn(1931) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


5 Errors

Here is the lines:
PHP Code:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (!
strcmp("/dice"cmdtext))
   {
    new 
dicenumber random(6) + 1// this is the variable
    
new strdicenumber[2// the String
    
valstr(strdicenumberdicenumber); // this is the valstr function                              <<- 1930
  
SendClientMessage(playeridCOLOR_GREENstr_replace("DICENUMBER"strdicenumber"You rolled #DICENUMBER); <<- 1931
   for(new player = 0; player < MAX_PLAYERS; player++){
   SendClientMessage(player, COLOR_RED, str_replace("
DICENUMBER", strdicenumber, "Someone rolled #DICENUMBER);


              
}
               return 
1// The return statement is going to signal to the command was executed properly
         
}
         return 
0// the return 0; is not going to be executed.

GabiXx is offline   Reply With Quote
Old 26/12/2015, 11:10 AM   #7
Ritzy2K
High-roller
 
Ritzy2K's Avatar
 
Join Date: Jun 2014
Location: India
Posts: 1,547
Reputation: 170
Default Re: Dice command.

Why are you using strcmp?
__________________
Ritzy2K is offline   Reply With Quote
Old 26/12/2015, 11:57 AM   #8
xXRevolverXx
Big Clucker
 
xXRevolverXx's Avatar
 
Join Date: Dec 2015
Location: Egypt
Posts: 78
Reputation: 14
Default Re: Dice command.

Quote:
Originally Posted by [ND]xXZeusXx. View Post
Why are you using strcmp?
Yeah exactly, Use Zcmd better, easier, It's your's, Goodluck.
xXRevolverXx 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
dice command gives the player money and then takes it back davidstyle1125 Scripting Help 1 21/07/2015 07:56 PM
Dice command help request , i give reputation ++ ! buburuzu19 Scripting Help 4 31/10/2014 09:43 AM
[Tutorial] How to Make a Dice Command kosa451 Tutorials 13 04/09/2014 07:46 PM
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 03:36 PM.


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