Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include foreach
- #pragma dynamic 99999999999
- #define AddSymbol(%0); new %0;
- #define iLoop(%0) for(new i; i<%0; i++)
- #define CheckAllPlayers() foreach(new i:Player)
- #define AutoPub:%0(%1) forward %0(%1);\
- public %0(%1)
- AddSymbol(PlayerText:HMMSG[ MAX_PLAYERS ],Showed[ MAX_PLAYERS ],TimerEx[ MAX_PLAYERS ]);
- /* */
- //-----------------------------------------------------------------|
- //|____________________Natives_____________________________________|
- //| |
- //| native GameHMTextShowForPlayer(playerid,text[],time = 3000);|
- //| native GameHMTextShowForAll(text[], time = 3000); |
- //|________________________________________________________________|
- //-----------------------------------------------------------------|
- /* */
- static stock AutoReturn(input[])
- {
- if(strlen(input) > 18)
- {
- for(new i = 18, j = strlen(input); i < j; i += 19, j ++)
- {
- strins(input, "~n~", i, i);
- }
- }
- return 1;
- }
- stock GameHMTextShowForPlayer(playerid,text[],time = 3000)
- {
- if(Showed[playerid]) return 1;
- AutoReturn(text);
- Showed[playerid] = true;
- PlayerTextDrawSetString(playerid, HMMSG[playerid], text);
- ShowMsgTextForPlayer(playerid);
- SetTimerEx("HideMSGText",time,false,"d",playerid);
- TimerEx[playerid] = SetTimerEx("HideMSGBar",1,true,"d",playerid);
- return 1;
- }
- stock GameHMTextShowForAll(text[], time = 3000)
- {
- CheckAllPlayers()
- {
- GameHMTextShowForPlayer(i, text, time);
- }
- return 1;
- }
- stock CreateMSG(playerid)
- {
- HMMSG[playerid] = CreatePlayerTextDraw(playerid, 4.000000, 4.479990, "");
- PlayerTextDrawLetterSize(playerid, HMMSG[playerid], 0.294999, 1.135197);
- PlayerTextDrawTextSize(playerid, HMMSG[playerid], 131.500000, -44.240024);
- PlayerTextDrawAlignment(playerid, HMMSG[playerid], 1);
- PlayerTextDrawColor(playerid, HMMSG[playerid], -1);
- PlayerTextDrawUseBox(playerid, HMMSG[playerid], true);
- PlayerTextDrawBoxColor(playerid, HMMSG[playerid], 75);
- PlayerTextDrawSetShadow(playerid, HMMSG[playerid], 0);
- PlayerTextDrawSetOutline(playerid, HMMSG[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, HMMSG[playerid], 255);
- PlayerTextDrawFont(playerid, HMMSG[playerid], 1);
- PlayerTextDrawSetProportional(playerid, HMMSG[playerid], 1);
- return 1;
- }
- stock DestroyMSG(playerid)
- {
- iLoop(1)
- {
- PlayerTextDrawDestroy(playerid,HMMSG[playerid]);
- }
- }
- stock ShowMsgTextForPlayer(playerid)
- {
- iLoop(1)
- {
- PlayerTextDrawShow(playerid,HMMSG[playerid]);
- }
- }
- stock HideMsgTextForPlayer(playerid)
- {
- iLoop(1)
- {
- PlayerTextDrawHide(playerid,HMMSG[playerid]);
- }
- }
- AutoPub:HideMSGBar(playerid)
- {
- iLoop(100)
- {
- SendClientMessage(playerid, -1, "");
- return 1;
- }
- KillTimer(TimerEx[playerid]);
- return 1;
- }
- AutoPub:HideMSGText(playerid)
- {
- Showed[playerid] = false;
- HideMsgTextForPlayer(playerid);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- CreateMSG(playerid);
- if(funcidx("HMMSG_OnPlayerConnect") != -1)
- {
- return CallLocalFunction("HMMSG_OnPlayerConnect", "i", playerid);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- DestroyMSG(playerid);
- if(funcidx("HMMSG_OnPlayerDisconnect") != -1)
- {
- return CallLocalFunction("HMMSG_OnPlayerDisconnect", "i", playerid);
- }return 1;
- }
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect HMMSG_OnPlayerConnect
- #if defined _ALS_OnPlayerDisconnect
- #undef OnPlayerDisconnect
- #else
- #define _ALS_OnPlayerDisconnect
- #endif
- #define OnPlayerDisconnect HMMSG_OnPlayerDisconnect
- forward HMMSG_OnPlayerConnect(playerid);
- forward HMMSG_OnPlayerDisconnect(playerid,reason);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement