Szerző Téma: Hexa szín cserélõ  (Megtekintve 839 alkalommal)

Hexa szín cserélõ
« Dátum: 2012. július 23. - 20:16:25 »
0 Show voters
Sziasztok,hogyan lehet hexa szín cserélõt csinálni?
Pl: /titulus [színkód (Pl: FF0000]
és majd ha ír a chatbe akkor olyan színû lesz a titulusa...
Remélem érthetõ :DDD

Nem elérhető kurta999

  • 2759
  • Éllő fédisznó
    • Profil megtekintése
Hexa szín cserélõ
« Válasz #1 Dátum: 2012. július 24. - 01:47:06 »
0 Show voters
CMD:tituls(playerid, params[])
{
    g_pTitulsColor[playerid] = strval(params);  // Alfával eggyütt kell magadni. (0xFF0000AA)
    return 1;
}
Azátn pedig így tudod ezt színné alakítani.
{%06x} <- ezt a format-ba.
és bele értéket pedig: g_pTitulsColor[playerid] >>> 8 // Itt dobjuk le az alfát, bár meglehet úgyis, hogy ott ledobod, ahol beírja és akkor már nemkell itt.

Hexa szín cserélõ
« Válasz #2 Dátum: 2012. július 24. - 11:01:50 »
0 Show voters
Valahogy így?
 
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new Rank[ MAX_PLAYERS ][ 64 + 1 ];
new RankColor[MAX_PLAYERS][64 + 1];
CMD:setrank(playerid, params[])
{
new Titulus[64 + 1];
new string[250];
if(sscanf(params, \"s[64]\", Titulus)) return SendClientMessage(playerid, -1, \"{DDDDDD}>> Használat: {005c99}/setrank [Új titulus]\");
if(strlen(Titulus) > 64) return 1;
format(Rank[playerid], (64), \" <%s>\", Titulus);
format(string,sizeof(string),\"{DDDDDD}>> AccServ: {005c99}Rank megváltoztatva! Rank: %s\",Titulus);
SendClientMessage(playerid, 0xFFFFFFAA, string);
return 1;
}
CMD:setrankcolor(playerid, params[])
{
new Color[64 + 1];
new string[250];
if(sscanf(params, \"%06x\", Color)) return SendClientMessage(playerid, -1, \"{DDDDDD}>> Használat: {005c99}/setrankcolor [színkód (Például: 0xFFFFAA)]\");
if(strlen(Color) > 64) return 1;
format(RankColor[playerid], (64), \" {%s}\", Color);
format(string,sizeof(string),\"{DDDDDD}>> AccServ: {005c99}Rang színed beállítva!! Színkód: %s\",Color);
SendClientMessage(playerid, 0xFFFFFFAA, string);
return 1;
}
public OnPlayerText(playerid, text[])
{
        new g_szString[250 + 1];
        format(g_szString,(250),\"%s %s%s{DDDDDD}(%d): {FFFFFF}%s\", playerName(playerid), RankColor[playerid], Rank[playerid], playerid, text);
SendClientMessageToAll(-1, g_szString);
        return 0;
}
stock playerName( playerid ) {
        new plaName[ 24 + 1 ];
        GetPlayerName( playerid, plaName, (24) );
        return plaName;
}
« Utoljára szerkesztve: 2012. július 25. - 11:25:21 írta Yakuza™ »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal