02.03.2019, 13:14
I scripted a phone number system but how do i make a number unique like if a player has a phone number,for example,Bob's phone number is 22345,no one can recive the number(22345)again.
I kind of know what i have to do,but im new into scripting and i don't really know how to do it
This is the part where the numbers are generated:
case 0:
{
new rand = 10000 + random(89999),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);
}
I kind of know what i have to do,but im new into scripting and i don't really know how to do it
This is the part where the numbers are generated:
case 0:
{
new rand = 10000 + random(89999),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);
}