help with setplayercolor();
#1

here is my code to set the org colour:

Код:
CMD:ocolour(playerid, params[])
{
	new id,colour[64], query[128];
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "You cannot use this command.");
 	if(sscanf(params,"is",id,colour)) return SendClientMessage(playerid, red, "USAGE:/ocolour [id] [colour]");
 	format(query, sizeof(query), "UPDATE orgs SET Colour='%s' WHERE ID=%d",colour,id);
 	mysql_query(query);
 	return 1;
}
to set colour:

Код:
CMD:oskin(playerid, params[])
{
	SetPlayerColor(playerid, ocolour[playerid]);
	SetPlayerSkin(playerid, oskin[playerid] & oskin1[playerid] & oskin2[playerid]);
	return 1;
}
loading part:

Код:
LoadOstats(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	new query[128];
	format(query, sizeof(query), "SELECT * FROM ostats WHERE name='%s'", name);
	mysql_query(query);
	mysql_store_result();
	
	new row[128];
	new field[13][32];

	mysql_fetch_row_format(row, "|");
	explode(row, field, "|");

	org[playerid] =strval(field[1]);
	leader[playerid]=strval(field[3]);
	req[playerid]=strval(field[2]);
	
	mysql_free_result();
	
	new string[128];
	format(string, sizeof(string), "SELECT * FROM orgs WHERE ID=%d", org[playerid]);
	mysql_query(string);
	mysql_store_result();
	mysql_fetch_row_format(row, "|");
	explode(row, field, "|");
	format(oname[playerid], 32, "%s", field[1]);
	format(ocolour[playerid], 32, "%s", field[2]);
	otype[playerid]=strval(field[3]);
	oskin[playerid]=strval(field[4]);
	oskin1[playerid]=strval(field[5]);
	oskin2[playerid]=strval(field[6]);
	mysql_free_result();
	return 1;
}
the thing is the hex code gets stored in my sql and it loads with 0xcode but when i use setplayercolor it sets the colour to black. help please
Reply
#2

When will people finally understand that colors are just numbers and not strings ...
Reply
#3

but i want it to show colours. its stored in hex format(0xformat) but it wont show the colour. if i use int format i cant add the 0x
Reply
#4

bump
Reply
#5

I don't exactly get what your asking. Did you define ocolor? What color do you want it?
Reply
#6

pawn Код:
new id, colour, query[128];
if(sscanf(params,"ix",id,colour)) return SendClientMessage(playerid, red, "USAGE:/ocolour [id] [colour]");
format(query, sizeof(query), "UPDATE orgs SET Colour='%d' WHERE ID=%d",colour,id);
pawn Код:
ocolour[playerid]=strval(field[2]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)