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



Hey please help me - Osamakurdi - 08.03.2018

I have this code:
Код:
CMD:message(playerid, params[])
{
    new mess[180];
    format(mess, sizeof(mess), "Hey");
    SendClientMessage(playerid, COLOR_WHITE, mess);
    return 1;
}
CMD:changemess(playerid, params[])
{
    new message[180];
    if(sscanf(params, "s[180]", message)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE:/changemessage <message>");
    return 1;
}
How I can using cmd changemessage change message that sent to player when I type /message.
If you know what I meant,.


Re: Hey please help me - PepsiCola23 - 08.03.2018

You want to make message system from one player to another with dialogs?


Re: Hey please help me - Osamakurdi - 08.03.2018

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
You want to make message system from one player to another with dialogs?
NOTE:code is changed above.
I just want using /changemess to change message that been sent to player("Hey") when he type /message
For example:
player type /message it will send him a message says "Hey"
when player type for example /changemess <Hello> then player type /message it will send him "Hello".


Re: Hey please help me - AroseKhanNiazi - 08.03.2018

PHP код:
new themsg[124]="Hey";

CMD:message(playerid)
{
    
SendClientMessage(playeridCOLOR_WHITEthemsg);
    return 
1;
}
CMD:changemess(playeridparams[])
{
    if(
sscanf(params"s[124]"themsg)) return SendClientMessage(playeridCOLOR_WHITE"USAGE:/changemessage <message>");
    
SendClientMessage(playerid,-1,"Message has been changed.");
    return 
1;

Here's the code.

So what I did and where were you wrong.

1) As the message is used in multiple commands, so it needs to be stored globally. For that reason, I created themsg[124] string as global.

2)
Changed,
PHP код:
CMD:message(playeridparams[]) 
to
PHP код:
CMD:message(playerid
As you don't need params here.

3)
Removed;
PHP код:
new mess[180];
format(messsizeof(mess), "Hey"); 
This is not needed.

4) Did change other command, as sscanf will load what the player types directly into the 'themsg' string as we don't any other formatting inside it.


Re: Hey please help me - Osamakurdi - 08.03.2018

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
PHP код:
new themsg[124]="Hey";
CMD:message(playerid)
{
    
SendClientMessage(playeridCOLOR_WHITEthemsg);
    return 
1;
}
CMD:changemess(playeridparams[])
{
    if(
sscanf(params"s[124]"themsg)) return SendClientMessage(playeridCOLOR_WHITE"USAGE:/changemessage <message>");
    
SendClientMessage(playerid,-1,"Message has been changed.");
    return 
1;

Here's the code.

So what I did and where were you wrong.

1) As the message is used in multiple commands, so it needs to be stored globally. For that reason, I created themsg[124] string as global.

2)
Changed,
PHP код:
CMD:message(playeridparams[]) 
to
PHP код:
CMD:message(playerid
As you don't need params here.

3)
Removed;
PHP код:
new mess[180];
format(messsizeof(mess), "Hey"); 
This is not needed.

4) Did change other command, as sscanf will load what the player types directly into the 'themsg' string as we don't any other formatting inside it.
Thanks