SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 09/07/2012, 08:10 AM   #1
Drebin
High-roller
 
Drebin's Avatar
 
Join Date: Oct 2010
Location: Germany
Posts: 1,101
Reputation: 560
Default Textdraw Flags - Over 30 country flags

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 Code:
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 Code:
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 Code:
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 Code:
#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.
__________________


GamerX - The SA-MP legend.
Online since 2006.

188.165.219.63:8800
www.gamerxserver.com

Last edited by Drebin; 07/09/2013 at 01:48 AM.
Drebin is offline   Reply With Quote
Old 09/07/2012, 08:55 AM   #2
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,219
Reputation: 976
Default Re: Textdraw Flags - Over 30 country flags

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

Also, no Union Jack? :/

__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 09/07/2012, 09:01 AM   #3
James Coral
Gangsta
 
James Coral's Avatar
 
Join Date: Sep 2011
Location: In San Fierro
Posts: 533
Reputation: 4
Default Re: Textdraw Flags - Over 30 country flags

can you make Estonia flag to?:

BLUE
BLACK
WHITE
__________________
4System Gaming Community Is Back!
James Coral is offline   Reply With Quote
Old 09/07/2012, 09:03 AM   #4
Drebin
High-roller
 
Drebin's Avatar
 
Join Date: Oct 2010
Location: Germany
Posts: 1,101
Reputation: 560
Default Re: Textdraw Flags - Over 30 country flags

Quote:
Originally Posted by MP2 View Post
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 View Post
can you make Estonia flag to?:

BLUE
BLACK
WHITE
Already included.
__________________


GamerX - The SA-MP legend.
Online since 2006.

188.165.219.63:8800
www.gamerxserver.com
Drebin is offline   Reply With Quote
Old 09/07/2012, 09:23 AM   #5
Toreno
Gangsta
 
Join Date: Nov 2010
Posts: 725
Reputation: 41
Default Re: Textdraw Flags - Over 30 country flags

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

Oh come on, where is the Israel flag?
Toreno is offline   Reply With Quote
Old 09/07/2012, 09:25 AM   #6
MartinHavo
Little Clucker
 
Join Date: Jul 2011
Posts: 1
Reputation: 0
Default Re: Textdraw Flags - Over 30 country flags

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
MartinHavo is offline   Reply With Quote
Old 09/07/2012, 09:59 AM   #7
raider19rus
Big Clucker
 
Join Date: Apr 2012
Posts: 187
Reputation: 22
Default Re: Textdraw Flags - Over 30 country flags

Very nice !
raider19rus is offline   Reply With Quote
Old 09/07/2012, 10:06 AM   #8
Vukilore
Huge Clucker
 
Vukilore's Avatar
 
Join Date: Jan 2011
Location: http://forum.sa-mp-fr.com/index.php
Posts: 300
Reputation: 110
Default Re : Textdraw Flags - Over 30 country flags

A-A-A-A-A-A-AWESOME !
Gonna use it, thanks
__________________
http://forum.sa-mp-fr.com/index.php. << here rest the french forum, in piece.
Vukilore is offline   Reply With Quote
Old 09/07/2012, 10:10 AM   #9
TheBetaFox
Huge Clucker
 
TheBetaFox's Avatar
 
Join Date: Jan 2011
Location: Nowhere.
Posts: 245
Reputation: 92
Default Re: Textdraw Flags - Over 30 country flags

You know, this would work quite well on a multilangual server - it would make for a much more awesome language choice menu.
__________________
Looking to work on something.
Send me a PM if you wish to talk to me privately,
as I will not respond to visitor messages.
TheBetaFox is offline   Reply With Quote
Old 09/07/2012, 10:14 AM   #10
Neil.
Gangsta
 
Neil.'s Avatar
 
Join Date: Mar 2012
Posts: 531
Reputation: 30
Default Re: Textdraw Flags - Over 30 country flags

Quote:
Originally Posted by TheBetaFox View Post
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!
__________________
Apparently, I'm turning caffeine into code in the morning.
Neil. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server flags such as -ip -port -maxplayers gamecp Server Support 7 24/12/2011 12:38 PM
Country BetaLaxx Scripting Help 9 16/12/2011 11:19 AM
Flags Mustang GT Scripting Help 1 28/08/2011 06:03 AM
[FilterScript] [FS] Short and simple teleport dialog from country to country bartje01 Filterscripts 2 18/03/2010 01:31 PM


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.