Defined wont work ( dcmd and more )
#1

Hello, i tried define any codes what make my script better but wont work :S i tried DCMD and dont work too
(I use strtok)

pawn Код:
#define CMD(%1) !strcmp(cmd, %1, true)
AND THIS IS UNDER OnPlayerCommandText:
pawn Код:
if (CMD("/gop"))
    {
        if(GetPlayerAdmin(playerid) < 2){  return 1; }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SyntaxFormat(cmd,"[PlayerID]",tmp); ChatMessage(playerid,0, tmp,"p"); return 1;
        }
        giveplayerid = ReturnUser(tmp);
        if(!IsPlayerConnected(giveplayerid)){ return 1; }
        TelePlayerToPlayer(playerid,giveplayerid);
        return 1;
    }
DCMD TRIED:
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1

forward dcmd_help();
public dcmd_help()
{
    print("HELP");
    return 1;
}
AND THIS IS UNDER OnPlayerCommandText:
pawn Код:
dcmd(help,4,cmdtext);
AND I GOT THIS:
pawn Код:
warning 202: number of arguments does not match definition
Whats the problem ? i use Pawno

and when i printf it:
pawn Код:
#define CMD(%1) "!strcmp(cmd, %1, true)"
its show %1 as %1
Reply
#2

use [/pawn] [/pawn] in forum please
Reply
#3

You don't create a public for the dcmd commands.

pawn Код:
dcmd_help(playerid, params[])
{
 // do stuff here.
    print("HELP");
    return 1;
}
As I recall you should use it like this.
Reply
#4

pawn Код:
warning 202: number of arguments does not match definition
Reply
#5

In which lines do you get that warning?
Reply
#6

pawn Код:
dcmd(help,4,cmd);
Reply
#7

DCMD define

pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    dcmd(help, 4, cmdtext);  // 4 chars. because help is 4 char long.
    return 0;
}

dcmd_help(playerid, params[])
{
    SendClientMessage(playerid, COLOR_WHITE, "Hello, welcome to my server");
    return 1;
}
That is how it works, you don't create publics for it
Reply
#8

omg... To create dcmd cmd do like this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(setmyhealth,11,cmdtext);
    return 0;
}
dcmd_setmyhealth(playerid, params[])
{
    SetPlayerHealth(playerid, 50);
    SendClientMessage(playerid, 0x0259EAAA, "Your Health Has Been Setted To 50");
    return 1;
}
Reply
#9

That is incorrect Ricardo.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(setmyhealth,11,cmdtext);
    return 0;
}
dcmd_setmyhealth(playerid, params[])
{
    SetPlayerHealth(playerid, 50);
    SendClientMessage(playerid, 0x0259EAAA, "Your Health Has Been Setted To 50%%");
    return 1;
}
Reply
#10

Yeah, i done wrong My Fault and thanks for tell, post edited
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)