About command
#1

How to make this command for player if he is near his house he can set the price for it without typing the ID?

pawn Код:
CMD:hsetprice(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 3) {
        new
            houseID,
            housePrice;

        if(sscanf(params, "dd", houseID, housePrice))
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/hprice [houseid] [price]");

        if(houseID < 1 || houseID > MAX_HOUSES)
            return SendClientMessage(playerid, COLOR_GREY, "Invalid house ID.");

        format(szMessage, sizeof(szMessage), "You have set house %d's price to $%d.", houseID, housePrice);
        SendClientMessage(playerid, COLOR_WHITE, szMessage);

        houseVariables[houseID][hHousePrice] = housePrice;

        if(!strcmp(houseVariables[houseID][hHouseOwner], "Nobody", true) && strlen(houseVariables[houseID][hHouseOwner]) >= 1) {
            switch(houseVariables[houseID][hHouseLocked]) {
                case 0: format(szMessage, sizeof(szMessage), "House %d (un-owned - /buyhouse)\nPrice: $%d\n\n(locked)", houseID, houseVariables[houseID][hHousePrice]);
                default: format(szMessage, sizeof(szMessage), "House %d (un-owned - /buyhouse)\nPrice: $%d\n\nPress ~k~~PED_DUCK~ to enter.", houseID, houseVariables[houseID][hHousePrice]);
            }

            UpdateDynamic3DTextLabelText(houseVariables[houseID][hLabelID], COLOR_YELLOW, szMessage);
        }
    }
    return 1;
}
Reply
#2

Make a loop to chech if your near any of the house ids.
Reply
#3

pawn Код:
CMD:hsetprice(playerid, params[]) {
    if(playerVariables[playerid][pStatus] >= 1) {
 for(new x = 0; x < MAX_HOUSES; x++) {
            if(IsPlayerInRangeOfPoint(playerid, 5, houseVariables[x][hHouseExteriorPos][0], houseVariables[x][hHouseExteriorPos][1], houseVariables[x][hHouseExteriorPos][2])) {
{
        new
            //houseID,
            housePrice;

        if(sscanf(params, "dd", housePrice))
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/hprice [houseid] [price]");

        if(houseID < 1 || houseID > MAX_HOUSES)
            return SendClientMessage(playerid, COLOR_GREY, "Invalid house ID.");

        format(szMessage, sizeof(szMessage), "You have set house %d's price to $%d.", houseID, housePrice);
        SendClientMessage(playerid, COLOR_WHITE, szMessage);

        houseVariables[houseID][hHousePrice] = housePrice;

        if(!strcmp(houseVariables[houseID][hHouseOwner], "Nobody", true) && strlen(houseVariables[houseID][hHouseOwner]) >= 1) {
            switch(houseVariables[houseID][hHouseLocked]) {
                case 0: format(szMessage, sizeof(szMessage), "House %d (un-owned - /buyhouse)\nPrice: $%d\n\n(locked)", houseID, houseVariables[houseID][hHousePrice]);
                default: format(szMessage, sizeof(szMessage), "House %d (un-owned - /buyhouse)\nPrice: $%d\n\nPress ~k~~PED_DUCK~ to enter.", houseID, houseVariables[houseID][hHousePrice]);
            }

            UpdateDynamic3DTextLabelText(houseVariables[houseID][hLabelID], COLOR_YELLOW, szMessage);
        }
            }
          }
    }
    return 1;
}
I did this is this going to work?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)