dcmd help
#1

How can I make it like this in dcmd

This is just an example, im thinking to do this with other commands

/god 1 // enables god mode

/god 0 // disable god mode?

how can I do this in dcmd?
Reply
#2

Hm cant work with dcmd?
Reply
#3

I would suggest ZCMD, it's more efficient than dcmd:
pawn Код:
COMMAND:god( playerid, params[ ] )
{
   #pragma unused params
   if( GetPVarInt( playerid, "god_mode" ) == 0 )
   {
      SetPVarInt( playerid, "god_mode", 1 );
      SetPlayerHealth( playerid, 1000000.0 );
   }
   else
   {
      SetPVarInt( playerid, "god_mode", 0 );
      SetPlayerHealth( playerid, 100.0 );
   }
   return 1;
}
Reply
#4

pawn Код:
dcmd_gang(playerid, params[])
{
    if(strcmp(params, "0", true)==0)
    {
     //if params 0 these is called
    }
    else if(strcmp(params, "1", true)==0)
    {
    //If params are 1 these is called
    }
    return 1;
}
Reply
#5

hmmm like this?

pawn Код:
dcmd_god(playerid, params[])
{
    if(strcmp(params, "0", true)==0) {
        new pid;
        if(sscanf(params, "u", pid)) return SendClientMessage(playerid, Yellow, "Usage: /god 1/0");
        if(level[playerid] >= 1) {
            SetPlayerHealth(playerid, 100);
        }
        else if(strcmp(params, "1", true)==0) {
            new pid;
            if(sscanf(params, "u", pid)) return SendClientMessage(playerid, Yellow, "Usage: /god 1/0");
            if(level[playerid] >= 1) {
                SetPlayerHealth(playerid, 10000);
            } else SendClientMessage(playerid, White, "SERVER: Unknown command.");
        }
        return 1;
}
but gives me alot of errors

@Grim_ I like dcmd I will stick with it
Reply
#6

pawn Код:
pGod[MAX_PLAYERS];
pawn Код:
dcmd_god(playerid, params[])
{
    if(level[playerid] >= 1) SendClientMessage(playerid, White, "SERVER: Unknown command.");
    else
    {
        if(sscanf(params, "u", params)) return SendClientMessage(playerid, 0xF97804FF, "Usage: /god 1/0");
        if(strcmp(params, "0", true)==0)
        {
        SetPlayerHealth(playerid, 100);
        pGod[playerid] = 0;
        }
        else if(strcmp(params, "1", true)==0)
        {
        SetPlayerHealth(playerid, 10000);
        pGod[playerid] = 1;
        }
    }
    return 1;
}
Reply
#7

pawn Код:
sscanf(params, "u", params))
u = user? Should be i or d for integer. also you get the same result by doing
pawn Код:
return 0;
instead of
pawn Код:
SendClientMessage(playerid, White, "SERVER: Unknown command.");
Reply
#8

I know raped_ I did that before but it said Unknown COmmand, so I tryed that, still the same I think I will need enums to save stats , but i cant figure it out

So u, d or i ??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)