[REQUEST]/me command
#1

I know it is nooby but it is the only thing I cant seem to script for my chat script.A helpful little post would be nice
Reply
#2

Normally

http://forum.sa-mp.com/index.php?topic=144062.0

However this is such a simple one.
pawn Код:
dcmd_me(playerid, params[])
{
  new msg[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  format(msg,sizeof(msg),"** %s(%i): %s",pName,playerid,params);
  SendClientMessageToAll(0xFFD720FF,msg);
  return 1;
}
or if you don't use dcmd yet(why the hell not) strcmp version

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]){
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/component",true) == 0)
    {
        new msg[128], pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        format(msg,sizeof(msg),"** %s(%i): %s",pName,playerid,cmdtext);
        SendClientMessageToAll(0xFFD720FF,msg);
        return 1;
    }
.....
}
Reply
#3

After #define and such i got these error with the bottom code


C:\Documents and Settings\Admin\Desktop\server\filterscripts\me.pwn (13) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Admin\Desktop\server\filterscripts\me.pwn (17) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Admin\Desktop\server\filterscripts\me.pwn (17) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Admin\Desktop\server\filterscripts\me.pwn (17) : error 020: invalid symbol name ""
C:\Documents and Settings\Admin\Desktop\server\filterscripts\me.pwn (17) : fatal error 107: too many error messages on one line
Reply
#4

anybody?
Reply
#5

Quote:
Originally Posted by [HiC
TheKiller ]
Simple Command Processor
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     new Command[100], Params[100];
    if(strfind(cmdtext, " ") != -1) strmid(Command, cmdtext, 1, strfind(cmdtext, " "));
    else if(strfind(cmdtext, " ") == -1) format(Command, 100, "%s", cmdtext);
    if(strfind(cmdtext, " ") != -1) format(Params, sizeof(Params), "%s", cmdtext[strfind(cmdtext, " ")]);
    #define IsParams(%1) strcmp(Params, %1)
     #define IsCommand(%1) strcmp(Command, %1)
    if(IsCommand("me"))
    {
         new Str[100];
        GetPlayerName(playerid, Str, 24);
        format(Str, sizeof(Str), "%s: %s", Str, Params);
        SendClientMessageToAll(0xF5F200AA, Str);
          return 1;
    }
    return 0;
}
Reply
#6

Yah I don't normally use strcmp system, so not surprised if it gave errors, however i dragged that right out of a working script, not sure why yours went wrong.

I would either use thekillers system or dcmd.
Reply
#7

I copied and pasted that into my script and still got errors
Reply
#8

Quote:
Originally Posted by too803
I copied and pasted.
You should not paste it randomly, you must know what are you doing (learn from it).
Reply
#9

Post what you have (your onplayercommandtext) and wherever it shows errors. and of course the error messages.
Reply
#10

I pasted at the bottom,all my 5246 line has is a {
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)