24.02.2019, 12:40
case 0:
{
new rand = random(100000),string[64];
if(PlayerInfo[playerid][pCellphone] == 1) return SendClientMessage(playerid, COLOR_GREY, "You already have a phone");
PlayerInfo[playerid][pNumber] = rand;
PlayerInfo[playerid][pCellphone] += 1;
format(string,sizeof(string), "Your new phone number is now %d",PlayerInfo[playerid][pNumber]);
SendClientMessage(playerid, COLOR_WHITE, string);
UpdateVariable(playerid, pNumberx);
UpdateVariable(playerid, pCellphonex);
}
So this is what happens when a player buys a phone form the shop,now,it works perfectly but i do have some things that i want to add and i have no ideea how.
First: I want the phone numbers to be generated from 10,000 to 100,000 because this,new rand = random(100000),this generates then numbers from 0 to 100,000 or from 1 i don't know for sure.
And second,if a number is already asociated to a player,like if a player buys a phone and he gets a random phone number
i want that number to not be given to another player ever again.
I do hope you can understand what i want to do and i hope you can help me.
Thanks in advance
{
new rand = random(100000),string[64];
if(PlayerInfo[playerid][pCellphone] == 1) return SendClientMessage(playerid, COLOR_GREY, "You already have a phone");
PlayerInfo[playerid][pNumber] = rand;
PlayerInfo[playerid][pCellphone] += 1;
format(string,sizeof(string), "Your new phone number is now %d",PlayerInfo[playerid][pNumber]);
SendClientMessage(playerid, COLOR_WHITE, string);
UpdateVariable(playerid, pNumberx);
UpdateVariable(playerid, pCellphonex);
}
So this is what happens when a player buys a phone form the shop,now,it works perfectly but i do have some things that i want to add and i have no ideea how.
First: I want the phone numbers to be generated from 10,000 to 100,000 because this,new rand = random(100000),this generates then numbers from 0 to 100,000 or from 1 i don't know for sure.
And second,if a number is already asociated to a player,like if a player buys a phone and he gets a random phone number
i want that number to not be given to another player ever again.
I do hope you can understand what i want to do and i hope you can help me.
Thanks in advance