Color Embedding FR
From SA-MP Wiki
(Difference between revisions)
Revision as of 03:33, 5 January 2013 Connor Mead (Talk | contribs) ← Previous diff |
Revision as of 22:32, 1 February 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
- | {{Merge|Colors List}} | + | 'intégration des couleurs a été introduise dans SA:MP 0.3c. Elle permettait alors de pouvoir mettre plusieurs couleurs différentes en un seul message. Le format <tt>{<span style="color:red;">RR</span><span style="color:green;">VV</span><span style="color:blue;">BB</span>}</tt>, est similaire aux couleurs ordinaire de l'hexadecimal, mais il n'a pas de valeurs de transparences. Vous pouvez utiliser le [http://www.colorpicker.com color picker] pour trouver facilement vos couleurs. |
- | + | ||
- | L'intégration des couleurs a été introduise dans SA:MP 0.3c. Elle permettait alors de pouvoir mettre plusieurs couleurs différentes en un seul message. Le format <tt>{<span style="color:red;">RR</span><span style="color:green;">VV</span><span style="color:blue;">BB</span>}</tt>, est similaire aux couleurs ordinaire de l'hexadecimal, mais il n'a pas de valeurs de transparences. Vous pouvez utiliser le [http://www.colorpicker.com color picker] pour trouver facilement vos couleurs. | + | |
Line 8: | Line 6: | ||
Color embedding is currently supported in: | Color embedding is currently supported in: | ||
- | * [[SendClientMessage|Client Messages]] | + | * [[SendClientMessage_FR|SendClientMessage]] |
- | * [[ShowPlayerDialog|Dialogs]] | + | * [[ShowPlayerDialog_FR|ShowPlayerDialog]] |
- | * [[Create3DTextLabel|3D Text Labels]] | + | * [[Create3DTextLabel_FR|Create3DTextLabel]] |
- | * [[SetVehicleNumberPlate|Number Plates]] | + | * [[SetVehicleNumberPlate_FR|SetVehicleNumberPlate]] |
- | * [[SetObjectMaterialText]] | + | * [[SetObjectMaterialText_FR|SetObjectMaterialText]] |
- | == Examples == | + | == Exemples == |
<pawn> | <pawn> | ||
- | SendClientMessage(playerid, -1, "Hello, and welcome to {00FF00}ASDASDFASFAS{FFFFFF}!"); | + | SendClientMessage(playerid, -1, "Bonjour, NOMDUSUJET, vous devez faire la fierté de, {00FF00}SERVEURDUSUJET{FFFFFF}!"); |
</pawn> | </pawn> | ||
- | 'ASDASDFASFAS' will be green (00FF00) and the rest white (-1 and FFFFFF). | + | 'SERVEURDUSUJET' sera affiché en vert (00FF00) et le reste en blanc (-1 et FFFFFF). |
- | Another example: | + | Autre exemple: |
<pawn> | <pawn> | ||
- | SendClientMessage(playerid, -1, "Welcome to {00FF00}M{FFFFFF}a{FF0000}r{FFFFFF}c{00FF00}o{FFFFFF}'{FF0000}s\ | + | SendClientMessage(playerid, -1, "Bienvenue au {00FF00}M{FFFFFF}a{FF0000}r{FFFFFF}c{00FF00}o{FFFFFF}'{FF0000}s\ |
{FFFFFF}B{00FF00}i{FFFFFF}s{FF0000}t{FFFFFF}r{00FF00}o{FFFFFF}!"); | {FFFFFF}B{00FF00}i{FFFFFF}s{FF0000}t{FFFFFF}r{00FF00}o{FFFFFF}!"); | ||
</pawn> | </pawn> | ||
- | Turns into | + | Affichera |
[[Image:cembed.png]] | [[Image:cembed.png]] | ||
- | You can also define colours on top of your script and then use them inside messages: | + | Vous pouvez aussi définir les couleurs pour les utiliser plus facilement dans les messages |
<pawn> | <pawn> | ||
Line 39: | Line 37: | ||
- | SendClientMessage(playerid, -1, "This is white"RED_EMBED" and this is red."); | + | SendClientMessage(playerid, -1, "C'est blanc"RED_EMBED" et c'est rouge."); |
</pawn> | </pawn> | ||
- | A similar system can be used with [[TextDrawCreate|textdraws]]. | + | Un système similaire peut être utilisé avec [[TextDrawCreate_FR|TextDrawCreate]]. |
- | == Using GetPlayerColor== | + | == En utilisant GetPlayerColor== |
- | To use a player's color as an embedded color, you must first remove the alpha value. To do this, perform a logical right shift. | + | |
<pawn> | <pawn> | ||
new msg[128]; | new msg[128]; | ||
- | format(msg, sizeof(msg), "{ffffff}This is white and {%06x}this is the player's color!", GetPlayerColor(playerid) >>> 8); | + | format(msg, sizeof(msg), "{ffffff}C'est blanc et {%06x}c'est la couleur du joueur!", GetPlayerColor(playerid) >>> 8); |
SendClientMessage(playerid, 0xffffffff, msg); | SendClientMessage(playerid, 0xffffffff, msg); | ||
</pawn> | </pawn> | ||
- | The %x is the placeholder for hexadecimal values, the 6 ensures that the output string will always be six characters long and the 0 will pad it with zeros if it's not. Note that [[GetPlayerColor]] only works properly if [[SetPlayerColor]] has been used beforehand. | + | %x est utilisé pour la valeur héxadécimal, 6 pour ne prendre que les six premiers caractères. |
- | + | ||
- | == See Also == | + |
Revision as of 22:32, 1 February 2014
'intégration des couleurs a été introduise dans SA:MP 0.3c. Elle permettait alors de pouvoir mettre plusieurs couleurs différentes en un seul message. Le format {RRVVBB}, est similaire aux couleurs ordinaire de l'hexadecimal, mais il n'a pas de valeurs de transparences. Vous pouvez utiliser le color picker pour trouver facilement vos couleurs.
Contents |
Color embedding is currently supported in:
Exemples
SendClientMessage(playerid, -1, "Bonjour, NOMDUSUJET, vous devez faire la fierté de, {00FF00}SERVEURDUSUJET{FFFFFF}!");
'SERVEURDUSUJET' sera affiché en vert (00FF00) et le reste en blanc (-1 et FFFFFF).
Autre exemple:
SendClientMessage(playerid, -1, "Bienvenue au {00FF00}M{FFFFFF}a{FF0000}r{FFFFFF}c{00FF00}o{FFFFFF}'{FF0000}s\ {FFFFFF}B{00FF00}i{FFFFFF}s{FF0000}t{FFFFFF}r{00FF00}o{FFFFFF}!");
Vous pouvez aussi définir les couleurs pour les utiliser plus facilement dans les messages
#define RED_EMBED "{FF0000}" SendClientMessage(playerid, -1, "C'est blanc"RED_EMBED" et c'est rouge.");
Un système similaire peut être utilisé avec TextDrawCreate.
En utilisant GetPlayerColor
new msg[128]; format(msg, sizeof(msg), "{ffffff}C'est blanc et {%06x}c'est la couleur du joueur!", GetPlayerColor(playerid) >>> 8); SendClientMessage(playerid, 0xffffffff, msg);
%x est utilisé pour la valeur héxadécimal, 6 pour ne prendre que les six premiers caractères.