SA-MP Forums Archive
dcmd help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd help (/showthread.php?tid=205120)



dcmd help - xir - 31.12.2010

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?


Re: dcmd help - xir - 01.01.2011

Hm cant work with dcmd?


Re: dcmd help - Grim_ - 01.01.2011

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;
}



Re: dcmd help - DRIFT_HUNTER - 01.01.2011

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;
}



Re: dcmd help - xir - 01.01.2011

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


Re: dcmd help - HyperZ - 01.01.2011

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;
}



Re: dcmd help - _rAped - 01.01.2011

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.");



Re: dcmd help - xir - 01.01.2011

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 ??