
new Float:centerX = 0.0;//center of the circle
new Float:centerY = 0.0;//center of the circle
new Float:radius = 3.0;//radius of the circle
new Float:random = frandom(0, 6.28);
new Float: px = centerX/2+floatcos(random,degrees)*radius;
new Float: py = centerY/2+floatsin(random,degrees)*radius;
printf("x%f y%f",px,py);
Float:frandom(Float:max, Float:min = 0.0, dp = 4)//made by ******
{
new Float:mul = floatpower(10.0, dp),
imin = floatround(min * mul),
imax = floatround(max * mul);
return float(random(imax - imin) + imin) / mul;
}
new Float:random = frandom(0, 6.28);
Float:frandom(Float:max, Float:min = 0.0, dp = 4)//made by ******
{
new Float:mul = floatpower(10.0, dp),
imin = floatround(min * mul),
imax = floatround(max * mul);
return float(random(imax - imin) + imin) / mul;
}
COMMAND:fireup(playerid,params[]){
new Float:centerX = 2814.9570;//center of the circle
new Float:centerY = 1313.2760;//center of the circle
new Float:radius = 3.0;//radius of the circle
for(new i=0;i<8;i++){
new Float:rrandom = frandom(0, 6.28);
new Float: px = centerX/2+floatcos(rrandom,degrees)*radius;
new Float: py = centerY/2+floatsin(rrandom,degrees)*radius;
CreateObject(18688, px,py, 10.7500,0,0,0,300.0);
printf("%f,%f",px,py);
}
//2814.9570,1313.2760,10.7500
return 1;
}
1408.816772,658.124267 1406.247192,655.061950 1405.515258,657.019592 1408.596923,658.296081 1409.357910,657.322021 1406.039794,655.248657 1409.434814,657.053833 1407.825805,654.668395
|
This code isn't working for me :/ it creates object outside of the circle...
if the center is 2814.9570,1313.2760,10.7500 and it's X Y is 2814.9570,1313.2760 then Код:
Float:frandom(Float:max, Float:min = 0.0, dp = 4)//made by ******
{
new Float:mul = floatpower(10.0, dp),
imin = floatround(min * mul),
imax = floatround(max * mul);
return float(random(imax - imin) + imin) / mul;
}
COMMAND:fireup(playerid,params[]){
new Float:centerX = 2814.9570;//center of the circle
new Float:centerY = 1313.2760;//center of the circle
new Float:radius = 3.0;//radius of the circle
for(new i=0;i<8;i++){
new Float:rrandom = frandom(0, 6.28);
new Float: px = centerX/2+floatcos(rrandom,degrees)*radius;
new Float: py = centerY/2+floatsin(rrandom,degrees)*radius;
CreateObject(18688, px,py, 10.7500,0,0,0,300.0);
printf("%f,%f",px,py);
}
//2814.9570,1313.2760,10.7500
return 1;
}
Код:
1408.816772,658.124267 1406.247192,655.061950 1405.515258,657.019592 1408.596923,658.296081 1409.357910,657.322021 1406.039794,655.248657 1409.434814,657.053833 1407.825805,654.668395 |