Random numbers
#1

Deleted
Reply
#2

PHP код:
CMD:numbers(playerid,params[])
{
    if(
PlayerData[playerid][proplayer] >= 1)
    {
        new 
string[18];
        
format(stringsizeof(string), "random number: %d"random(11));
        
SendClientMessage(playerid, -1string);
    }
    return 
1;

Using the "random" function could return " 0" i hope it will not be a problem, if there is a problem you can use:

PHP код:
CMD:numbers(playerid,params[])
{
    if(
PlayerData[playerid][proplayer] >= 1)
    {
        new 
string[18];
        
format(stringsizeof(string), "random number: %d"random(10)+1);
        
SendClientMessage(playerid, -1string);
    }
    return 
1;

Reply
#3

but if he use that command can be and 0 of them ? i need only from 1 to 11
Reply
#4

try this.

Quote:
Originally Posted by JuanStone
Посмотреть сообщение
PHP код:
CMD:numbers(playerid,params[])
{
    if(
PlayerData[playerid][proplayer] >= 1)
    {
        new 
string[18];
        
format(stringsizeof(string), "random number: %d"random(10)+1);
        
SendClientMessage(playerid, -1string);
    }
    return 
1;

Reply
#5

(random(11) + 1) will be 1-11
Reply
#6

Jefff if i use that randrom 11+1 when he use command can be and number 12
Reply
#7

The function random starts in 0, if you use 11+1 would be 0+1 to 11 (limit 11 +1-1), Jeff did it well.

PHP код:
CMD:numbers(playerid,params[])
{
    if(
PlayerData[playerid][proplayer] >= 1)
    {
        new 
string[18];
        
format(stringsizeof(string), "random number: %d"random(11)+1); // 0+1 - 10+1 limit 11.
        
SendClientMessage(playerid, -1string);
    }
    return 
1;

random(11) = "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10"+1 = random 1-11. start in 0.
Reply
#8

Thanks guys ! +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)