Problem with house ids..
#1

Hello everyone.. I have a problem, when you typing /addhouse, house id is 1 for example, but if type one more time
/addhouse, house id be 2. Ca you help me please? i need your help, fast!
Reply
#2

Show us your code
Reply
#3

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Small\n{FFFFFF}Rent: {FF0000}$%d", HouseInfo[houseid][HouseID], ConnectedRenters(), HouseInfo[houseid][HouseRent]);

"House 421" for example. I put and that: "houseid++;", But it is not working
Reply
#4

Where's your addhouse command... Not just the format line.
Reply
#5

Is where:

CMD:createhouse(playerid, params[])
{
new id, type, Float:MyPos[3]; GetPlayerPos(playerid, MyPos[0], MyPos[1], MyPos[2]); Query[0] = '\0'; Str[0] = '\0';
//************************************************** ************************
if(PlayerInfo[playerid][AdminLevel] >= 5)
{
if(sscanf(params, "dd", id, type)) return SendClientMessage(playerid, Yellow2, "Type: /addhouse <house id> <house type (0 - small; 1 - medium; 2 - big)>");
//************************************************** ********************
if(id < 0 || id > MAX_HOUSES) return SendClientMessage(playerid, Adm, "Invalid house id.");
//************************************************** ********************
if(type == 0) // SMALL INTERIOR
{
new SmallInteriorRandom = random(14);// LabelStr[248];
//************************************************** ****************
switch(SmallInteriorRandom)
{
case 0: //1
{

}
case 1: //2
{

}
case 2: //3
{

}
case 3: //4
{

}
case 4: //5
{

}
case 5: //6
{

}
case 6: //7
{

}
case 7: //8
{

}
case 8: //9
{

}
case 9: //10
{

}
case 10: //11
{

}
case 11: //12
{

}
case 12: //13
{

}
case 13: //14
{

}
}
}
else if(type == 1) // MEDIUM INTERIOR
{
new MediumInteriorRandom = random(23);// LabelStr[248];
//************************************************** ****************
switch(MediumInteriorRandom)
{
case 0: //15
{
}
case 1: //16
{
}
case 2: //17
{
}
case 3: //18
{
}
case 4: //19
{
}
case 5: //20
{
}
case 6: //21
{
}
case 7: //22
{
}
case 8: //23
{
}
case 9: //24
{
}
case 10: //25
{
}
case 11: //26
{
}
case 12: //27
{
}
case 13: //28
{
}
case 14: //29
{
}
case 15: //30
{
}
case 16: //31
{
}
case 17: //32
{
}
case 18: //33
{
}
case 19: //34
{
}
case 20: //35
{
}
case 21: //36
{
}
case 22: //37
{
}
}
}
else if(type == 2) // BIG INTERIOR
{
new BigInteriorRandom = random(5), LabelStr[248];
//************************************************** ****************
switch(BigInteriorRandom)
{
case 0: // coordonates 140.17 1366.07 1083.65 ; interior 5 ; 38
{
HouseInfo[id][HouseType] = 2; HouseInfo[id][InteriorID] = 38;
//************************************************** ********
HouseInfo[id][HouseLevel] = 10; HouseInfo[id][HousePrice] = 0;
HouseInfo[id][HouseID] = id; HouseInfo[id][HouseInterior] = 5;
HouseInfo[id][HouseLocked] = 0; HouseInfo[id][HouseOwned] = 0;
HouseInfo[id][HouseVW] = 39; HouseInfo[id][ForSale] = 0;
HouseInfo[id][HousePos][0] = MyPos[0];
HouseInfo[id][HousePos][1] = MyPos[1];
HouseInfo[id][HousePos][2] = MyPos[2];
HouseInfo[id][HouseExist] = 1; HouseInfo[id][HouseRent] = 1;
HouseInfo[id][HouseFridge] = 0; HouseInfo[id][HouseRadio] = 0;
//************************************************** ********
format(Str, sizeof(Str), "Admin %s added a new house (id: %d)", PlayerName(playerid), id), SendMessageToAdmins(Gold, Str);

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Big\n{FFFFFF}Rent: {FF0000}$1", id, ConnectedRenters());

format(Query, sizeof(Query), "INSERT INTO `houses` (`HouseLevel`, `HousePrice`, `HouseID`, `HouseInterior`, `HouseLocked`, `HouseOwned`, `HouseOwner`, `HouseLabel`, `HousePickup`, `HouseVW`, `HousePosX`, `HousePosY`, `HousePosZ`, `ExitPosX`, `ExitPosY`, `ExitPosZ`, `HouseExist`, `HouseType`, `HouseFridge`, `HouseRadio`, `ForSale`, `HouseRent`) VALUES \
('10', '0', '0', '5', '0', '0', 'AdmBot', 'Licitatii in weekent!', '1272', '39', '%f', '%f', '%f', '140.17', '1366.07', '1083.65', '1', 'Big' '0', '0', '0', '$1')", MyPos[0], MyPos[1], MyPos[2]);
//************************************************** ********
format(HouseInfo[id][HouseOwner], 24, "%s", PlayerName(HouseInfo[id][HouseOwner]));
HouseInfo[id][HousePickup] = CreatePickup(1272, 1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 0);
HouseInfo[id][HouseLabel] = Create3DTextLabel(LabelStr, -1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 10.0, 0);
//************************************************** ********
mysql_tquery(aHandle, Query, "OnHouseCreated", "i", id); return 1;
}
case 1: // coordonates 2324.53 -1149.54 1050.71 ; interior 12 ; 39
{
HouseInfo[id][HouseType] = 2; HouseInfo[id][InteriorID] = 39;
//************************************************** ********
HouseInfo[id][HouseLevel] = 10; HouseInfo[id][HousePrice] = 0;
HouseInfo[id][HouseID] = id; HouseInfo[id][HouseInterior] = 12;
HouseInfo[id][HouseLocked] = 0; HouseInfo[id][HouseOwned] = 0;
HouseInfo[id][HousePickup] = 1272; HouseInfo[id][HouseVW] = 40;
HouseInfo[id][HousePos][0] = MyPos[0];
HouseInfo[id][HousePos][1] = MyPos[1];
HouseInfo[id][HousePos][2] = MyPos[2];
HouseInfo[id][HouseExist] = 1; HouseInfo[id][HouseRent] = 1;
HouseInfo[id][HouseFridge] = 0; HouseInfo[id][HouseRadio] = 0;
//************************************************** ********
format(Str, sizeof(Str), "Admin %s added a new house (id: %d)", PlayerName(playerid), id), SendMessageToAdmins(Gold, Str);

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Big\n{FFFFFF}Rent: {FF0000}$1", id, ConnectedRenters());

format(Query, sizeof(Query), "INSERT INTO `houses` (`HouseLevel`, `HousePrice`, `HouseID`, `HouseInterior`, `HouseLocked`, `HouseOwned`, `HouseOwner`, `HouseLabel`, `HousePickup`, `HouseVW`, `HousePosX`, `HousePosY`, `HousePosZ`, `ExitPosX`, `ExitPosY`, `ExitPosZ`, `HouseExist`, `HouseType`, `HouseFridge`, `HouseRadio`, `ForSale`, `HouseRent`) VALUES \
('10', '0', '0', '12', '0', '0', 'AdmBot', 'Licitatii in weekent!', '1272', '40', '%f', '%f', '%f', '2324.53', '-1149.54', '1050.71', '1', 'Big' '0', '0', '0', '$1')", MyPos[0], MyPos[1], MyPos[2]);
//************************************************** ********
format(HouseInfo[id][HouseOwner], 24, "%s", PlayerName(HouseInfo[id][HouseOwner]));
HouseInfo[id][HousePickup] = CreatePickup(1272, 1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 0);
HouseInfo[id][HouseLabel] = Create3DTextLabel(LabelStr, -1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 10.0, 0);
//************************************************** ********
mysql_tquery(aHandle, Query, "OnHouseCreated", "i", id); return 1;
}
case 2: // coordonates 225.68 1021.45 1084.02 ; interior 7 ; 40
{
HouseInfo[id][HouseType] = 2; HouseInfo[id][InteriorID] = 40;
//************************************************** ********
HouseInfo[id][HouseLevel] = 10; HouseInfo[id][HousePrice] = 0;
HouseInfo[id][HouseID] = id; HouseInfo[id][HouseInterior] = 7;
HouseInfo[id][HouseLocked] = 0; HouseInfo[id][HouseOwned] = 0;
HouseInfo[id][HousePickup] = 1272; HouseInfo[id][HouseVW] = 41;
HouseInfo[id][HousePos][0] = MyPos[0];
HouseInfo[id][HousePos][1] = MyPos[1];
HouseInfo[id][HousePos][2] = MyPos[2];
HouseInfo[id][HouseExist] = 1; HouseInfo[id][HouseRent] = 1;
HouseInfo[id][HouseFridge] = 0; HouseInfo[id][HouseRadio] = 0;
//************************************************** ********
format(Str, sizeof(Str), "Admin %s added a new house (id: %d)", PlayerName(playerid), id), SendMessageToAdmins(Gold, Str);

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Big\n{FFFFFF}Rent: {FF0000}$1", id, ConnectedRenters());

format(Query, sizeof(Query), "INSERT INTO `houses` (`HouseLevel`, `HousePrice`, `HouseID`, `HouseInterior`, `HouseLocked`, `HouseOwned`, `HouseOwner`, `HouseLabel`, `HousePickup`, `HouseVW`, `HousePosX`, `HousePosY`, `HousePosZ`, `ExitPosX`, `ExitPosY`, `ExitPosZ`, `HouseExist`, `HouseType`, `HouseFridge`, `HouseRadio`, `ForSale`, `HouseRent`) VALUES \
('10', '0', '0', '7', '0', '0', 'AdmBot', 'Licitatii in weekent!', '1272', '41', '%f', '%f', '%f', '225.68', '1021.45', '1084.02', '1', 'Big' '0', '0', '0', '$1')", MyPos[0], MyPos[1], MyPos[2]);
//************************************************** ********
format(HouseInfo[id][HouseOwner], 24, "%s", PlayerName(HouseInfo[id][HouseOwner]));
HouseInfo[id][HousePickup] = CreatePickup(1272, 1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 0);
HouseInfo[id][HouseLabel] = Create3DTextLabel(LabelStr, -1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 10.0, 0);
//************************************************** ********
mysql_tquery(aHandle, Query, "OnHouseCreated", "i", id); return 1;
}
case 3: // coordonates 234.19 1063.73 1084.21 ; interior 6 ; 41
{
HouseInfo[id][HouseType] = 2; HouseInfo[id][InteriorID] = 41;
//************************************************** ********
HouseInfo[id][HouseLevel] = 10; HouseInfo[id][HousePrice] = 0;
HouseInfo[id][HouseID] = id; HouseInfo[id][HouseInterior] = 6;
HouseInfo[id][HouseLocked] = 0; HouseInfo[id][HouseOwned] = 0;
HouseInfo[id][HousePickup] = 1272; HouseInfo[id][HouseVW] = 42;
HouseInfo[id][HousePos][0] = MyPos[0];
HouseInfo[id][HousePos][1] = MyPos[1];
HouseInfo[id][HousePos][2] = MyPos[2];
HouseInfo[id][HouseExist] = 1; HouseInfo[id][HouseRent] = 1;
HouseInfo[id][HouseFridge] = 0; HouseInfo[id][HouseRadio] = 0;
//************************************************** ********
format(Str, sizeof(Str), "Admin %s added a new house (id: %d)", PlayerName(playerid), id), SendMessageToAdmins(Gold, Str);

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Big\n{FFFFFF}Rent: {FF0000}$1", id, ConnectedRenters());

format(Query, sizeof(Query), "INSERT INTO `houses` (`HouseLevel`, `HousePrice`, `HouseID`, `HouseInterior`, `HouseLocked`, `HouseOwned`, `HouseOwner`, `HouseLabel`, `HousePickup`, `HouseVW`, `HousePosX`, `HousePosY`, `HousePosZ`, `ExitPosX`, `ExitPosY`, `ExitPosZ`, `HouseExist`, `HouseType`, `HouseFridge`, `HouseRadio`, `ForSale`, `HouseRent`) VALUES \
('10', '0', '0', '6', '0', '0', 'AdmBot', 'Licitatii in weekent!', '1272', '42', '%f', '%f', '%f', '234.19', '1063.73', '1084.21', '1', 'Big' '0', '0', '0', '$1')", MyPos[0], MyPos[1], MyPos[2]);
//************************************************** ********
format(HouseInfo[id][HouseOwner], 24, "%s", PlayerName(HouseInfo[id][HouseOwner]));
HouseInfo[id][HousePickup] = CreatePickup(1272, 1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 0);
HouseInfo[id][HouseLabel] = Create3DTextLabel(LabelStr, -1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 10.0, 0);
//************************************************** ********
mysql_tquery(aHandle, Query, "OnHouseCreated", "i", id); return 1;
}
case 4: // coordonates 226.30 1114.24 1080.99 ; interior 5 ; 42
{
HouseInfo[id][HouseType] = 2; HouseInfo[id][InteriorID] = 42;
//************************************************** ********
HouseInfo[id][HouseLevel] = 10; HouseInfo[id][HousePrice] = 0;
HouseInfo[id][HouseID] = id; HouseInfo[id][HouseInterior] = 5;
HouseInfo[id][HouseLocked] = 0; HouseInfo[id][HouseOwned] = 0;
HouseInfo[id][HousePickup] = 1272; HouseInfo[id][HouseVW] = 43;
HouseInfo[id][HousePos][0] = MyPos[0];
HouseInfo[id][HousePos][1] = MyPos[1];
HouseInfo[id][HousePos][2] = MyPos[2];
HouseInfo[id][HouseExist] = 1; HouseInfo[id][HouseRent] = 1;
HouseInfo[id][HouseFridge] = 0; HouseInfo[id][HouseRadio] = 0;
//************************************************** ********
format(Str, sizeof(Str), "Admin %s added a new house (id: %d)", PlayerName(playerid), id), SendMessageToAdmins(Gold, Str);

format(LabelStr, sizeof(LabelStr), "{FFFFFF}House {FF0000}%d\n{FF0000}Licitatii in weekend!\n{FFFFFF}Owner: {FF0000}AdmBot\n{FFFFFF}Tenants: {FF0000}%d\n{FFFFFF}Size: {FF0000}Big\n{FFFFFF}Rent: {FF0000}$1", id, ConnectedRenters());

format(Query, sizeof(Query), "INSERT INTO `houses` (`HouseLevel`, `HousePrice`, `HouseID`, `HouseInterior`, `HouseLocked`, `HouseOwned`, `HouseOwner`, `HouseLabel`, `HousePickup`, `HouseVW`, `HousePosX`, `HousePosY`, `HousePosZ`, `ExitPosX`, `ExitPosY`, `ExitPosZ`, `HouseExist`, `HouseType`, `HouseFridge`, `HouseRadio`, `ForSale`, `HouseRent`) VALUES \
('10', '0', '0', '5', '0', '0', 'AdmBot', 'Licitatii in weekent!', '1272', '43', '%f', '%f', '%f', '226.30', '1114.24', '1080.99', '1', 'Big' '0', '0', '0', '$1')", id+1, MyPos[0], MyPos[1], MyPos[2]);
//************************************************** ********
format(HouseInfo[id][HouseOwner], 24, "%s", PlayerName(HouseInfo[id][HouseOwner]));
HouseInfo[id][HousePickup] = CreatePickup(1272, 1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 0);
HouseInfo[id][HouseLabel] = Create3DTextLabel(LabelStr, -1, HouseInfo[id][HousePos][0], HouseInfo[id][HousePos][1], HouseInfo[id][HousePos][2], 10.0, 0);
//************************************************** ********
mysql_tquery(aHandle, Query, "OnHouseCreated", "i", id); return 1;
}
}
}
return 1;
}
else return SendClientMessage(playerid, Grey, "You are not an admin level 5+ to use this command.");
}

It's not complete, but '/createhouse <id> <BIG (2)>' is complete, and i can test
Reply
#6

Holly shit please use [ php] code [ /php] to post your code. But without the space behind the [
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)