Problem with mysql phone number
#1

I trying to do that if someone would buy a phone number. if someone already got it its will take somthing else.
pawn Код:
new randphone = 100000 + random(899999);
                new Query[200];
                format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `phonenr` = '%d'", randphone);
                mysql_query(Query);
                if( IF HE DIDNT GOT IT )
                PlayerInfo[playerid][pPnumber] = randphone;
Reply
#2

UPPPPpppppppppppp
Reply
#3

pawn Код:
RANDPHONE: //creating a point where you can go back to
randphone = 100000 + random(899999);
new Query[200];
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `phonenr` = '%d'", randphone);
mysql_query(Query);
foreach(Player, i) //use a normal for loop if you don't have for each (i < MAX_PLAYERS)
{
    if( randphone == PlayerInfo[i][pPnumber] )
        goto RANDPHONE; //goes back to that point we made earlier
    else
        PlayerInfo[playerid][pPnumber] = randphone;
}
The best way I can think of..
Reply
#4

This code doesnt work. when i writing a new phone that already have some player (Which his not connected) its changed it.
Reply
#5

replace random(899999); with random(%d)

i think its like that ill check on my server layer as your offline as im trying to scrt a couple of mini misions
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)