[Help] DCMD Commands not working.
#1

They Compile without any errors, but have two warnings:
The (( params[] )) isn't being used, and if I get rid of it, a whole new world of problems occur.

The Main Problem is this: When I use a command in game nothing happens..not one thing happens.

/storedrugs
pawn Code:
dcmd_storedrugs(playerid, params[])
{
    new
        amount;
    if (sscanf(params, "d", amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /storedrugs [amount]");
    else if (amount > PlayerInfo[playerid][pDrugs]) SendClientMessage(playerid, 0xFF0000AA, "Insufficient Drugs");
    else if (!IsPlayerInRangeOfPoint(playerid, 1.0, 1385.0627, -1893.2686, 13.4765)) SendClientMessage(playerid, COLOR_RED, "You aren't in the warehouse");
    else
    {
      new string[200];
        PlayerInfo[playerid][pDrugs] -= amount;
        PlayerInfo[playerid][pBag] += amount;
        SendClientMessage(playerid, 0x00FF00AA, "Drugs Stored.");
        format(string, sizeof(string), " %d Drugs in Warehouse ", PlayerInfo[playerid][pBag]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SendClientMessage(playerid, 0x00FF00AA, "/takedrugs to remove them.");
        SendClientMessage(playerid, 0x00FF00AA, "/checkdrugs to check amount.");
    }
    return 1;
}
/takedrugs
pawn Code:
dcmd_takedrugs(playerid, params[])
{
    new
        amount,
        string[200];
    if (sscanf(params, "d", amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /takedrugs [amount]");
    else if (amount > PlayerInfo[playerid][pBag]) SendClientMessage(playerid, 0xFF0000AA, "Insufficient Drugs");
else if (!IsPlayerInRangeOfPoint(playerid, 1.0, 1385.0627, -1893.2686, 13.4765)) SendClientMessage(playerid, COLOR_RED, "You aren't in the warehouse");
    else
    {
        PlayerInfo[playerid][pDrugs] += amount;
        PlayerInfo[playerid][pBag] -= amount;
        format(string, sizeof(string), " %d Drugs in Warehouse ", PlayerInfo[playerid][pBag]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SendClientMessage(playerid, 0x00FF00AA, "Drugs Un-Stored.");
        SendClientMessage(playerid, 0x00FF00AA, "/storedrugs to store them.");
        SendClientMessage(playerid, 0x00FF00AA, "/checkdrugs to check amount.");
    }
    return 1;
}
/checkdrugs
pawn Code:
dcmd_checkdrugs(playerid, params[])
{
    new string[200];
    format(string, sizeof(string), " %d Drugs in Warehouse ", PlayerInfo[playerid][pBag]);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    SendClientMessage(playerid, 0x00FF00AA, "/storedrugs to store them.");
    SendClientMessage(playerid, 0x00FF00AA, "/takedrugs to take them.");
    return 1;
}
Reply
#2

On Checkdrugs put this in at the top:

pawn Code:
#pragma unused params
Reply
#3

http://pastebin.com/m350e2d60

I don't know if it will work now, but you should try it. I cleaned up the code and made it better.
Reply
#4

Thanks, though I just noticed that none of my DCMD commands are working, what could be causing this?
Anything I need to post?
Reply
#5

Did you look at what I posted? I think it could be all of those else if's. If you do it how I did it, it will work every time.
Reply
#6

Quote:
Originally Posted by Backwardsman97
Did you look at what I posted? I think it could be all of those else if's. If you do it how I did it, it will work every time.
The new ones you gave me don't even work.

Is it possible for something else to interfere with them?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)