Question.
#1

Is it possible to create a command that can do more things at once. Like... hm... To create a cmd /edithouses where you can edit all of the houses at once and not just specific one. Or just /housesprices where you edit price of all created houses on the server. cuz I need it and I dont want to edit each house it would be easier this way.

So yeah if you know how to do it, help me please.
Reply
#2

Show your edit house command please.
Reply
#3

Loops ... gotta love em.
Thats all you need, a loop that goes thru all houses and sets prices etc.
Reply
#4

here is my code
Код HTML:
 CMD:hedit(playerid, params[])
{
	new bizid, string[128], input;
	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
//    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
	if(sscanf(params, "s[32]", params))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit [option] [houseid]");
		SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level");
		return 1;
	}
	if(!strcmp(params, "location", true, 8))
	{
	    if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit location [house]");
        new idx = bizid;
        if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
		GetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
		DestroyDynamicPickup(HouseInfo[idx][hPickup]);
    	HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
		DestroyDynamic3DTextLabel(HouseInfo[idx][hText]);
        if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
		else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
		HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
	    format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has changed house ID %d's location.", RPN(playerid), bizid);
		SendAdminMessage(COLOR_DARKRED, 1, string);
		Log("logs/house.log", string);
	}
	else if(!strcmp(params, "price", true, 5))
	{
    	if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
	    if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house price [house] [price]");
        new idx = bizid;
		if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
		if(strcmp("The State", HouseInfo[bizid][hOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can't edit the price of owned businesses.");
	    HouseInfo[bizid][hPrice] = input;
	    format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
		UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
	    format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set house ID %d's price to $%d.", RPN(playerid), bizid, input);
		SendAdminMessage(COLOR_DARKRED, 1, string);
		Log("logs/house.log", string);
	}
	else if(!strcmp(params, "level", true, 5))
	{
		if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
	    if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house level [houseid] [level]");
        new idx = bizid;
    	//if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
    	if(input < 1 || input > 11) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 11.");
	    HouseInfo[bizid][hLevel] = input;
        if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" For Sale\n"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
		else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]\n"COE"Owner"CWE" %s\n"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
		UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
	    format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set house ID %d's level to %d.", RPN(playerid), bizid, input);
		SendAdminMessage(COLOR_DARKRED, 1, string);
		Log("logs/house.log", string);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)