SA-MP Forums Archive
[Include] Textdraw Flags - Over 30 country flags - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Textdraw Flags - Over 30 country flags (/showthread.php?tid=358029)

Pages: 1 2


Textdraw Flags - Over 30 country flags - Drebin - 09.07.2012

Textdraw Country Flags

Overview

This include gives you access to textdraw flags of over 30 countries, for instance USA, Canada, Brazil, Germany, Sweden and many others. They can be created with one simple function.



Creating/Showing a flag

pawn Код:
native TextDrawFlagShowForPlayer(playerid, flagtype, Float:X, Float:Y, clickable);

//Example
TextDrawFlagShowForPlayer(playerid, FLAG_TYPE_GERMANY, 320.0, 240.0, 1);
playerid - The ID of the player to show the flag to
flagtype - The flag type to show to the player
Float:X - The X coordinate of the flag on the player's screen
Float:Y - The Y coordinate of the flag on the player's screen
clickable - Determines whether the flag can be clicked or not



Checking for a flag being clicked

If a certain flag is shown to the player and the clickable parameter has been set to 1, OnPlayerSelectPlayerTextDraw() gets called:
pawn Код:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(playertextid == FLAG_GERMANY[playerid])
    {
        SendClientMessage(playerid, -1, "You have clicked on the flag of Germany!");
    }
    return 1;
}
(To select textdraws use SelectTextDraw.)



Deleting/Hiding a flag

To delete a flag shown on a player's screen, simply use

pawn Код:
native TextDrawFlagHideForPlayer(playerid, flagtype);

//Example
TextDrawFlagHideForPlayer(playerid, FLAG_TYPE_GERMANY);
playerid - The ID of the player of whom you want to delete the shown flag
flagtype - The flagtyp to delete

NOTE: You can only create one flag of the same flagtype at a time. Means if there is already a German flag on the player's screen, you can not create another German flag for the same player. This is to prevent a mixing up of the textdraw IDs.



Placing a flag

All flags have the same size. To place a flag, I suggest you to use Zamaroth's Textdraw Editor. Create a new textdraw with "_" as the text. Set the font size to X 0.50 and Y 3.90. Enable the box and set the box size to X 33.0 and Y 54.5. Then set the alignment to 2. You now have a box with the exact same size of all the flags, which allows you to get exact positions.



Available countries

pawn Код:
#define FLAG_TYPE_GERMANY           0
#define FLAG_TYPE_NETHERLANDS       1
#define FLAG_TYPE_RUSSIA            2
#define FLAG_TYPE_AUSTRIA           3
#define FLAG_TYPE_BULGARIA          4
#define FLAG_TYPE_LITHUANIA         5  
#define FLAG_TYPE_ESTONIA           6
#define FLAG_TYPE_LUXEMBOURG        7
#define FLAG_TYPE_HUNGARY           8
#define FLAG_TYPE_ARMENIA           9
#define FLAG_TYPE_POLAND            10
#define FLAG_TYPE_CZECH_REPUBLIC    11
#define FLAG_TYPE_UKRAINE           12
#define FLAG_TYPE_ITALY             13
#define FLAG_TYPE_FRANCE            14
#define FLAG_TYPE_IRELAND           15
#define FLAG_TYPE_ROMANIA           16
#define FLAG_TYPE_BELGIUM           17
#define FLAG_TYPE_SWEDEN            18
#define FLAG_TYPE_FINLAND           19
#define FLAG_TYPE_DENMARK           20
#define FLAG_TYPE_NORWAY            21
#define FLAG_TYPE_ICELAND           22
#define FLAG_TYPE_SPAIN             23
#define FLAG_TYPE_USA               24
#define FLAG_TYPE_SWITZERLAND       25
#define FLAG_TYPE_ENGLAND           26
#define FLAG_TYPE_CANADA            27
#define FLAG_TYPE_BRAZIL            28
#define FLAG_TYPE_TURKEY            29
#define FLAG_TYPE_JAPAN             30
#define FLAG_TYPE_CHINA             31
#define FLAG_TYPE_ARGENTINIA        32
#define FLAG_TYPE_PORTUGAL          33


Download

Solidfiles
Pastebin



Notes

Due to the textdraw limitations it was not possible for me to create the flag of the United Kingdom. Therefore I created the flag of England instead. Thereby this include also doesn't contain the flags of Australia and New Zealand.
If you find a way to create the flag of the UK, feel free to send me a PM.


Re: Textdraw Flags - Over 30 country flags - MP2 - 09.07.2012

Why do you have a separate function for EVERY SINGLE FLAG..?

Also, no Union Jack? :/




Re: Textdraw Flags - Over 30 country flags - James Coral - 09.07.2012

can you make Estonia flag to?:

BLUE
BLACK
WHITE


Re: Textdraw Flags - Over 30 country flags - Drebin - 09.07.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Also, no Union Jack? :/
No because I found no way to create the diagonals. If you found a way feel free to tell me.


Quote:
Originally Posted by James Coral
Посмотреть сообщение
can you make Estonia flag to?:

BLUE
BLACK
WHITE
Already included.


Re: Textdraw Flags - Over 30 country flags - Toreno - 09.07.2012

You finally (was pretty quick lol) released it! W-O-W!
Good job, man... good job!

Oh come on, where is the Israel flag?


Re: Textdraw Flags - Over 30 country flags - MartinHavo - 09.07.2012

Can you make Slovakia flage? Thanks!
I know its's hardcore but there's a lot of scripters from Slovakia and they will be happy!



Sorry bro for my English


Re: Textdraw Flags - Over 30 country flags - raider19rus - 09.07.2012

Very nice !


Re : Textdraw Flags - Over 30 country flags - Vukilore - 09.07.2012

A-A-A-A-A-A-AWESOME !
Gonna use it, thanks


Re: Textdraw Flags - Over 30 country flags - TheBetaFox - 09.07.2012

You know, this would work quite well on a multilangual server - it would make for a much more awesome language choice menu.


Re: Textdraw Flags - Over 30 country flags - Neil. - 09.07.2012

Quote:
Originally Posted by TheBetaFox
Посмотреть сообщение
You know, this would work quite well on a multilangual server - it would make for a much more awesome language choice menu.
True..

OT: Awesome work, this would really work best with a multilang server... Especially when you are given the choice to choose which language using td's!


Re: Textdraw Flags - Over 30 country flags - Dark Sniper - 06.11.2012

can you make Korea flage?

please




Re: Textdraw Flags - Over 30 country flags - davve95 - 06.11.2012

Nice!, good job.


Re: Textdraw Flags - Over 30 country flags - gaLB - 18.11.2012

What about Israel Flag ?


Re: Textdraw Flags - Over 30 country flags - jpeg - 18.11.2012

Very Good.


Re: Textdraw Flags - Over 30 country flags - Plovix - 18.11.2012

Very nice job,can you add Croatian flag?


Respuesta: Textdraw Flags - Over 30 country flags - Juan_Viz - 18.11.2012

Colombia
. XD


Re: Textdraw Flags - Over 30 country flags - Gomuk - 20.04.2013

DreBin, can you please include India's flag?

Orange
White
Green


(IF you know what I mean)


Re: Textdraw Flags - Over 30 country flags - CreativityLacker - 21.04.2013

Can you please tell me how many TEXTDRAW's (not flags) does this include use in total?


Re: Textdraw Flags - Over 30 country flags - Edvin - 21.04.2013

Hehe, very nice idea man


Re: Textdraw Flags - Over 30 country flags - absolute - 23.04.2013

wish there were iran's flag included without that sign in the center in your include ^^that would be great :P