What's the wrong with this command
#1

What's the wrong with this command when I try to type option it's not works
pawn Код:
dcmd_dedit(playerid, params[])
{
    new idx, text[128], string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
    if(sscanf(params, "s[128]", params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit [option] [doorid]");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: Pickup | Text | Interior | Exterior | CustomInterior | CustomExterior");
        return 1;
    }
    if(!strcmp(params, "pickup", true, 6))
    {
        new pickup;
        if(sscanf(params, "s[128]ii", params, idx, pickup)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit pickup [doorid] [pickupid]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        DoorInfo[idx][dType] = pickup;
        if(IsValidDynamicPickup(DoorInfo[idx][dPickup]))
        {
            DestroyDynamicPickup(DoorInfo[idx][dPickup]);
        }
        DoorInfo[idx][dPickup] = CreateDynamicPickup(DoorInfo[idx][dType], 1, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ], DoorInfo[idx][dOVW], DoorInfo[idx][dOInt]);
        format(string, sizeof(string), " You have set door ID %d's pickup to %d", idx, pickup);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(!strcmp(params, "text", true, 4))
    {
        if(sscanf(params, "s[128]is[128]", params, idx, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit text [doorid] [text]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        format(DoorInfo[idx][dText], 128, "%s", text);
        format(string, sizeof(string), "ID: %d\n%s", idx, DoorInfo[idx][dText]);
        UpdateDynamic3DTextLabelText(DoorInfo[idx][dTextID], COLOR_WHITE, string);
        format(string, sizeof(string), " You have set door ID %d's text to %s", idx, text);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(!strcmp(params, "interior", true, 8))
    {
        if(sscanf(params, "s[128]i", params, idx, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit interior [doorid]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        DoorInfo[idx][dIInt] = GetPlayerInterior(playerid);
        DoorInfo[idx][dIVW] = GetPlayerVirtualWorld(playerid);
        GetPlayerFacingAngle(playerid, DoorInfo[idx][dIA]);
        GetPlayerPos(playerid, DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]);
        format(string, sizeof(string), " You have set door ID %d's interior to your coordinates. (Int: %d | VW: %d)", idx, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(!strcmp(params, "exterior", true, 8))
    {
        if(sscanf(params, "s[128]i", params, idx, text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit interior [doorid]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        DoorInfo[idx][dOInt] = GetPlayerInterior(playerid);
        DoorInfo[idx][dOVW] = GetPlayerVirtualWorld(playerid);
        GetPlayerFacingAngle(playerid, DoorInfo[idx][dOA]);
        GetPlayerPos(playerid, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]);
        DestroyDynamicPickup(DoorInfo[idx][dPickup]);
        DoorInfo[idx][dPickup] = CreateDynamicPickup(DoorInfo[idx][dType], 1, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ], DoorInfo[idx][dOVW], DoorInfo[idx][dOInt]);
        DestroyDynamic3DTextLabel(DoorInfo[idx][dTextID]);
        format(string, sizeof(string), "ID: %d\n%s", idx, DoorInfo[idx][dText]);
        DoorInfo[idx][dTextID] = CreateDynamic3DTextLabel(string, COLOR_WHITE, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]+0.3, 15);
        format(string, sizeof(string), " You have set door ID %d's exterior to your coordinates. (Int: %d | VW: %d)", idx, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(!strcmp(params, "custominterior", true, 14))
    {
        if(sscanf(params, "s[128]i", params, idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit custominterior [doorid]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        if(!DoorInfo[idx][dCInt])
        {
            DoorInfo[idx][dCInt] = 1;
            format(string, sizeof(string), " You have set door ID %d to have a custom interior.", idx, text);
        }
        else
        {
            DoorInfo[idx][dCInt] = 0;
            format(string, sizeof(string), " You have set door ID %d to have a normal interior.", idx, text);
        }
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    if(!strcmp(params, "customexterior", true, 14))
    {
        if(sscanf(params, "s[128]i", params, idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dedit customexterior [doorid]");
        if(DoorInfo[idx][dType] == 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid door id.");
        if(!DoorInfo[idx][dCExt])
        {
            DoorInfo[idx][dCExt] = 1;
            format(string, sizeof(string), " You have set door ID %d to have a custom exterior.", idx, text);
        }
        else
        {
            DoorInfo[idx][dCExt] = 0;
            format(string, sizeof(string), " You have set door ID %d to have a normal exterior.", idx, text);
        }
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    return 1;
}
Reply
#2

In your params you have only included a single string, where as it appears you would like multiple params.
Reply
#3

Can you fix it sir?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)