28.11.2012, 06:59
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;
}