SA-MP Forums Archive
Role Play Chat Commands - 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: Role Play Chat Commands (/showthread.php?tid=300092)



Role Play Chat Commands - Jonesy96 - 28.11.2011

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.


Re: Role Play Chat Commands - SmiT - 28.11.2011

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 */
}



Re: Role Play Chat Commands - Ash. - 28.11.2011

Show us your attempts and we can try and fix them


Re: Role Play Chat Commands - Jonesy96 - 28.11.2011

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


Re: Role Play Chat Commands - Ash. - 28.11.2011

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)...


Re: Role Play Chat Commands - Jonesy96 - 28.11.2011

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


Re: Role Play Chat Commands - BoboRi - 28.11.2011

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


Re: Role Play Chat Commands - Jonesy96 - 29.11.2011

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?


Re: Role Play Chat Commands - Kostas' - 29.11.2011

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


Re: Role Play Chat Commands - Jonesy96 - 29.11.2011

Yeeeah, the links wont work for me -_-