SA-MP Forums Archive
Problem with mysql phone number - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with mysql phone number (/showthread.php?tid=181880)



Problem with mysql phone number - vection - 07.10.2010

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;



Re: Problem with mysql phone number - vection - 08.10.2010

UPPPPpppppppppppp


Re: Problem with mysql phone number - LarzI - 08.10.2010

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..


Re: Problem with mysql phone number - vection - 08.10.2010

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


Re: Problem with mysql phone number - Tommie1331 - 08.10.2010

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