21.04.2013, 04:47
Alrighty, I'm in the need of some help. I know there must be an easier way to have this code. I have ZCMD and YCMD if that's a better way to shorten it.
You can see how every (what should be) sub-command is it's own command, and must be typed exactly like that for it to work. So, uh, any help?
(I'm still a beginner, so go easy? D: )
pawn Код:
#define COLOR_BLUE 0x0000FFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_PURPLE 0x9900FFAA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIME 0x99FF00AA
#define COLOR_RED 0xEB000FFF
#define COLOR_WHITE 0xFFFFD5FF
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Name Colour Script by CrystalMethod");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Name Colour Script by CrystalMethod");
print("----------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/nc", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Change the colour of your name by doing /nc [desired colour]")
;
SendClientMessage(playerid, COLOR_WHITE, "List of colours:")
;
SendClientMessage(playerid, COLOR_BLUE, "Blue")
;
SendClientMessage(playerid, COLOR_GREY, "Grey")
;
SendClientMessage(playerid, COLOR_GREEN, "Green")
;
SendClientMessage(playerid, COLOR_PURPLE, "Purple")
;
SendClientMessage(playerid, COLOR_CYAN, "Cyan")
;
SendClientMessage(playerid, COLOR_PINK, "Pink")
;
SendClientMessage(playerid, COLOR_LIME, "Lime")
;
SendClientMessage(playerid, COLOR_RED, "Red")
;
}
if (strcmp("/nc blue", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_BLUE)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc grey", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_GREY)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc green", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_GREEN)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc purple", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_PURPLE)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc cyan", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_CYAN)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc pink", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_PINK)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc lime", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_LIME)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
if (strcmp("/nc red", cmdtext, true, 10) == 0)
{
SetPlayerColor(playerid, COLOR_RED)
;
SendClientMessage(playerid, COLOR_WHITE, "Name colour changed!")
;
}
return 1;
}
(I'm still a beginner, so go easy? D: )