SA-MP Forums Archive
Random pickups on mapped terrain - 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 pickups on mapped terrain (/showthread.php?tid=591343)



Random pickups on mapped terrain - Gusteakas - 10.10.2015

hello. Is it possible to make random pickups on a map ( made with map constructor above the sky ) without taking a lot of coordinates by myself?


Re: Random pickups on mapped terrain - AbyssMorgan - 11.10.2015

The problem is that it can draw a point on the water

MapAndreas: https://sampforum.blast.hk/showthread.php?tid=275492

PHP код:
stock GetRandomPointInCube(Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz,&Float:x,&Float:y,&Float:z){
    new 
cx,cy,cz;
    
cx floatround(floatsqroot(floatpower(minx-maxx,2)));
    
cy floatround(floatsqroot(floatpower(miny-maxy,2)));
    
cz floatround(floatsqroot(floatpower(minz-maxz,2)));
    
random(cx)-(cx/2);
    
random(cy)-(cy/2);
    
random(cz)-(cz/2);
}


new 
Float:myxFloat:myyFloat:myz;
GetRandomPointInCube(-3000.0,-3000.0,1.0,3000.0,3000.0,500.0,myx,myy,myz);
MapAndreas_FindZ_For2DCoord(myx,myy,myz);
myz += 1.0//match