24.04.2016, 01:44
How do I create a random checkpoint to put anywhere on the map?
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)))+1;
cy = floatround(floatsqroot(floatpower(miny-maxy,2)))+1;
cz = floatround(floatsqroot(floatpower(minz-maxz,2)))+1;
x = random(cx)+minx;
y = random(cy)+miny;
z = random(cz)+minz;
}
stock GetRandomCPPos(&Float:x,&Float:y,&Float:z){
while(z == 0.0){
GetRandomPointInCube(-3000.0,-3000.0,0.0,3000.0,3000.0,1.0,x,y,z);
MapAndreas_FindZ_For2DCoord(x,y,z);
}
z += 1.0;
}