Role Play Chat Commands
#1

Hello there. I'm quite new to scripting, however seem to be getting on okay at the moment. But I'm stuck on this thing. I need to create the following chat commands:

/o - OOC chat
/b - Local OOC chat
/w [ID] Whisper chat
/low - Quiet Speak
/pm [ID] Private Message
/s - Shouting

However, I can't make them! I can't work it out. Can anyone show me how to make them? Or make them for me and post it here, thanks in advance.
Reply
#2

Using zcmd:

pawn Код:
CMD:ooc( playerid, params[] )
{
    if ( isnull ( params ) ) return SendClientMessage( playerid, -1, "Syntax /ooc [text]" );
    /* check if command parameters are null */
    new
        szString[ 128 ],
        PlayerName[ MAX_PLAYER_NAME ]
    ;
    /* declare two arrays, first will hold the message second will hold the player name */
    GetPlayerName( playerid, PlayerName, MAX_PLAYER_NAME );
    /* get the playerid name and store it in the array playername */
    format ( szString, sizeof ( szString ), "(( %s: %s ))", PlayerName, params );
    /* format the message and store it in the array szString, %s inserts a string
       first one will be for the player name and second one for the parameters (player text) */

    SendClientMessageToAll( -1, szString );
    /* send the message to all players */
    return ( 1 ); /* return a true value */
}
Reply
#3

Show us your attempts and we can try and fix them
Reply
#4

I sort of deleted them :/ I don't know where to start. Also, I'm not using zcmd. Just using strcmp.
Reply
#5

Quote:
Originally Posted by Jonesy96
Посмотреть сообщение
I sort of deleted them :/ I don't know where to start. Also, I'm not using zcmd. Just using strcmp.
Well... Switch to ZCMD, strcmp isn't a command processor - it's also easier to work with parameters with ZCMD. I won't help if you continue using strcmp, purely because I've forgotten how strtok works (which is needed for parameters when using strcmp)...
Reply
#6

As I said, I'm very new to scripting. I have no clue how to switch to zcmd
Reply
#7

Ok I will try to explain you. Is very simple.

So the first thing you need to know is that if you are making the command with ZCMD you will NOT put it under public
pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
but you will put it outside this. In the bottom of your script.

The second thing is including ZCMD in the script.
You include it by writing
pawn Код:
#include <zcmd>
at the top of the script.

Now I will show you the difference on the simple kick command.

So This is how are you writing now the command:
pawn Код:
if(strcmp(cmdtext, "/kick") == 0)
     {
         Kick(playerid);
         return 1;
     }
In ZCMD you will write it like this:
pawn Код:
CMD:kick(playerid, params[])
     {
         Kick(playerid);
         return 1;
     }
It's very simple and it doesen't slow your script.
And it's easy to convert
Reply
#8

Quote:
Originally Posted by BoboRi
Посмотреть сообщение
Ok I will try to explain you. Is very simple.

So the first thing you need to know is that if you are making the command with ZCMD you will NOT put it under public
pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
but you will put it outside this. In the bottom of your script.

The second thing is including ZCMD in the script.
You include it by writing
pawn Код:
#include <zcmd>
at the top of the script.

Now I will show you the difference on the simple kick command.

So This is how are you writing now the command:
pawn Код:
if(strcmp(cmdtext, "/kick") == 0)
     {
         Kick(playerid);
         return 1;
     }
In ZCMD you will write it like this:
pawn Код:
CMD:kick(playerid, params[])
     {
         Kick(playerid);
         return 1;
     }
It's very simple and it doesen't slow your script.
And it's easy to convert
Thanks a lot bro', where can I get the zcmd include?
Reply
#9

[Include] [INC] zcmd 0.3.1 | Fast & Simple Command Processor
Reply
#10

Yeeeah, the links wont work for me -_-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)