Make into Dialog
#1

I am trying to put these cmds into a dialog, I have the dialog I wanna put them into below. I have tried multiple times with no results, any help would be welcomed.

pawn Код:
YCMD:mdc(playerid, params[], help) {
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Looks a person up on the criminal computer");
        return 1;
    }
    if(!IsAnLEO(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You aren't a cop!");
        return 1;
    }
    if(!IsOnDuty(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not on duty!");
        return 1;
    }
    if(!IsAtMDC(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not at a computer!");
        return 1;
    }
    if(IsRadioJammerActiveInArea(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "* The MDC is unable to connect to the police network");
        return 1;
    }
    new name[MAX_PLAYER_NAME];
    if(!sscanf(params,"s[" #MAX_PLAYER_NAME "]", name)) {
        IsNameTaken(name, "OnMDCLookup", playerid);
    } else {
        SendClientMessage(playerid, X11_WHITE, "USAGE: /mdc [Name]");
        SendClientMessage(playerid, X11_TOMATO_2, "Note: Because this is an offline lookup too, you must type the EXACT name in");
    }
    return 1;
}

YCMD:vmdc(playerid, params[], help) {
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Finds the closest car");
        return 1;
    }
    if(!IsAnLEO(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You aren't a cop!");
        return 1;
    }
    if(!IsOnDuty(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not on duty!");
        return 1;
    }
    if(!IsAtMDC(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not at a computer!");
        return 1;
    }
    if(IsRadioJammerActiveInArea(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "* The MDC is unable to connect to the police network");
        return 1;
    }
    new msg[128];
    new ownername[128];
    new carid;
    if(!sscanf(params, "d", carid)) {
        if(GetVehicleModel(carid) == 0) {
            SendClientMessage(playerid, X11_TOMATO_2, "Invalid Vehicle");
            return 1;
        }
        switch(VehicleInfo[carid][EVType]) {
            case EVehicleType_Owned: {
                format(ownername,sizeof(ownername), "Player: %s",GetPlayerNameEx(VehicleInfo[carid][EVOwner], ENameType_CharName));
            }
            case EVehicleType_Family: {
                format(ownername,sizeof(ownername), "No-One",);
            }
            case EVehicleType_JobCar: {
                format(ownername,sizeof(ownername), "Job: %s ",GetJobName(VehicleInfo[carid][EVOwner]));
            }
            case EVehicleType_PublicCar: {
                format(ownername,sizeof(ownername), "Public Car");
            }
            case EVehicleType_Faction: {
                format(ownername,sizeof(ownername), "Faction: %s ",GetFactionName(VehicleInfo[carid][EVOwner]));
            }
            case EVehicleType_RentCar: {
                format(ownername,sizeof(ownername), "Rental: %s ",GetPlayerNameEx(VehicleInfo[carid][EVOwner], ENameType_CharName));
            }
            case EVehicleType_None: {
                format(ownername,sizeof(ownername), "No-One");
            }
        }
        format(msg, sizeof(msg), "* Car Owner: %s",ownername);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
    } else {
        SendClientMessage(playerid, X11_WHITE, "USAGE: /carowner [carid]");
    }
    return 1;
}


Dialog I wanna put them into below



pawn Код:
YCMD:policecomputer(playerid, params[], help) {
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Turns on the police computer");
        return 1;
    }
    if(!IsAnLEO(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You're not employed to be a Law Enforcement Officer!");
        return 1;
    }
    if(!IsOnDuty(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not currently on duty, go grab your badge from the locker room!");
        return 1;
    }
    if(!IsAtMDC(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "You are not at a police computer!");
        return 1;
    }
    if(IsRadioJammerActiveInArea(playerid)) {
        SendClientMessage(playerid, X11_TOMATO_2, "* The computer is unable to connect to the police network, the network may be down!");
        return 1;
    }
    showPoliceComputerDialog(playerid);
    return 1;
}




forward showPoliceComputerDialog(playerid);
public showPoliceComputerDialog(playerid) {
    dialogstr[0] = 0;
    tempstr[0] = 0;
    for(new i=0;i<sizeof(ComputerDialogs);i++) {
        format(tempstr,sizeof(tempstr),"%s\n",ComputerDialogs[i][E_DialogOptionText]);
        strcat(dialogstr,tempstr,sizeof(dialogstr));
    }
    ShowPlayerDialog(playerid, EFactionsDialog_LEOCompOptions, DIALOG_STYLE_LIST, "Police Computer Menu",dialogstr,"Ok", "Cancel");
}



factionsOnDialogResp(playerid, dialogid, response, listitem, inputtext[]) {
    switch(dialogid) {
        case EFactionDialog_EquipChoose: {
            if(response) {
                onEquipResponse(playerid, listitem);
            }
        }
        case EFactionDialog_ArrestDialog: {
            handleArrestChoose(playerid, listitem,response);
        }
        case EFactionsDialog_CustomArrest: {
            handleCustomArrest(playerid, inputtext,response);
        }
        case EFactionsDialog_BailPrice: {
            handleArrestBail(playerid, inputtext,response);
        }
        case EFactionsDialog_InviteDialog: {
            new msg[128];
            new fid;
            fid = GetPVarInt(playerid, "FactionInvite");
            if(response) {
                format(msg, sizeof(msg), "* %s has been invited into %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),GetFactionName(fid));
                SendFactionMessage(fid, COLOR_LIGHTBLUE, msg);
                SetPVarInt(playerid, "Faction", fid);
                SetPVarInt(playerid, "Rank", 1);
            }
            DeletePVar(playerid, "FactionInvite");
        }
        case EFactionDialog_LiveOffer: {
            handleLiveResponse(playerid, response);
        }
        case EFactionsDialog_CopPlace: {
            if(response) {
                handleCopPlace(playerid, listitem);
            }
        }
        case EFactionsDialog_HitmanOrder: {
            if(response) {
                handleHitmanOrder(playerid, listitem);
            }
        }
        case EFactionsDialog_LEOCompOptions: {
            handlePoliceComputer(playerid, listitem, response);
        }
        case EFactionsDialog_LEOReqBackups: {
            handlePoliceBackup(playerid, inputtext, response);
        }
        case EFactionsDialog_ShowBizList: {
            handlePoliceBizLocation(playerid, listitem, response);
        }
    }
    return 1;
}

new ComputerDialogs[][E_PoliceComputers] = {
    {"Request Backup", 1, "requestLEOBackup"},
    {"Answer Backup", 1, "answerLEOBackup"},
    {"Cancel Backup", 1, "cancelLEOBackup"},
    {"Find Business Address", 1, "displayLEOBizList"}
};
Reply
#2

Have you tried putting:

pawn Код:
if(!IsAtMDC(playerid))
{
     SendClientMessage(playerid, X11_TOMATO_2, "You are not at a police computer!");
     return 1;
}
Into a stock then using it as a stock instead?
Reply
#3

Use strcat function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)