19.03.2010, 19:16
How do you change a players icon color on the mini map?
SetPlayerColor(playerid, 0xFFFF00AA);
#include <a_samp>
#define dcmd(%1,%2,%3) if((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
enum pcolor_data
{
pcolor_name[16],
pcolor_hex
}
new pColors[][pcolor_data] = {
{"red", 0xFF0000FF},
{"green", 0x00FF00FF},
{"blue", 0x0000FFFF}
};
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(color, 5, cmdtext);
return 0;
}
dcmd_color(playerid, params[])
{
for(new i=0; i<sizeof(pColors); i++)
{
if(!strcmp(params, pColors[i][pcolor_name], true))
{
SetPlayerColor(playerid, pColors[i][pcolor_hex]);
new string[128];
format(string, sizeof(string), "Color set to '%s'.", pColors[i][pcolor_name]);
SendClientMessage(playerid, pColors[i][pcolor_hex], string);
return 1;
}
}
SendClientMessage(playerid, 0xFF0000FF, "VALID COLORS: red green blue");
return 1;
}