unknown command...
#1

i made a command dcmd_showweapons and when i join the game and type the command it says unknown cmd....
here this is what i used to do this command..

pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
after that i did this at oneplayercommandtext..
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(showweapons,11,cmdtext);
    return 0;
}
And under onplayercommandtext i have put the command
pawn Код:
dcmd_showweapons(playerid,params[])
{
    new string[128];
    if(sscanf(params, "u", ID))
etccccccc............
Reply
#2

Etcccccc? Give us the full code please.
Reply
#3

here it is

pawn Код:
dcmd_showweapons(playerid,params[])
{
    new string[128];
    if(sscanf(params, "u", ID))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /showweapons (Player Name/ID)");
        return 1;
    }
    if(GetPVarInt(playerid, "Spawned") == 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    if(gTeam[playerid] != TEAM_GUNDEL)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only Weapon Dealers can show people their weapons for sale.");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot give them weapons",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,ID) > 4)
    {
        format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to show him weapons.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(gTeam[ID] == TEAM_GUNDEL)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot give other Weapon Dealers weapons .. Im sure they have plenty.");
        return 1;
    }
    if(playerid == ID)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot give yourself weapons. Go to Ammunation to get some.");
        return 1;
    }
    if(GetPVarInt(playerid, "Spawned") == 0)
    {
        format(string,sizeof(string),"%s(%d) is not spawned. You cannot give dead people weapons ..",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(CalledForWeaponDealer[ID] == 0)
    {
        SendClientMessage(playerid,COLOR_ERROR,"They have not called for a weapon dealer. You cannot give them weapons.");
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
    {
        SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Weapon list shown_]]");
        format(string,sizeof(string),"You have shown your list of weapons for sale to %s(%d). Use /sellweapon to sell them a weapon.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);

        format(string,sizeof(string),"%s(%d) has shown you their list of weapons for sale. Tell them which number you want to buy from them.",PlayerName(playerid),playerid);
        SendClientMessage(ID,COLOR_LIGHTBLUE,string);
        ShowPlayerDialog(ID,DIALOG_WEAPONS,DIALOG_STYLE_MSGBOX,"{33CCFF}Weapon Dealer List","{FFFFFF}{10F441}1: {FFFFFF}M4 (500 Ammo - $5000)\n{10F441}2: {FFFFFF}Tec-9 (300 Ammo - $5000)\n{10F441}3: {FFFFFF}Sniper (40 Ammo - $5000)\n{10F441}4: {FFFFFF}Combat Shotgun (100 Ammo - $7000)\n{10F441}5: {FFFFFF}Deagle (40 Ammo - $5000)\n{10F441}6: {FFFFFF}Armour (100 - $6000)","Ok","Cancel");
        return 1;
    }
    return 1;
}
Reply
#4

anyone ?n ? ? ?
Reply
#5

anyone please?
Reply
#6

use zcmd
Reply
#7

Try to delete #include <zcmd> line

+Rep if I help you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)