CreateHouse("Bayside Nr.1", 200000, -2348.9600,2422.9646,7.3428, 1.808619,32.384357,1199.593750, 100000, 1);
CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, SellP, Interiorx)
stock CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, Interiorx, SellP) { format(HouseInformation[houseid][Hname], 100, "%s", HouseName); HouseInformation[houseid][costprice] = CostP; HouseInformation[houseid][EnterPos][0] = EnterX; HouseInformation[houseid][EnterPos][1] = EnterY; HouseInformation[houseid][EnterPos][2] = EnterZ; HouseInformation[houseid][TelePos][0] = TeleX; HouseInformation[houseid][TelePos][1] = TeleY; HouseInformation[houseid][TelePos][2] = TeleZ; HouseInformation[houseid][sellprice] = SellP; HouseInformation[houseid][interiors] = Interiorx; format(fquery, sizeof(fquery), "SELECT houseowner FROM HOUSEINFO WHERE housename = '%s'", HouseName); queryresult = db_query(database, fquery); if(db_num_rows(queryresult) != 0) db_get_field_assoc(queryresult, "houseowner", HouseInformation[houseid][owner], 24); HouseInformation[houseid][checkpointidx][0] = CreateDynamicCP(EnterX, EnterY, EnterZ, 1.0); HouseInformation[houseid][checkpointidx][1] = CreateDynamicCP(TeleX, TeleY, TeleZ, 1.0, 15500000+houseid, Interiorx); if(!HouseInformation[houseid][owner][0]) format(fquery, sizeof(fquery), "House Name: %s \n House Price:$%d \n Sell Price: $%d", HouseName, CostP, SellP); else if(HouseInformation[houseid][owner][0] != 0) format(fquery, sizeof(fquery), "House Name: %s \n Owner: %s", HouseName, HouseInformation[houseid][owner]); HouseInformation[houseid][textid] = CreateDynamic3DTextLabel(fquery, 0xFFFFFF, EnterX, EnterY, EnterZ + 0.5, 50.0); houseid ++; return 1; }
forward OnPlayerEnterDynamicCP(playerid, checkpointid); public OnPlayerEnterDynamicCP(playerid, checkpointid) { for(new x; x<houseid; x++) { if(HouseInformation[x][checkpointidx][0] == checkpointid) { if(InHouse[playerid] != -1) { InHouse[playerid] = -1; return 1; } InHouseCP[playerid] = x; new Pname[24]; GetPlayerName(playerid, Pname, 24); if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0])) { SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]); SetPlayerInterior(playerid, HouseInformation[x][interiors]); SetPlayerVirtualWorld(playerid, 15500000 + x); } if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!"); return 1; } if(HouseInformation[x][checkpointidx][1] == checkpointid) { if(InHouse[playerid] == -1) { InHouse[playerid] = x; return 1; } SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); return 1; } } return 1; }
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for(new x; x<houseid; x++)
{
if(HouseInformation[x][checkpointidx][0] == checkpointid)
{
if(InHouse[playerid] != -1)
{
InHouse[playerid] = -1;
return 1;
}
InHouseCP[playerid] = x;
new Pname[24];
GetPlayerName(playerid, Pname, 24);
if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
{
SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
SetPlayerInterior(playerid, HouseInformation[x][interiors]);
printf("Interior: %d", HouseInformation[x][interiors]); // <<<<<
SetPlayerVirtualWorld(playerid, 15500000 + x);
}
if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
return 1;
}
if(HouseInformation[x][checkpointidx][1] == checkpointid)
{
if(InHouse[playerid] == -1)
{
InHouse[playerid] = x;
return 1;
}
SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
}
return 1;
}
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
for(new x; x<houseid; x++)
{
if(HouseInformation[x][checkpointidx][0] == checkpointid)
{
if(InHouse[playerid] != -1)
{
InHouse[playerid] = -1;
return 1;
}
InHouseCP[playerid] = x;
new Pname[24];
GetPlayerName(playerid, Pname, 24);
if(HouseInformation[x][owner][0] != 0 && !strcmp(Pname, HouseInformation[x][owner][0]))
{
SetPlayerPos(playerid, HouseInformation[x][TelePos][0], HouseInformation[x][TelePos][1], HouseInformation[x][TelePos][2]);
SetPlayerInterior(playerid, HouseInformation[x][interiors]);
new debugStr[214];
new myIntr;
myIntr = GetPlayerInterior(playerid);
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
SendClientMessage(playerid, 0xFF0000FF, debugStr);
SetPlayerVirtualWorld(playerid, 15500000 + x);
}
if(!HouseInformation[x][owner][0]) SendClientMessage(playerid, -1, "This house is for sale /buy to buy it!");
return 1;
}
if(HouseInformation[x][checkpointidx][1] == checkpointid)
{
if(InHouse[playerid] == -1)
{
InHouse[playerid] = x;
return 1;
}
SetPlayerPos(playerid, HouseInformation[x][EnterPos][0], HouseInformation[x][EnterPos][1], HouseInformation[x][EnterPos][2]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
}
return 1;
}
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
Error
Код:
format(debugStr, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr); |
format(debugStr, 214, "DEBUG: entered interior: %d (my current interior: %d)", HouseInformation[x][interiors], myIntr);
database = db_open(databasename); db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))");
I dont really understand lite that much.
Код:
database = db_open(databasename); db_query(database, "CREATE TABLE IF NOT EXISTS `HOUSEINFO` (housename varchar(51), houseowner varchar(25))"); |