Small dcmd questions!
#1

Is it possible to do something like this, in dcmd?
if(strcmp(cmd,"/r",true) == 0 || strcmp(cmd,"/fix",true) == 0 || strcmp(cmd,"/vr",true) == 0)

Also i'm trying to convert this admin cmd, into dcmd. ( Admin chat command! )
if(strcmp(cmd, "//", true) ==0)
But I don't think dcmd likes the "/" Because I get all sorts of errors, when trying to compile?

Any help or advice, is appreciated!
Reply
#2

I'm not a dcmd fan but I know how to write a command though.

pawn Код:
//OnPlayerComText
dcmd(/,1,cmdtext); // dcmd creates automaticly one /

// Under OnPlayerCommandText public
dcmd_/(playerid, params[])
That's it I think..
Reply
#3

Yep excatly what I did.

Here's the code.
OnPlayerCommandText
dcmd(/, 1, cmdtext);

dcmd function
pawn Код:
dcmd_/(playerid, params[])
{
    if(PlayerStuff[playerid][VADMIN] < 1) return DenyMessage(playerid, 1);
    new result[128];
    if(sscanf(params, "s", result)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "SYNTAX ERROR: Usage: // <text>");
    new string[128];
    GetPlayerName(playerid, sendername, 24);
    format(string,sizeof(string),"Admin: %s (lvl: %d): %s", sendername, PlayerStuff[playerid][VADMIN], result);
    for(new i=0;i<PLAYERS;i++)
    {
        if(IsPlayerConnected(i) && PlayerStuff[i][VADMIN] >= 1)
            SendClientMessage(i,COLOR_BLUE,string);
    }
    return 1;
}
My GM compiles fine without this command.
But with it, I get all sorts of errors, on lines that compiled fine before. So that's why I think dcmd doesn't like symbols as "-" & "/"
But I really want to get it confirmed, before making workarounds.
Reply
#4

'/' is an character in function names - you simply can't use dcmd for it.
Reply
#5

Ah, well I guess I have to do it another way then.
Thanks to the both of you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)