SA-MP Forums Archive
Random house coordinates - 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)
+--- Thread: Random house coordinates (/showthread.php?tid=569100)



Random house coordinates - rOps - 28.03.2015

Hi all, maybe you know, how I can get from the all my server houses one random house? My houses system is Dynamic, so I know, that it's possible.

HTML Code:
new house = random(MAX_HOUSES);
	            						
SetPlayerCheckpointEx(playerid, PIZZA_DELIVERY_CHECKPOINT, HouseInfo[house][ExitX], HouseInfo[house][ExitY], HouseInfo[house][ExitZ], 3.0);
This is my code, but checkpoint is going to the 0.0, 0.0, 0.0 coordinates.


Re: Random house coordinates - Sergei - 28.03.2015

You don't occupy all house "slots" then.


Re: Random house coordinates - rOps - 28.03.2015

How to do that?


Re: Random house coordinates - Juvanii - 28.03.2015

did you load the values from your files and stored it in the variables? if not, the variables become with zeros.


Re: Random house coordinates - rOps - 28.03.2015

Quote:
Originally Posted by Juvanii
View Post
did you load the values from your files and stored it in the variables? if not, the variables become with zeros.
Yes, the houses are loaded from mysql db


Re: Random house coordinates - Juvanii - 28.03.2015

Quote:
Originally Posted by rOps
View Post
Yes, the houses are loaded from mysql db
make a simple command to check if it has been loaded or not such as:
pawn Code:
CMD:test(playerid,params[])
{
    new string[50];
    format(string,sizeof(string),"%f ,%f ,%f", HouseInfo[house][ExitX],HouseInfo[house][ExitY],HouseInfo[house][ExitZ]);
    SendClientMessage(playerid,-1,string);
    return 1;
}