enum PLAYER_DATA
{
donorlevel,
color[6],
chatcolor[6],
}
new pinfo[MAX_PLAYERS][PLAYER_DATA];
public OnPlayerText(playerid, text[])
{
switch(pinfo[playerid][donorlevel])
{
case 5:
{
new str[256];
if(pinfo[playerid][usingnick] == 1)
{
format(str,sizeof(str),"{%x}%s (%d): {%x}%s",pinfo[playerid][color],pinfo[playerid][nickname],playerid,pinfo[playerid][chatcolor],playerid,text);
SendClientMessageToAll(-1,str);
}
else
{
format(str,sizeof(str),"{%x}%s (%d): {%x}%s",pinfo[playerid][color],pinfo[playerid][name],playerid,pinfo[playerid][chatcolor],playerid,text);
SendClientMessageToAll(-1,str);
}
}
}
return 0;
}
CMD:changecolor(playerid,params[])
{
new plcolor[50];
if(pinfo[playerid][donorlevel] < 1) return 0;
else if(pinfo[playerid][donorlevel] < 5) return SendClientMessage(playerid,COLOR_RED,"ERROR: Only donors level 5 have access to this command.");
if(sscanf(params, "s",plcolor)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /changecolor [color]");
if(!strcmp(plcolor,"red"))
{
pinfo[playerid][color] = "ff0000"; //line 466
pinfo[playerid][chatcolor] = "ff4c4c"; //line 467
}
if(!strcmp(plcolor,"blue"))
{
pinfo[playerid][color] = "00ffff"; //line 471
pinfo[playerid][chatcolor] = "66ffff"; //line 472
}
if(!strcmp(plcolor,"yellow"))
{
pinfo[playerid][color] = "FFFF00"; //line 476
pinfo[playerid][chatcolor] = "ffff66"; //line 477
}
if(!strcmp(plcolor,"black"))
{
pinfo[playerid][color] = "1e1e1e"; //line 481
pinfo[playerid][chatcolor] = "616161"; //line 482
}
return 1;
}
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(466) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(467) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(471) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(472) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(476) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(477) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(481) : error 047: array sizes do not match, or destination array is too small C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(482) : error 047: array sizes do not match, or destination array is too small
#define RED ff0000
CMD:changecolor(playerid,params[])
{
new plcolor[50];
if(pinfo[playerid][donorlevel] < 1) return 0;
else if(pinfo[playerid][donorlevel] < 5) return SendClientMessage(playerid,COLOR_RED,"ERROR: Only donors level 5 have access to this command.");
if(sscanf(params, "s",plcolor)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /changecolor [color]");
if(!strcmp(plcolor,"red"))
{
pinfo[playerid][color] = RED; //line 467
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(467) : error 017: undefined symbol "ff0000"
C:\Users\Abderrahmene\Desktop\0.3.7\gamemodes\testserver1.pwn(467) : error 017: undefined symbol "ff0000"
pinfo[playerid][color] = RED;
#define RED 1
#define YELLOW 2
#define GREEN 3
CMD:changecolor(playerid,params[])
{
new plcolor[256],path[256];
if(pinfo[playerid][donorlevel] < 1) return 0;
else if(pinfo[playerid][donorlevel] < 5) return SendClientMessage(playerid,COLOR_RED,"ERROR: Only donors level 5 have access to this command.");
if(sscanf(params, "s",plcolor)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /changecolor [color]");
format(path,sizeof(path),"users/%s.ini",pinfo[playerid][name]);
pinfo[playerid][color] = plcolor;
dini_Set(path,"Donor color",plcolor);
return 1;
}
public OnPlayerText(playerid, text[])
{
switch(pinfo[playerid][donorlevel])
{
case 5:
{
if(strcmp(pinfo[playerid][color],"green") && strcmp(pinfo[playerid][color],"pink") && strcmp(pinfo[playerid][color],"orange") && strcmp(pinfo[playerid][color],"purple") && strcmp(pinfo[playerid][color],"yellow") && strcmp(pinfo[playerid][color],"blue") && strcmp(pinfo[playerid][color],"black") && strcmp(pinfo[playerid][color],"red"))
{
SendClientMessage(playerid,COLOR_RED,"ERROR: something wrong occured while trying to send this message. Please check the color you chose. use /changecolor");
return 0;
}
else if(!strcmp(pinfo[playerid][color],"red"))
{
new str[256];
if(pinfo[playerid][usingnick] == 1)
{
format(str,sizeof(str),"{ff0000}%s (%d): {ff4c4c}%s",pinfo[playerid][nickname],playerid,text);
SendClientMessageToAll(-1,str);
}
else
{
format(str,sizeof(str),"{ff0000}%s (%d): {ff4c4c}%s",pinfo[playerid][name],playerid,text);
SendClientMessageToAll(-1,str);
}
}
And use case on pinfo[playerid][color] checking for the color, and formatting in that result where it's checked on the area you're formatting the text and displaying it. |