Question - 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: Question (
/showthread.php?tid=585982)
RGB Colors Help +rep -
anassmaroc - 18.08.2015
Hi all. i Have a Question How to make a Command for RGB Colors Like /mycolor [R] [G] [B].
IF i Quit the Server and Come back again the RGB Color stay and to remove it /resetcolor to back the Normal color
Please Help iwill +rep
Re: Question -
LetsOWN[PL] - 18.08.2015
Quote:
Originally Posted by anassmaroc
Hi all. i Have a Question How to make a Command for RGB Colors Like /mycolor [R] [G] [B].
IF i Quit the Server and Come back again the RGB Color stay and to remove it /resetcolor to back the Normal color
Please Help iwill +rep
|
Hello.
You've to store player's color when they leave in some external place (e.g. file or in database) and then load it up when player connects. That's pretty much it.
And about /mycolor ® (g) (b). It's pretty easy to do:
pawn Код:
COMMAND:mycolor( playerid, params[] ){
new
Red, Green, Blue ;
if( sscanf(params, "ddd", Red, Green, Blue) ) {
SendClientMessage( playerid, -1, "Use: /mycolor R G B");
return 1;
}
if( ( Red >= 0 && Green >= 0 && Blue >= 0 ) && ( Red <= 255 && Green <= 255 && Blue <= 255 ) ) {
new mixedColor = 0;
mixedColor = (Red << 24) + (Green << 16) + (Blue << 8) + 255;
SetPlayerColor( playerid, mixedColor );
SendClientMessage( playerid, -1, "Done!");
return 1;
} else {
SendClientMessage( playerid, -1, "Error: one or more channels are out of bounds (0<>255)");
return 1;
}
}
Greetings.
Re : Re: Question -
anassmaroc - 18.08.2015
Quote:
Originally Posted by LetsOWN[PL]
Hello.
You've to store player's color when they leave in some external place (e.g. file or in database) and then load it up when player connects. That's pretty much it.
And about /mycolor ® (g) (b). It's pretty easy to do:
pawn Код:
COMMAND:mycolor( playerid, params[] ){ new Red, Green, Blue ; if( sscanf(params, "ddd", Red, Green, Blue) ) { SendClientMessage( playerid, -1, "Use: /mycolor R G B"); return 1; } if( ( Red >= 0 && Green >= 0 && Blue >= 0 ) && ( Red <= 255 && Green <= 255 && Blue <= 255 ) ) { new mixedColor = 0; mixedColor = (Red << 24) + (Green << 16) + (Blue << 8) + 255; SetPlayerColor( playerid, mixedColor ); SendClientMessage( playerid, -1, "Done!"); return 1; } else { SendClientMessage( playerid, -1, "Error: one or more channels are out of bounds (0<>255)"); return 1; } }
Greetings.
|
Yes But How to make it Stay must If i left the Server and re - back it will Stay and if iwant remove RGB color must DO CMD reset Color
Re : Question -
anassmaroc - 18.08.2015
Help
Re: Question -
ZToPMaN - 18.08.2015
Are you using mysql, dini or YSI\y_ini?
Re : Re: Question -
anassmaroc - 18.08.2015
Quote:
Originally Posted by ZToPMaN
Are you using mysql, dini or YSI\y_ini?
|
dini
Re : Question -
Dutheil - 18.08.2015
PHP код:
CreateRGB(r, g, b)
{
return ( ((r & 0xff) << 16) + ((g & 0xff) << 8) + (b & 0xff) );
}
Re: Question -
ZToPMaN - 18.08.2015
just an ex : dini_Set("File.txt", Red,Green,Blue);
Re : Question -
anassmaroc - 18.08.2015
Quote:
Originally Posted by Dutheil
PHP код:
CreateRGB(r, g, b)
{
return ( ((r & 0xff) << 16) + ((g & 0xff) << 8) + (b & 0xff) );
}
|
Ready Have
PHP код:
YCMD:mycolor(playerid,params[], help)
{
#pragma unused help
#pragma unused params
if(Account[playerid][VipLevel] < 1) return SendClientMessage(playerid,COLOR_RED,"Error: {FFFFFF}You are not a Donator Member!");
new Redrebels;
new Green;
new Blue;
if(sscanf(params, "ddd", Redrebels,Green,Blue))
{
SendClientMessage( playerid,COLOR_RED, "Usage: {FFFFFF}/mycolor [0-255] [0-255] [0-255]");
return 1;
}
if((Redrebels >= 0 && Green >= 0 && Blue >= 0) && (Redrebels <= 255 && Green <= 255 && Blue <= 255))
{
new mixedColor = 0;
mixedColor = (Redrebels << 24) + (Green << 16) + (Blue << 8) + 255;
SetPlayerColor(playerid, mixedColor);
SendClientMessage(playerid, -1, "Done!");
return 1;
}
else
{
SendClientMessage(playerid, -1, "Error: one or more channels are out of bounds (0<>255)");
return 1;
}
}
i Need To save this RGB for Vips and if the Vip wants save it he do /resetcolor
Re : Question -
anassmaroc - 19.08.2015
Bump!