query sql problem - 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: query sql problem (
/showthread.php?tid=219017)
query sql problem -
vardanega - 31.01.2011
Hello, I would like to display in a dialog with a list of six random names in my database but I do not know how to select six matches at random.
If it were possible to give me a sample code or explain to me how you actually do I would be very grateful.
Vince
PS: I'm French sorry for spelling!
Re: query sql problem -
Vince - 31.01.2011
Код:
SELECT * FROM `tablename` ORDER BY RAND() LIMIT 6
Should work.
Re: query sql problem -
vardanega - 31.01.2011
Thanks Vince
One last question:
I have 20 vehicles on my server and I would put all the players connected to a vehicle and the vehicle is unoccupied should be deleted, I made this code but I do not think it works, what do you think ?
Код:
Stock MettreJoueurVoiture ()
{
for (new i; i <MAX_PLAYERS; i + +)
{
new id = 0;
if (id! & id = 16 & <16)
{
PutPlayerInVehicle (i, vi, 0);
vi + +;
return 1;
}
else
{
DestroyVehicle (vi);
}
}
}
Thanks !