Dice command.
#1

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
Reply
#2

Can you explain more what do you need obviously ?. Thanks.
Reply
#3

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.
}
https://sampforum.blast.hk/showthread.php?tid=85697 <<< Download the include

Enjoy
Reply
#4

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.
}
https://sampforum.blast.hk/showthread.php?tid=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.
Reply
#5

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.
}
https://sampforum.blast.hk/showthread.php?tid=85697 <<< Download the include

Enjoy
nice copy from https://sampforum.blast.hk/showthread.php?tid=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
Reply
#6

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.

Reply
#7

Why are you using strcmp?
Reply
#8

Quote:
Originally Posted by [ND]xXZeusXx.
View Post
Why are you using strcmp?
Yeah exactly, Use Zcmd better, easier, It's your's, Goodluck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)