SA-MP Forums Archive
help with setplayercolor(); - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with setplayercolor(); (/showthread.php?tid=221412)



help with setplayercolor(); - THE_KNOWN - 05.02.2011

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


Re: help with setplayercolor(); - Vince - 05.02.2011

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


Re: help with setplayercolor(); - THE_KNOWN - 05.02.2011

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


Re: help with setplayercolor(); - THE_KNOWN - 05.02.2011

bump


Re: help with setplayercolor(); - Zack9764 - 05.02.2011

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


Re: help with setplayercolor(); - MadeMan - 05.02.2011

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]);