[Help] Spread Objects Evenly (Math...) - 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: [Help] Spread Objects Evenly (Math...) (
/showthread.php?tid=447766)
[Help] Spread Objects Evenly (Math...) -
BloodMaster - 01.07.2013
Hi everyone.
So, problem is this. I want to create 10 000 (streamed) objects, but I want to spread them evenly on the whole world.
Size of world is 6000x6000 (36000000І meters) [Starts from -3000 to 3000], what's 1 object per 3600І area (60x60).
Only problem is that I can't find good formula to do that...
edit: i only need x and y, not z.
If anyone know's some simple/hard way, please explain (You don't have to write code).
Thanks in advance.
Re: [Help] Spread Objects Evenly (Math...) -
BloodMaster - 01.07.2013
Kinda solved it. (Just need to expand all over the map.)
Код:
stock SpawnObjects()
{
SendRconCommand("password 854agd15");
new Float:x,Float:y;
for(new i=-60; i<60;i++)
{
x=i*60;
for(new b=-60; b<60;b++)
{
y=b*60;
new Float:zpos;
printf("doing %d",b);
GetPointZPos(x,y,zpos);
CreateDynamicObject(3279,x,y,zpos,0,0,0);
}
}
print("DONE");
SendRconCommand("password 0");
return 1;
}
Re: [Help] Spread Objects Evenly (Math...) -
Vince - 01.07.2013
pawn Код:
for(new Float:x = -3000.0; x < 3000.0; x += 100.0) // x
{
for(new Float:y = -3000.0; y < 3000.0; y += 100.0) //y
{
CreateDynamicObject(3279, x, y, zpos, 0, 0, 0);
}
}
That's it, basically.
Re: [Help] Spread Objects Evenly (Math...) -
BloodMaster - 01.07.2013
Thank you Vince, works perfectly.