[ HELP ] Bandana System Bug
#1

Hello, I've got a script of Bandana System which is made by someone but they got credits for me. Well there is a bug in this script, If i do /setgangcolor <FamilyID> <Hex> , It works.. But when i'm going to use the (/bandana) Command, It gives a Black Color to my name, and not the Color i set for it. Can anybody help me with this bug?


Heres the line :
Код:
CMD:setgangcolor(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4)
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 4)
	    {
	        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
	    }
		new string[128], family, color[32];
		if(sscanf(params, "is", family, color))
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /Setgangcolor [Familyid] [Hex Color]");
			return 1;
		}
		if(family < 0 || family > 14) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Gang ID.");

		if(FamilyInfo[family][FamilyTaken] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "   That gang isn't being used.");
			return 1;
		}
	    format(FamilyInfo[family][FamilyBandana], sizeof(color), color);
		format(string, sizeof(string), "AdmCmd: %s has set gang ID %d's bandana to '%s'.", GetPlayerNameEx(playerid), family, color);
		ABroadCast(COLOR_LIGHTRED, string, 1);
	}
	return 1;
}


CMD:bandana(playerid, params[])
{
	new string[128], gangcolor;
	if(PlayerInfo[playerid][pGang] == 255) return SendClientMessageEx(playerid, COLOR_WHITE, "Your not in a gang.");
	if(FamilyInfo[PlayerInfo[playerid][pGang]][FamilyBandana] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "Your gang does not have a bandana set.");
	gangcolor = strval(FamilyInfo[PlayerInfo[playerid][pGang]][FamilyBandana]);
	if(PlayerInfo[playerid][pBandana] != 1)
	{
		SetPlayerColor(playerid, gangcolor);
 		PlayerInfo[playerid][pBandana] = 1;
 	}
 	else
 	{
 	    SetPlayerColor(playerid, TEAM_HIT_COLOR);
 	    PlayerInfo[playerid][pBandana] = 0;
 	}
	return 1;
}

Hope you can help me!
Reply
#2

The main reason you are getting black color on name is because strval returning 0 and gangcolor is 0 then.
If you are storing integer in FamilyInfo[][FamilyBandana] you dont need to use strval.
If you are storing string in FamilyInfo[][FamilyBandana] and its format is: "0xRRGGBBFF" you should use HextoInt (link: https://sampwiki.blast.hk/wiki/Colors_List)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)