SA-MP Forums Archive
Command /asay help me please - 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: Command /asay help me please (/showthread.php?tid=651840)



Command /asay help me please - SapMan - 29.03.2018

Good community, I need help in a command.

Someone can explain to me how to make a command / asay but with the messages in colors, that is, I explain, /asay (blue) Hello (red) as (yellow) are

The colors that are in the parentheses are the colors that will be shown in the chat when it is written, I have the following command:

CMD:asay(playerid, params[])
{
new text[128],string[128];

if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid,-1, "Use: /asay [message]);
format(string, sizeof(string),"Admin %s: %s", Name(playerid), text);
SendClientMessageToAll(-1,string);
return 1;
}


Re: Command /asay help me please - BulletRaja - 29.03.2018

you can make it like this
PHP код:
CMD:asay(playeridparams[])
{
 new 
text[128],string[128], tmp2[33];
 if(
sscanf(params"ss[128]"tmp2text)) return SendClientMessage(playerid,-1"Use: /asay [color] [message]");
 if(
strlen(tmp2) < || strlen(tmp2) > 30) return SendClientMessage(playeridCOLOR_RED"Error: The color should be between 3 and 30 characters.");
 
format(stringsizeof(string),"Admin %s: {%s}%s"Name(playerid), tmp2text);
 
SendClientMessageToAll(-1,string);
 return 
1;

00FF00 = Light Green
008800 = Dark Green
FF0000 = Red
CBCBCB = Grey
you can check color codes on w3school
/asay 00FF00 [message]

hope it work


Re: Command /asay help me please - Dayrion - 29.03.2018

Quote:
Originally Posted by BulletRaja
Посмотреть сообщение
you can make it like this
PHP код:
CMD:asay(playeridparams[])
{
 new 
text[128],string[128], tmp2[33];
 if(
sscanf(params"ss[128]"tmp2text)) return SendClientMessage(playerid,-1"Use: /asay [color] [message]");
 if(
strlen(tmp2) < || strlen(tmp2) > 30) return SendClientMessage(playeridCOLOR_RED"Error: The color should be between 3 and 30 characters.");
 
format(stringsizeof(string),"Admin %s: {%s}%s"Name(playerid), tmp2text);
 
SendClientMessageToAll(-1,string);
 return 
1;

00FF00 = Light Green
008800 = Dark Green
FF0000 = Red
CBCBCB = Grey
you can check color codes on w3school
/asay 00FF00 [message]

hope it work
Whaaaaaaaat the fuck. Did you tested your code before posting it? Plus do you know that color are integer?

First, your code can be optimized by using isnull which check if a string is empty or no. If you want to add some color to your text, check that : https://sampwiki.blast.hk/wiki/Colors_List#Color_embedding
PHP код:
CMD:asay(playeridparams[])
{
    new 
string[128];
    if(
isnull(params)) return SendClientMessage(playerid,-1"Use: /asay [message]");
    
format(stringsizeof(string),"Admin %s: %s"Name(playerid), text);
    
SendClientMessageToAll(-1,string);
    return 
1;




Re: Command /asay help me please - SapMan - 29.03.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Whaaaaaaaat the fuck. Did you tested your code before posting it? Plus do you know that color are integer?

First, your code can be optimized by using isnull which check if a string is empty or no. If you want to add some color to your text, check that : https://sampwiki.blast.hk/wiki/Colors_List#Color_embedding
PHP код:
CMD:asay(playeridparams[])
{
    new 
string[128];
    if(
isnull(params)) return SendClientMessage(playerid,-1"Use: /asay [message]");
    
format(stringsizeof(string),"Admin %s: %s"Name(playerid), text);
    
SendClientMessageToAll(-1,string);
    return 
1;

HELP ME, I want is to put the colors with just write the name, example: /asay (cyan) Hello community (gray) of samp (red) forum

that one when writing one or with those colors the message appears from the color that I put it.


Re: Command /asay help me please - ivndosos - 29.03.2018

Код:
CMD:asay(playerid, params[])
{

	  new str[128];
	  if(sscanf(params, "s[128]", str)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /asay [message]");
	  format(str, sizeof(str), "{9d64d0}%s", str);
	  SendClientMessageToAll(-1, str);
      return 1;
}



Re: Command /asay help me please - Lokii - 29.03.2018

PHP код:
CMD:asay(playeridparams[])
{
    new 
str[144]; //text max is 144 not 128
    
if(!IsPlayerAdmin(playerid)) return 0;
    if(
sscanf(params"s[144]"params)) return SendClientMessage(playerid, -1"/asay [message]"); //we can use params instead of making another str2[144]; //useless
    
format(stringsizeof(string),"Admin %s: %s"Name(playerid), params);
    
SendClientMessageToAll(-1string);
    return 
1;




Re: Command /asay help me please - SapMan - 29.03.2018

Quote:
Originally Posted by Lokii
Посмотреть сообщение
PHP код:
CMD:asay(playeridparams[])
{
    new 
str[144]; //text max is 144 not 128
    
if(!IsPlayerAdmin(playerid)) return 0;
    if(
sscanf(params"s[144]"params)) return SendClientMessage(playerid, -1"/asay [message]"); //we can use params instead of making another str2[144]; //useless
    
format(stringsizeof(string),"Admin %s: %s"Name(playerid), params);
    
SendClientMessageToAll(-1string);
    return 
1;

I want it to be like that:

Sin tнtulo.png

And the message would be like that

Sin tнtulo2.png


Re: Command /asay help me please - rfr - 29.03.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Whaaaaaaaat the fuck. Did you tested your code before posting it? Plus do you know that color are integer?

First, your code can be optimized by using isnull which check if a string is empty or no. If you want to add some color to your text, check that : https://sampwiki.blast.hk/wiki/Colors_List#Color_embedding
PHP код:
CMD:asay(playeridparams[])
{
    new 
string[128];
    if(
isnull(params)) return SendClientMessage(playerid,-1"Use: /asay [message]");
    
format(stringsizeof(string),"Admin %s: %s"Name(playerid), text);
    
SendClientMessageToAll(-1,string);
    return 
1;

A hex code consists of letters and numbers therefore it can not be fully a integer


Re: Command /asay help me please - SyS - 29.03.2018

Quote:
Originally Posted by rfr
Посмотреть сообщение
A hex code consists of letters and numbers therefore it can not be fully a integer
hexadecimal is a base 16 number system.
https://en.wikipedia.org/wiki/Hexadecimal


Re: Command /asay help me please - Dayrion - 29.03.2018

Quote:
Originally Posted by SyS
Посмотреть сообщение
hexadecimal is a base 16 number system.
https://en.wikipedia.org/wiki/Hexadecimal
Plus, we are using a base 10 number system that's why letters has been added after 9 to complete that system.
Base 10 :
0 1 2 3 4 5 6 7 8 9

Base 16 :
0 1 2 3 4 5 6 7 8 9 A B C D E F

10(10) = A(16) = 12(8) = 1010(2)

OT: I linked you a page that explains how you can do what you actually wants. You don't need further help I guess.