24.01.2014, 17:01
@Nero_3D - Great function! anyways I just added if they use streamer they are going to use CreateDynamicObject or else they will use CreateObject
pawn Code:
stock CreateSquareObjectShape(playerid, Float: fDiag, objectsPerLine = 10)
{
new
Float: rX[2],
Float: rY[2],
Float: fZ
;
if(GetPlayerPos(playerid, fX[0], fY[0], fZ))
{
new
Float: inc = (fDiag * 0.707 / objectsPerLine),
Float: cos = (fDiag * floatcos(45, degrees)),
Float: sin = (fDiag * floatsin(45, degrees))
;
rX[1] = rX[0] + cos;
rY[1] = rY[0] + sin;
rX[0] -= cos;
rY[0] -= sin;
for(cos = rX[1]; cos > rX[0]; cos -= inc)
{
#if defined CreateDynamicObject
CreateDynamicObject(1598, cos, rY[0], fZ, 0, 0, 0);
CreateDynamicObject(1598, cos, rY[1], fZ, 0, 0, 0);
#else
CreateObject(1598, cos, rY[0], fZ, 0, 0, 0);
CreateObject(1598, cos, rY[1], fZ, 0, 0, 0);
#endif
}
for(sin = rY[1]; sin > rY[0]; sin -= inc)
{
#if defined CreateDynamicObject
CreateDynamicObject(1598, rX[0], sin, fZ, 0, 0, 0);
CreateDynamicObject(1598, rX[1], sin, fZ, 0, 0, 0);
#else
CreateObject(1598, rX[0], sin, fZ, 0, 0, 0);
CreateObject(1598, rX[1], sin, fZ, 0, 0, 0);
#endif
}
return true;
}
return false;
}