[HELP] Phone number
#1

Hello!

I need a random phone numer.. Like this 06204563649. Only the red numer random, 0620 is fix.
But i dont know how i this.

pInfo[playerid][pNumber] = ??

I try a lot of idea, but none of them work. Please help.
Thank you!
Reply
#2

pawn Код:
new rand = random(7777777) + 1000000;
pInfo[playerid][pNumber] = rand + 06200000000
Idk whether it works.
Reply
#3

Uhhm, its generate "1907366494" phone number:\ its not good.
Reply
#4

If u didn't add ';' then try this
pawn Код:
new rand = random(7777777) + 1000000;
pInfo[playerid][pNumber] = rand + 06200000000;
Reply
#5

The mode didnt strart when i forget ";", so i write this. and then generate the number.

(Sorry for my bad english )
Reply
#6

did it work?? if not give me ur code i will ty to fix it..
Reply
#7

not working..

Код:
		if(listitem == 3)
		{
			if(pInfo[playerid][pMobile] == 1)
			{
			    if(pInfo[playerid][pMoney] >= 200)
				{
					new rand = random(7777777) + 1000000;
					pInfo[playerid][pNumber] = rand + 06200000000;

					pInfo[playerid][pMoney] -= 200;

					format(S, sizeof(S), "Szerződйst kцtцttйl a telefon szolgбltatуval! Telefonszбmod: %d", pInfo[playerid][pNumber]);
					SendClientMessage(playerid, NARANCS, S);

					cmd_me(playerid, "szerződйst kцtцtt a telefon szolgбltatуval.");
				}
				else
				{
				    SendClientMessage(playerid, PIROS, "Nincs elйg pйnzed! ($200)");
				}
			}
			else
			{
			    SendClientMessage(playerid, PIROS, "Nem kцthetsz szerződйst amнg nincs telefonod!");
			}
Reply
#8

Assuming that pInfo[playerid][pNumber] should be a string:

pawn Код:
format(pInfo[playerid][pNumber], 12, "0620%d%d%d%d%d%d%d", random(10), random(10), random(10), random(10), random(10), random(10), random(10));
The last 7 digits will be totally random numbers (0-9).
Reply
#9

Even random could return similar values (though the chance is 1 in 10000000) so make sure you check against a stored table of phone numbers. Or you could use a random telephone number generator from the web using HTTP. Unnecessary, though!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)