Please help me on this
#1

How to do it?

Example:
Код:
1000
5000
600
788
96666
....
I want to give player money from it

Код:
GivePlayerMoney(line);
P.S : Without using 'random' function to do it
Reply
#2

Quote:
Originally Posted by akib
Посмотреть сообщение
How to do it?

Example:
Код:
1000
5000
600
788
96666
....
I want to give player money from it

Код:
GivePlayerMoney(line);
P.S : Without using 'random' function to do it
Can you explain what those first numbers are for?
Код:
1000
5000
600
788
96666
Reply
#3

Quote:
Originally Posted by YourWhalecum
Посмотреть сообщение
Can you explain what those first numbers are for?
Код:
1000
5000
600
788
96666
These numbers are random, manually added by admins or owner, just suppose like this
PHP код:
format(msg,sizeof(msg),"1000\n5000\n600\n788\n96666"); 
and i have to show it like this
PHP код:
GivePlayerMoney(line); 
Line will be selected one by one,

1st time it should be GivePlayerMoney(playerid,1000);
2nd time it should be GivePlayerMoney(playerid,5000);
Reply
#4

You use arrays for this.
Reply
#5

Код:
new myArray[1][5];

myArray[1][1] = 1000;
myArray[1][2] = 5000;
etc. etc.
Reply
#6

Quote:
Originally Posted by akib
Посмотреть сообщение
These numbers are random, manually added by admins or owner, just suppose like this
PHP код:
format(msg,sizeof(msg),"1000\n5000\n600\n788\n96666"); 
and i have to show it like this
PHP код:
GivePlayerMoney(line); 
Line will be selected one by one,

1st time it should be GivePlayerMoney(playerid,1000);
2nd time it should be GivePlayerMoney(playerid,5000);
PHP код:
new array[10]; // 10 = max numbers that will be randomeed can be any thing
array[0] = 1000;
array[
1] = 5000;
array[
2] = 600;
array[
3] = 788;
array[
4] = 96666;
new 
ran;
do
{
    
ran random(sizeof(array));
}while(array[
ran] != 0);
array[
ran] >> your random number 
Reply
#7

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
PHP код:
new array[10]; // 10 = max numbers that will be randomeed can be any thing
array[0] = 1000;
array[
1] = 5000;
array[
2] = 600;
array[
3] = 788;
array[
4] = 96666;
new 
ran;
do
{
    
ran random(sizeof(array));
}while(array[
ran] != 0);
array[
ran] >> your random number 
actually this ^
dunno why i went into multidimensional arrays when one dimension is probs enough for him.
Reply
#8

Quote:
Originally Posted by aristoffky
Посмотреть сообщение
actually this ^
dunno why i went into multidimensional arrays when one dimension is probs enough for him.
actually multidimensional arrays would be needed if he wants te seperate random numbers for each admin

like at the same time 2x admins type /randomnumbers 100 200 155 300 & /randomnumbers 20 56 8 9788 451 22

in that case it will be needed and be some like this :
PHP код:
new array[MAX_PLAYERS][10];
array[
first admin playerid][10];
array[
second admin playerid][10]; 
but it wouldn't happen and needed i think
Reply
#9

Thanks all for your reply.

But all ans have a limited array, i need infinity array, there can be 10values or 100values or 1000values or can be 123values
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
Why do you not want to use random, how do you intend to select a number?
he wants to make custom random cmd between some int's like


/customrandom 1 2 3 100 50

the randomed numbers will be 1 or 2 or 3 or 100 or 50
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)