random number help (phone system)
#1

PHP код:
Hello! Help please!
how I can make it how let the phone number begin with 0630?
pl. 
I buy the telephone and random number..
pl. not 43222, only 063043222
ie
: 0630 before phone numbers
    
else if(dialogid == DIALOG_TELEFONVETEL)
    {
        if(
response)
        {
            
GiveMoney(playerid, -30000, true);
            
BizPenz(BIZ_247, 30000);
            new 
tipus;
            switch(
listitem)
            {
                case 
0: tipus = 20;
                case 
1: tipus = 30;
                case 
2: tipus = 70;
            }
              new 
randphone[64];
            
strmid(randphone,UjTeloSzam(tipus), 0, strlen(UjTeloSzam(tipus)), 128);
            
strmid(PlayerInfo[playerid][pPnumber], randphone, 0,strlen(randphone), 128);
            
format(string, sizeof(string), "Megvetted a telefont, a szбmod: %s\n", randphone);
            
ShowPlayerDialog(playerid, DIALOG_VESZ, DIALOG_STYLE_MSGBOX, "24/7", string, "Ok", "Mйgse");
            
Cselekves(playerid, "vett egy telefont / bought a phone", 1);
            
BizzInfo[BIZ_247][bProducts]--;
        }
        
TogglePlayerControllable(playerid, true);
    }
    else if(
dialogid == DIALOG_VESZ)
    {
        if(
response)
        {
            
listitem++;
            switch(
listitem)
            {
                case 
1:
                {
                    if(
GetMoney(playerid, true) < 30000)
                    {
                        
format(string, sizeof(string), "Ezt nem tudom kifizetni\n---------------------\nI can't pay this\n");
                        
//format(gondolat, sizeof(gondolat), "%s gondolja...", PlayerName(playerid));
                        
ShowPlayerDialog(playerid, DIALOG_VESZ, DIALOG_STYLE_MSGBOX,"Hiba", string, "Ok", "Mйgse");
                        
TogglePlayerControllable(playerid, true);
                        return 
1;
                    }
                    
GiveMoney(playerid, -30000, true);
                    
BizPenz(BIZ_247, 30000);
                    new 
randphone = 10000 + random(89999);
                    
PlayerInfo[playerid][pPnumber] = randphone;
                    
format(string, sizeof(string), "Megvetted a telefont, a szбmod: %d\n", randphone);
                    
ShowPlayerDialog(playerid, DIALOG_VESZ, DIALOG_STYLE_MSGBOX, "24/7", string, "Ok", "Mйgse");
                    
Cselekves(playerid, "vett egy telefont / bought a phone", 1);
                    
BizzInfo[BIZ_247][bProducts]--; 
Reply
#2

Can you put the script in pawn tags? It's hard to read it like this.
Reply
#3

ready
Reply
#4

pawn Код:
new
    phonenumber[10]

format(phonenumber, sizeof (phonenumber), "0630%i", RandomEx(10000, 99999));
pawn Код:
stock RandomEx(min, max)
{
    return random(max - min) + min;
}
Reply
#5

to write this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)