Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Textdraw fixer
- @author: mrdrifter
- @update: 2014-02-13
- @description: Biblioteka naprawia bugi SA:MP związane z TextDrawami
- */
- #if defined _draw_fix_included
- #endinput
- #endif
- #define _draw_fix_included
- new bool:Textdraw@ALS_@Data[Text:MAX_TEXT_DRAWS];
- new bool:PlayerTextdraw@ALS_@Data[MAX_PLAYERS][PlayerText:MAX_PLAYER_TEXT_DRAWS];
- stock Text:TextDrawCreateEx(Float:x, Float:y, text[])
- {
- PolishChars@ALS_@Replace(text);
- new Text:id = TextDrawCreate(x, y, text);
- Textdraw@ALS_@Data[id] = true;
- return id;
- }
- #define TextDrawCreate TextDrawCreateEx
- stock TextDrawDestroyEx(Text:text)
- {
- if(!Textdraw@ALS_@Data[text]) return INVALID_TEXT_DRAW;
- Textdraw@ALS_@Data[text] = false;
- return TextDrawDestroy(text);
- }
- #define TextDrawDestroy TextDrawDestroyEx
- stock TextDrawSetString2(Text:text, string[])
- {
- if(!Textdraw@ALS_@Data[text]) return INVALID_TEXT_DRAW;
- return TextDrawSetString(text, string);
- }
- stock TextDrawSetStringEx(Text:text, string[])
- {
- if(!Textdraw@ALS_@Data[text]) return INVALID_TEXT_DRAW;
- Space@ALS_@Delete(string);
- PolishChars@ALS_@Replace(string);
- return TextDrawSetString(text, string);
- }
- #define TextDrawSetString TextDrawSetStringEx
- stock PlayerText:CreatePlayerTextDrawEx(playerid, Float:x, Float:y, text[])
- {
- PolishChars@ALS_@Replace(text);
- new PlayerText:id = CreatePlayerTextDraw(playerid, x, y, text);
- PlayerTextdraw@ALS_@Data[playerid][id] = true;
- return id;
- }
- #define CreatePlayerTextDraw CreatePlayerTextDrawEx
- stock PlayerTextDrawDestroyEx(playerid, PlayerText:text)
- {
- if(!PlayerTextdraw@ALS_@Data[playerid][text]) return INVALID_TEXT_DRAW;
- PlayerTextdraw@ALS_@Data[playerid][text] = false;
- return PlayerTextDrawDestroy(playerid, text);
- }
- #define PlayerTextDrawDestroy PlayerTextDrawDestroyEx
- stock PlayerTextDrawSetString2(playerid, PlayerText:text, string[])
- {
- if(!PlayerTextdraw@ALS_@Data[playerid][text]) return INVALID_TEXT_DRAW;
- return PlayerTextDrawSetString(playerid, text, string);
- }
- stock PlayerTextDrawSetStringEx(playerid, PlayerText:text, string[])
- {
- if(!PlayerTextdraw@ALS_@Data[playerid][text]) return INVALID_TEXT_DRAW;
- Space@ALS_@Delete(string);
- PolishChars@ALS_@Replace(string);
- return PlayerTextDrawSetString(playerid, text, string);
- }
- #define PlayerTextDrawSetString PlayerTextDrawSetStringEx
- stock Space@ALS_@Delete(string[])
- {
- new len = strlen(string);
- if(string[len-1] == ' ')
- {
- strdel(string, len-1, len);
- Space@ALS_@Delete(string);
- }
- }
- stock PolishChars@ALS_@Replace(string[])
- {
- for(new x, c = strlen(string);x<c; x++)
- {
- switch(string[x])
- {
- case 'ł':
- string[x] = 'l';
- case 'ż', 'ź':
- string[x] = 'z';
- case 'ć':
- string[x] = 'c';
- case 'ń':
- string[x] = 'n';
- case 'ę':
- string[x] = 'e';
- case 'ó':
- string[x] = 'o';
- case 'ą':
- string[x] = 'a';
- case 'ś':
- string[x] = 's';
- case 'Ł':
- string[x] = 'L';
- case 'Ż', 'Ź':
- string[x] = 'Z';
- case 'Ć':
- string[x] = 'C';
- case 'Ń':
- string[x] = 'N';
- case 'Ę':
- string[x] = 'E';
- case 'Ó':
- string[x] = 'O';
- case 'Ą':
- string[x] = 'A';
- case 'Ś':
- string[x] = 'S';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement