04.06.2016, 21:28
Код:
CMD:ledit(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 6) { SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!"); return 1; } new string[128], choice[32], loid, amount; if(sscanf(params, "s[32]dD", choice, loid, amount)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ledit [option] [houseid] [amount]"); SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price |type | level "); if(PlayerInfo[playerid][pAdmin] >= 6) { SendClientMessage(playerid, COLOR_GREY, "NotEditable"); } return 1; } if(loid >= MAX_LO) { SendClientMessage(playerid, COLOR_WHITE, "Invalid furn ID!"); return 1; } if(strcmp(choice, "location", true) == 0) { new idx=loid; if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); GetPlayerPos(playerid, HouseInfo [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]); DestroyDynamicPickup(HouseInfo [loid][loPickup]); DestroyDynamic3DTextLabel(HouseInfo [loid][loText]); SaveLo(); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /buy",RLT(idx), HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idx); HouseInfo [loid][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, HouseInfo [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]+0.3, 3); HouseInfo [loid][loPickup] = CreateDynamicPickup(19523, 1, HouseInfo [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]); SendClientMessage(playerid, COLOR_WHITE, " You have changed the location!"); format(string, sizeof(string), "AdmCmd: %s has changed business ID %d's location.", GetPlayerNameEx(playerid), loid); Log("logs/lo.log", string); return 1; } else if(strcmp(choice, "type", true) == 0) { new idx=loid; if(!HouseInfo [idx][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); if(amount < 2 || amount > 7) return SendClientMessage(playerid, COLOR_GREY, "house are between 2 and 6."); HouseInfo [idx][loType] = amount; if(HouseInfo [idx][loType] == 2) { DestroyDynamic3DTextLabel(HouseInfo [idx][loText]); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nSmall house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idx); HouseInfo [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, HouseInfo [idx][loX], HouseInfo [idx][loY], HouseInfo [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText(HouseInfo [idx][loText], COLOR_RED, string); } if(HouseInfo [idx][loType] == 3) { DestroyDynamic3DTextLabel(HouseInfo [idx][loText]); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nMedium house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idx); HouseInfo [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, HouseInfo [idx][loX], HouseInfo [idx][loY], HouseInfo [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText(HouseInfo [idx][loText], COLOR_RED, string); } if(HouseInfo [idx][loType] == 4) { DestroyDynamic3DTextLabel(HouseInfo [idx][loText]); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nLarge house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idx); HouseInfo [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, HouseInfo [idx][loX], HouseInfo [idx][loY], HouseInfo [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText(HouseInfo [idx][loText], COLOR_RED, string); } format(string, sizeof(string), "You have changed house type to %d ", amount); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "AdmCmd: %s has set house ID %d's type to %d.", GetPlayerNameEx(playerid), idx, amount); Log("logs/house .log", string); } else if(strcmp(choice, "price", true) == 0) { if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); if(strcmp("Nobody", HouseInfo [loid][loOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned house ."); HouseInfo [loid][loPrice] = amount; format(string, sizeof(string), "This house is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ",RLT(loid), HouseInfo [loid][loLevel], loid, HouseInfo [loid][loPrice]); UpdateDynamic3DTextLabelText(HouseInfo [loid][loText], COLOR_RED, string); format(string, sizeof(string), "You have changed the price of business to %d.", amount); SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "AdmCmd: %s has set business ID %d's price to $%d.", GetPlayerNameEx(playerid), loid, amount); Log("logs/lo.log", string); } else if(strcmp(choice, "level", true) == 0) { if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); HouseInfo [loid][loLevel] = amount; format(string, sizeof(string), "This business is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ",RLT(loid), HouseInfo [loid][loLevel], loid, HouseInfo [loid][loPrice]); UpdateDynamic3DTextLabelText(HouseInfo [loid][loText], COLOR_RED, string); format(string, sizeof(string), "You have changed the business Level to %d.", amount); SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "AdmCmd: %s has set business ID %d's level to %d.", GetPlayerNameEx(playerid), loid, amount); Log("logs/lo.log", string); } return 1; }
Код:
if(strcmp(cmd,"/ledid",true) == 0) { if(PlayerInfo[playerid][pAdmin] < 6) { SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!"); return 1; } new tmp[128],string[128], choice[32], loid, amount; new NewID = GetFurnitureID(); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ledit [option] [house id] [amount]"); SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price |type | level "); return 1; } choice = strval(tmp); loid = strval(tmp); amount = strval(tmp); if(loid >= MAX_LO) { SendClientMessage(playerid, COLOR_WHITE, "Invalid house ID!"); return 1; } if(strcmp(choice, "location", true) == 0) { new idx=loid; if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); GetPlayerPos(playerid, HouseInfo [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]); DestroyDynamicPickup(HouseInfo [loid][loPickup]); DestroyDynamic3DTextLabel(HouseInfo [loid][loText]); SaveLo(); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ",RLT(idx), HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idxHouseInfo HouseInfo [loid][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]+0.3, 3); HouseInfo [loid][loPickup] = CreateDynamicPickup(19523, 1, HouseInfo [loid][loX], HouseInfo [loid][loY], HouseInfo [loid][loZ]); SendClientMessage(playerid, COLOR_WHITE, " You have changed the location!"); format(string, sizeof(string), "AdmCmd: %s has changed business ID %d's location.", GetPlayerNameEx(playerid), loid); Log("logs/lo.log", string); return 1; } else if(strcmp(choice, "type", true) == 0) { new idx=loid; if(!HouseInfo [idx][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid business id."); if(amount < 2 || amount > 7) return SendClientMessage(playerid, COLOR_GREY, "house are between 2 and 6."); HouseInfo [idx][loType] = amount; if(HouseInfo [idx][loType] == 2) { DestroyDynamic3DTextLabel(HouseInfo [idx][loText]); if(!strcmp("Nobody", HouseInfo [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nSmall house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", HouseInfo [idx][loLevel], idx, HouseInfo [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),HouseInfo [idx][loOwner], idx); [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, [idx][loX], [idx][loY], [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText([idx][loText], COLOR_RED, string); } if([idx][loType] == 3) { DestroyDynamic3DTextLabel(HouseInfo [idx][loText]); if(!strcmp("Nobody", [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nMedium house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", [idx][loLevel], idx, [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),[idx][loOwner], idx); [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, [idx][loX], [idx][loY], [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText([idx][loText], COLOR_RED, string); } if(HouseInfo [idx][loType] == 4) { DestroyDynamic3DTextLabel([idx][loText]); if(!strcmp("Nobody", [idx][loOwner])) format(string, sizeof(string), "This house is for sale!\nLarge house \n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ", [idx][loLevel], idx, [idx][loPrice]); else format(string, sizeof(string), "%s\nOwner: %s\n\n ID: %d",RLT(idx),[idx][loOwner], idx); [idx][loText] = CreateDynamic3DTextLabel(string, COLOR_RED, [idx][loX], [idx][loY], [idx][loZ]+0.3, 3); UpdateDynamic3DTextLabelText([idx][loText], COLOR_RED, string); } format(string, sizeof(string), "You have changed house type to %d ", amount); SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "AdmCmd: %s has set house ID %d's type to %d.", GetPlayerNameEx(playerid), idx, amount); Log("logs/biz.log", string); } else if(strcmp(choice, "price", true) == 0) { if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); if(strcmp("Nobody", [loid][loOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned house ."); [loid][loPrice] = amount; format(string, sizeof(string), "This house is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ",RLT(loid), [loid][loLevel], loid, [loid][loPrice]); UpdateDynamic3DTextLabelText([loid][loText], COLOR_RED, string); format(string, sizeof(string), "You have changed the price of business to %d.", amount); SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "AdmCmd: %s has set business ID %d's price to $%d.", GetPlayerNameEx(playerid), loid, amount); Log("logs/lo.log", string); } else if(strcmp(choice, "level", true) == 0) { if(!HouseInfo [loid][loType]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id."); [loid][loLevel] = amount; format(string, sizeof(string), "This business is for sale!\n%s\n Level: %d\nID: %d\nPrice: $%d\n\nTo buy this house type /house ",RLT(loid), [loid][loLevel], loid, [loid][loPrice]); UpdateDynamic3DTextLabelText([loid][loText], COLOR_RED, string); format(string, sizeof(string), "You have changed the business Level to %d.", amount); SendClientMessage(playerid, COLOR_RED, string); format(string, sizeof(string), "AdmCmd: %s has set business ID %d's level to %d.", GetPlayerNameEx(playerid), loid, amount); Log("logs/lo.log", string); } return 1; }