Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new PlayerText: txdText[MAX_PLAYERS]; // globalnie
- forward OnAnimatedTextDraw(playerid, tick);
- public OnAnimatedTextDraw(playerid, tick)
- {
- new pos= GetPVarInt(playerid, "atxd_step");
- new c1= GetPVarInt(playerid, "atxd_color");
- new Float: s1= (c1-((c1 >> 8) << 8)) / (tick/3.0); c1= (c1 >> 8) << 8;
- new c2= GetPVarInt(playerid, "atxd_color2");
- new Float: s2= (c2-((c2 >> 8) << 8)) / (tick/3.0); c2= (c2 >> 8) << 8;
- if (pos < (tick/3))
- {
- c1 += floatround(pos*s1); PlayerTextDrawColor(playerid, txdText[playerid], c1);
- c2 += floatround(pos*s2); PlayerTextDrawBackgroundColor(playerid, txdText[playerid], c2);
- PlayerTextDrawShow(playerid, txdText[playerid]);
- }
- else
- if (pos > ((tick/3)*2))
- {
- c1 += floatround((tick-pos)*s1); PlayerTextDrawColor(playerid, txdText[playerid], c1);
- c2 += floatround((tick-pos)*s2); PlayerTextDrawBackgroundColor(playerid, txdText[playerid], c2);
- PlayerTextDrawShow(playerid, txdText[playerid]);
- }
- SetPVarInt(playerid, "atxd_step", ++pos);
- if (pos >= tick)
- {
- KillTimer(GetPVarInt(playerid, "atxd_timer"));
- SetPVarInt(playerid, "atxd_timer", -1);
- PlayerTextDrawDestroy(playerid, txdText[playerid]);
- }
- }
- stock AnimatedTextDraw(playerid, text[], color1= 0x000000ff, color2= 0xffffff66, time= 3)
- {
- if (!IsPlayerValid(playerid)) return 0;
- if (strlen(text) <= 0) return 0;
- if ( (time < 3) || (time > 20) ) return 0;
- if (GetPVarInt(playerid, "atxd_timer") >= 0)
- {
- KillTimer(GetPVarInt(playerid, "atxd_timer"));
- PlayerTextDrawDestroy(playerid, txdText[playerid]);
- }
- txdText[playerid]= CreatePlayerTextDraw(playerid, 320.0, 200.0, text);
- PlayerTextDrawTextSize(playerid, txdText[playerid], 0.0, 480.0);
- PlayerTextDrawLetterSize(playerid, txdText[playerid], 1.2, 3.2);
- PlayerTextDrawAlignment(playerid, txdText[playerid], 2);
- PlayerTextDrawFont(playerid, txdText[playerid], 3);
- //PlayerTextDrawColor(playerid, txdText[playerid], 0x00000000);
- PlayerTextDrawSetProportional(playerid, txdText[playerid], true);
- //PlayerTextDrawSetShadow(playerid, txdText[playerid], false);
- PlayerTextDrawSetOutline(playerid, txdText[playerid], 1);
- //PlayerTextDrawBackgroundColor(playerid, txdText[playerid], 0x00000000);
- PlayerTextDrawShow(playerid, txdText[playerid]);
- SetPVarInt(playerid, "atxd_color", color1);
- SetPVarInt(playerid, "atxd_color2", color2);
- SetPVarInt(playerid, "atxd_step", 1);
- SetPVarInt(playerid, "atxd_timer", SetTimerEx("OnAnimatedTextDraw", 10, true, "dd", playerid,((time*1000)/10)));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement