SA-MP Forums Archive
Need a SaveColor for this. - 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)
+--- Thread: Need a SaveColor for this. (/showthread.php?tid=609935)



Need a SaveColor for this. - VZMatt - 18.06.2016

Hi,

I have a RGB colour system, I want a savecolor for it, it means: When a player types /setmycolor 255 255 255 it will save the color for each spawn or each time that player joins.

Here the code.
Quote:

public OnPlayerConnect(playerid)
cForced[playerid] = 0;
return 1;

dcmd_setmycolor(playerid,params[]) //
{
if(cForced[playerid] == 0)
{
static R, G, B;
if (sscanf(params, "iii", R,G,B)) return SendClientMessage(playerid, 0xff0000aa, "*USAGE: /setmycolor <0-255> <0-255> <0-255>");
SendClientMessage(playerid,(R * 16777216) + (G * 65536) + (B*256), "Your color has been changed!");
SetPlayerColor(playerid, (R * 16777216) + (G * 65536) + (B*256));
}
else return SendClientMessage(playerid, 0xff0000aa, "*You aren't allowed to use this command!");
return 1;
}
Can you help me, guys?

Thanks for reading guys ^^


Respuesta: Need a SaveColor for this. - VZMatt - 18.06.2016

bump!


Re: Need a SaveColor for this. - Konstantinos - 18.06.2016

Save the color (what GetPlayerColor returns*) as integer.

* If SetPlayerColor was not used at all, GetPlayerColor would return 0. Look at sa-mp wiki for a fix.