22.05.2011, 21:52
Quote:
pawn Код:
|
X, Y and Z are the coordinates of the center (the 0 in the image) in your example it is the building
![](http://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Versine.svg/220px-Versine.svg.png)
The code repeats itself till the state of the player isnt PLAYER_STATE_WASTED
And with each tick it increase the angle by one
pawn Код:
SetTimerEx("TRotate", 100, false, "ifffff", playerid, X, Y, Z, R, A + 1.0);
And we know that cos and sin get always a value between [-1;1] (cosІ + sinІ = 1 [pythagorean])
To get our circle with the correct radius we just multiply the cos / sin with our wanted amplitude
=> X = CENTER_X + cos(Angle) * Radius; Y = CENTER_Y + sin(Angle) * radius;
And Z = CENTER_Z + 10 for a nice camera position
Quote:
pawn Код:
|
variable ++ = variable + 1, variable -- = variable - 1
(the operator can be found in float.inc)
Thats the main function where we create our temporary textdraw
pawn Код:
stock StartChange(playerid, Float: X, Float: Y, Float: Z, Float: cX, Float: cY, Float: cZ) {
new Text:gText = TextDrawCreate(0.0, 0.0, "_");
TextDrawUseBox(gText, true);
cbOpacity(playerid, gText, 0, false, X, Y, Z, cX, cY, cZ);
}
First is that part executed till it reach 255 (0xFF) the full opacity
pawn Код:
//
if(++opacity >= 255) { // Where did you define ++opacity and what is it?
SetTimerEx("cbOpacity", 100, false, "iiib", playerid, _:tText, opacity, true);
SetPlayerCameraPos(playerid, cX, cY, cZ);
SetPlayerCameraLookAt(playerid, X, Y, Z);
return;
}
And we call now our other code, so it vanish again
pawn Код:
"iiib", playerid, _:tText, opacity, true)
pawn Код:
//
if(--opacity <= 0) { // Where did you define --opacity and what is it?
TextDrawDestroy(tText);
return ;
}
at least we destroy our temporary textdraw => end
Good luck
![Wink](images/smilies/wink.png)