26.05.2018, 03:59
I actually fixed it where I just made it the opposite, this is how I fixed it:
command:
OnPlayerText:
Even though this is a little bit lazy work, I can still put the colors in a dialog and there wouldn't be any error occuring for false color.
However, thank you for your help, Sew_Sumi. I kind of reformed what you suggested
command:
PHP код:
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;
}
PHP код:
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);
}
}
However, thank you for your help, Sew_Sumi. I kind of reformed what you suggested
Quote:
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. |