09.07.2012, 08:10
(
Последний раз редактировалось Drebin; 07.09.2013 в 01:48.
)
Textdraw Country Flags
OverviewThis 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);
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;
}
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);
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.