28.09.2012, 21:12
How can i scripting this, that Players can make /headtext with different Colors we Blue, Yellow, Green, White, Red, Cyan?
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new Text3D:MyLabel[MAX_PLAYERS];
stock AttachHeadColor(playerid, color, text[])
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
MyLabel[playerid] = Create3DTextLabel(text, color, x, y, z + 1.0, 10.0, 0);
Attach3DTextLabelToPlayer(MyLabel[playerid], playerid, 0.0, 0.0, 1.0);
return 1;
}
CMD:headtext(playerid, params[])
{
new color[12], text[128];
if (sscanf(params, "s[12]s[128]", color, text))
{
SendClientMessage(playerid, 0xAFAFAFFF, "USAGE: /headtext [color] [text]");
return 1;
}
if (strcmp(color, "blue", true) == 0) AttachHeadColor(playerid, 0x0000FFFF, text);
if (strcmp(color, "yellow", true) == 0) AttachHeadColor(playerid, 0xFFFF00FF, text);
if (strcmp(color, "green", true) == 0) AttachHeadColor(playerid, 0x00FF00FF, text);
if (strcmp(color, "white", true) == 0) AttachHeadColor(playerid, 0xFFFFFFFF, text);
if (strcmp(color, "red", true) == 0) AttachHeadColor(playerid, 0xFF0000FF, text);
if (strcmp(color, "cyan", true) == 0) AttachHeadColor(playerid, 0x33CCFFFF, text);
SendClientMessage(playerid, 0xFFFF00FF, "Text attached to head (type /removetext to remove it).");
return 1;
}
CMD:removetext(playerid, params[])
{
Delete3DTextLabel(MyLabel[playerid]);
SendClientMessage(playerid, 0xFFFF00FF, "Text removed.");
return 1;
}