"/say [text]" -----> "// [text]" - Help please
#1

Hey people....

I got this command:

pawn Код:
dcmd_say(playerid, params[])
    {
      if(PlayerInfo[playerid][pAdmin] < 1) return 1;
        new string[128], server[128];
        if(sscanf(params, "s", server)) return SendHelpMessage(playerid, ".: Usage: // [text] :.");
        format(string, sizeof(string), "(( %s %s: %s ))", AdminRankName(playerid), pName(playerid), server);
        SendClientMessageToAll(COLOR_YELLOW2, string);
        return 1;
    }
But I want it to be "//" instead of "/say"

And that gives me shit lots of errors with dcmd... so how to fix ?

Thank you
Reply
#2

// makes the line commented, as you see in your quote // text becomes green.

That means this code will be ignored just as if it didn't exist.
This is also why It gives you errors upon compiling the script.

I don't think It will be possible to create such command prefix.
Reply
#3

Quote:
Originally Posted by mavtias
// makes the line commented, as you see in your quote // text becomes green.

That means this code will be ignored just as if it didn't exist.
This is also why It gives you errors upon compiling the script.

I don't think It will be possible to create such command prefix.
It doesn't make it a comment as it is inside 2 quote signs.... Just the pawn script in the forum that thinks so...

This is possible. I've seen it...
Reply
#4

Well, use the good old strcmp for that command only then? :P
Reply
#5

dont know how lol
Reply
#6

Quote:
Originally Posted by IntrozeN
dont know how lol
pawn Код:
if(strcmp(cmd, "//say", true) == 0)
{
   // command
   return 1;
}
Reply
#7

pawn Код:
if(!strcmp(cmdtext, "//say", true, 5))
    {
        if (IsPlayerAdmin(playerid))
        {
          if(!strlen(cmdtext[5])) return SendClientMessage(playerid, COLOR, "USE: //say <text>");
            GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "%s: %s" ,sendername, cmdtext[5]);
            SendClientMessageToAll(color, string);
            return 1;
        }
        else return SendClientMessage(playerid, RED, "You are not an admin!");
    }
Idk if it will work :P I wrote it inside the forum :P Buy you get the point how it works :P
Reply
#8

You'll have to do it in OnPlayerText instead of OnPlayerCommandText, because it's technically not a command.
Reply
#9

I don't want it to be //say, I want it to be //
Reply
#10

Quote:
Originally Posted by Sky4D
You'll have to do it in OnPlayerText instead of OnPlayerCommandText, because it's technically not a command.
Wrong.

Well, If you want it to be just //, change It to that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)