Hey please help me
#1

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,.
Reply
#2

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

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".
Reply
#4

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.
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)