AddGCHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Costa, Sella, Interiora, virtualworld)
{
new house[256];
format(house, sizeof(house), "Houses/houseid%d",houseid);
if(!dini_Exists(house))
{
dini_Create(house);
hInfo[houseid][Interior] = Interiora;
dini_IntSet(house, "Interior", Interiora);
dini_IntSet(house, "Virtualworld", virtualworld);
hInfo[houseid][Virtualworld] = virtualworld;
hInfo[houseid][InteriorX] = interiorX;
hInfo[houseid][InteriorY] = interiorY;
hInfo[houseid][InteriorZ] = interiorZ;
dini_FloatSet(house, "X", interiorX);
dini_FloatSet(house, "Y", interiorY);
dini_FloatSet(house, "Z", interiorZ);
print("-");
print("--------------House Created--------------");
printf("- Houseid: %d", houseid);
printf("- Buy Cost: %d", Costa);
printf("- Sell Cost: %d", Sella);
printf("- Interior: %d", Interiora);
printf("- VirtualWorld: %d", virtualworld);
print("-----------------------------------------");
print("-");
}
else
{
hInfo[houseid][Interior] = dini_Int(house, "Interior");
hInfo[houseid][Locked] = dini_Int(house, "Locked");
hInfo[houseid][InteriorX] = dini_Float(house, "X");
hInfo[houseid][InteriorY] = dini_Float(house, "Y");
hInfo[houseid][InteriorZ] = dini_Float(house, "Z");
hInfo[houseid][Virtualworld] = dini_Int(house, "Virtualworld");
}
hInfo[houseid][iconx]=iconX;
hInfo[houseid][icony]=iconY;
hInfo[houseid][iconz]=iconZ;
format(house, sizeof(house), "Houses/houseid%d",houseid);
if(strcmp(hInfo[houseid][Name],"ForSale",true)==0)
{
HousePickup[houseid] = CreatePickup(1273, 23, iconX, iconY, iconZ);//not bought
}
else
{
HousePickup[houseid] = CreatePickup(1272,23, iconX, iconY, iconZ);//bought
}
}
I made a house system |
// whem player enter house or somethin' new Name[32]; // new array 'Name' GetPlayerName(playerid, Name, sizeof(Name); // Get name in array named Name if(strfind(Name, "[GC]", true)) // Search for [GC] in his name. { // Stuff } else { // Another stuff.. }
AddHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Cost, Sell, Interior, Virtualworld);
AddSafeHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Cost, Sell, Interior, Virtualworld);
AddGCHouse(houseid, Float:iconX, Float:iconY, Float:iconZ, Float:interiorX, Float:interiorY, Float:interiorZ, Cost, Sell, Interior, Virtualworld);
dcmd_enter(playerid,params[])
{
#pragma unused params
new str1[255],pname[24],housenumber;
housenumber = GetHouseID(playerid);
GetPlayerPos(playerid, housex, housey, housez);
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
GetPlayerName(playerid, pname, 24);
if(hInfo[housenumber][Locked]==1) return SendClientMessage(playerid, c_r, "This house is locked!");
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
SendClientMessage(playerid, c_y, "You entered the house!");
SetPlayerVirtualWorld(playerid, hInfo[housenumber][Virtualworld]);
SetPlayerInterior(playerid, hInfo[housenumber][Interior]);
SetPlayerPos(playerid, hInfo[housenumber][InteriorX], hInfo[housenumber][InteriorY], hInfo[housenumber][InteriorZ]);
playerinterior[playerid] = hInfo[housenumber][Interior];
return 1;
}