{help} pickups
#1

#include <a_samp>
#include <dudb>
#include <dini>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//----------------------------
//----------------------------
// Full house script by Antironix!
// Just don't remove the credits!
//----------------------------
//----------------------------
#define MAX_DISTANCE_TO_PROP 1.5
#define MAX_HOUSES 100
#define MAX_RENTCOST 1000
#define MIN_RENTCOST 500
#define MAX_BUY_CARS 8
#define CAR_DELIVER_TIME 1 //The time that it takes that your car will be delivered. In hours.

//buyable cars
enum CarInfo {CarModel,CarName[24],CarCost};
new Buyable_Cars[MAX_BUY_CARS][CarInfo] =
{ //Modelid, Buy Name, Price
{411,"Infernus",0},
{522,"NRG-500",50000},
{451,"Turismo",50000},
{541,"Bullet",50000},
{415,"Cheetah",50000},
{429,"Banshee",50000},
{494,"Hotring",50000},
{556,"Monster",50000}
};
//----------------------------
//----------------------------
#define c_y 0xFFFF00AA
#define c_r 0xAA3333AA
new HousePickup[MAX_HOUSES];
new playerinterior[MAX_PLAYERS]=-1;
new Float:housex, Float:housey, Float:housez;
new housemapicon[MAX_PLAYERS];
new playerworld[MAX_PLAYERS];
new bool:KillVeh[MAX_VEHICLES] = false;
forward rentfee();
forward newcar();
forward KillVehicle(carid);

enum HouseInfo
{
Name[24],
Renter[24],
Rentable,
Rentcost,
Cost,
Sell,
Interior,
Virtualworld,
Locked,
Float:InteriorX,
Float:InteriorY,
Float:InteriorZ,
Float:iconx,
Float:icony,
Float:iconz,
Rentfee
}
new hInfo[MAX_HOUSES][HouseInfo];

enum HouseCarInfo
{
HouseCar,
GotCar,
Houseid,
CarModel,
Float:CarX,
Float:CarY,
Float:CarZ,
CarColor1,
CarColor2,
Respawn_Delay,
NewCar
}
new cInfo[MAX_HOUSES][HouseCarInfo];

#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Simple House System by Antironix");
print("--------------------------------------\n");
AddHouse(0, 1442.9769,-629.5287,95.7186, 2317.8201,-1024.7500,1050.2109, 0, 0, 9, 0);
AddHouse(1, 1980.9896,-1719.0171,17.0304, 328.1465,-1478.4457,1084.4375, 0, 0, 15, 0);
AddHouse(3, 2207.5793,-1100.8376,31.5547, 2535.83,-1674.32,1015.50, 1000, 1000, 1, 0);
AddHouse(4, 2145.4905,-1085.0579,24.7751, 2260.76,-1210.45,1049.02, 1000, 1000, 10, 0);
AddHouse(5, 2140.4553,-1082.8198,24.6936, 2262.83,-1137.71,1050.63, 1000, 1000, 10, 0);
AddHouse(6, 2099.7051,-1052.0504,28.4995, 2365.42,-1131.85,1050.88, 1000, 1000, 9, 0);
AddHouse(8, 2209.4075,-1151.2382,29.7969, 262.7553,-47.821197,1002.130981,0,0,2,0);
AddHouseCar(1, 429, 1975.3328,-1709.8126,15.9688, 0, 0, 5*60*1000);//5 min respawn delay
SetTimer("rentfee", 1*60*60*1000, 1);//1 hour
SetTimer("newcar", CAR_DELIVER_TIME*60*10*1000,1);//1 hour
return 0;
}

public OnFilterScriptExit()
{
for(new i=0;i<MAX_HOUSES;i++)
{
DestroyPickup(HousePickup[i]);
DestroyVehicle(cInfo[i][HouseCar]);
}
return 0;
}

#else
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(buy,3,cmdtext);
dcmd(sell,4,cmdtext);
dcmd(enter,5,cmdtext);
dcmd(exit,4,cmdtext);
dcmd(lock,4,cmdtext);
dcmd(unlock,6,cmdtext);
dcmd(home,4,cmdtext);
dcmd(setrent,7,cmdtext);
dcmd(rent,4,cmdtext);
dcmd(unrent,6,cmdtext);
dcmd(house,5,cmdtext);
dcmd(housestats,10,cmdtext);
dcmd(getrent,7,cmdtext);
dcmd(payrent,7,cmdtext);
dcmd(ordercar,8,cmdtext);
return 0;
}
Reply
#2

AddHouse(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);
format(hInfo[houseid][Name], 24, "ForSale");
dini_Set(house, "Name", "ForSale");
format(hInfo[houseid][Renter], 24, "ForRent");
dini_Set(house, "Renter", "ForRent");
hInfo[houseid][Rentable] = 0;
dini_IntSet(house, "Rentable", 0);
hInfo[houseid][Rentcost] = 0;
dini_IntSet(house, "Rentcost", 0);
hInfo[houseid][Cost] = Costa;
dini_IntSet(house, "Cost", Costa);
hInfo[houseid][Sell] = Sella;
dini_IntSet(house, "Sell", Sella);
hInfo[houseid][Interior] = Interiora;
dini_IntSet(house, "Interior", Interiora);
dini_IntSet(house, "Virtualworld", virtualworld);
hInfo[houseid][Virtualworld] = virtualworld;
hInfo[houseid][Locked] = 1;
dini_IntSet(house, "Locked", 1);
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);
dini_IntSet(house, "RentPay", 0);
dini_IntSet(house, "RentGet", 0);
cInfo[houseid][HouseCar] = 429;
dini_IntSet(house, "HouseCar", 0);
cInfo[houseid][CarModel] = 429;
dini_IntSet(house, "CarModel", 0);
cInfo[houseid][CarX] = 0;
cInfo[houseid][CarY] = 0;
cInfo[houseid][CarZ] = 0;
dini_FloatSet(house, "CarX", 0);
dini_FloatSet(house, "CarY", 0);
dini_FloatSet(house, "CarZ", 0);
cInfo[houseid][CarColor1] = 0;
cInfo[houseid][CarColor2] = 0;
dini_IntSet(house, "CarColor1", 0);
dini_IntSet(house, "CarColor2", 0);
cInfo[houseid][GotCar] = 0;
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
{
format(hInfo[houseid][Name], 24, dini_Get(house, "Name"));
format(hInfo[houseid][Renter], 24, dini_Get(house, "Renter"));
hInfo[houseid][Rentable] = dini_Int(house, "Rentable");
hInfo[houseid][Rentcost] = dini_Int(house, "Rentcost");
hInfo[houseid][Cost] = dini_Int(house, "Cost");
hInfo[houseid][Sell] = dini_Int(house, "Sell");
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");
}
Reply
#3

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
}
}

AddHouseCar(houseid, modelid, Float:Carx, Float:Cary, Float:Carz, color1, color2, respawn_delay)
{
new house[256];
format(house, sizeof(house), "Houses/houseid%d",houseid);
if(dini_Exists(house))
{
cInfo[houseid][GotCar] = 1;
if(dini_Int(house, "CarModel")==0)
{
dini_IntSet(house, "CarModel", modelid);
cInfo[houseid][CarModel] = modelid;
cInfo[houseid][CarX] = Carx;
cInfo[houseid][CarY] = Cary;
cInfo[houseid][CarZ] = Carz;
dini_FloatSet(house, "CarX", Carx);
dini_FloatSet(house, "CarY", Cary);
dini_FloatSet(house, "CarZ", Carz);
cInfo[houseid][CarColor1] = color1;
cInfo[houseid][CarColor2] = color2;
dini_IntSet(house, "CarColor1", color1);
dini_IntSet(house, "CarColor2", color2);
dini_IntSet(house, "Respawn_Delay", respawn_delay);
cInfo[houseid][Respawn_Delay] = respawn_delay;
cInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);
print("-");
print("--------------Car Created--------------");
printf("- Car Houseid: %d", houseid);
printf("- Modelid: %d", modelid);
printf("- Color 1: %d", color1);
printf("- Color 2: %d", color2);
printf("- Respawn Delay: %d", respawn_delay);
print("---------------------------------------");
print("-");
}
else
{
cInfo[houseid][CarModel] = dini_Int(house, "CarModel");
}
cInfo[houseid][CarX] = dini_Int(house, "CarX");
cInfo[houseid][CarY] = dini_Int(house, "CarY");
cInfo[houseid][CarZ] = dini_Int(house, "CarZ");
cInfo[houseid][CarColor1] = dini_Int(house, "CarColor1");
cInfo[houseid][CarColor2] = dini_Int(house, "CarColor2");
cInfo[houseid][Respawn_Delay] = dini_Int(house, "Respawn_Delay");
cInfo[houseid][HouseCar] = CreateVehicle(cInfo[houseid][CarModel], Carx, Cary, Carz, 0.0, color1, color2, respawn_delay);
}
}

stock SpawnPlayerAtHouse(playerid)
{
new str1[256],pname[24],str[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (dini_Exists(str1))
{
if(dini_Int(str1,"Houseid")!=-255)
{
new Float,Float:y,Float:z;
str = dini_Get(str1,"SpawnInt");
SetPlayerInterior(playerid, strval(str));
playerinterior[playerid] = strval(str);
x = dini_Float(str1,"SpawnX");
y = dini_Float(str1,"SpawnY");
z = dini_Float(str1,"SpawnZ");
SetPlayerPos(playerid, x, y, z);
}
}
return 1;
}
Reply
#4

public OnPlayerSpawn(playerid)
{
SpawnPlayerAtHouse(playerid);
}

stock GetHouseStats(playerid, hid)
{
new str2[256];
format(str2, sizeof(str2), "Owned by: %s", hInfo[hid][Name]);
SendClientMessage(playerid, c_y, str2);
if(strcmp(hInfo[hid][Renter],"ForRent",true))
{
format(str2, sizeof(str2), "Rented by: %s", hInfo[hid][Renter]);
SendClientMessage(playerid, c_y, str2);
}
format(str2,sizeof(str2),"Cost: %i",hInfo[hid][Cost]);
SendClientMessage(playerid, c_y, str2);
}

dcmd_sell(playerid,params[])
{
#pragma unused params
new str[255],str1[256],pname[24],housenumber;
housenumber = GetHouseID(playerid);
GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
if (strcmp(hInfo[housenumber][Name],pname,false)) return SendClientMessage(playerid, c_r, "This house isn't yours!");
SendClientMessage(playerid, c_y, "You have sold your house!");
format(str, sizeof(str), "%s has sold houseid 0",pname);
print(str);
GivePlayerMoney(playerid, hInfo[housenumber][Sell]);
dini_Set(str1, "Name", "ForSale");
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",1);
format(hInfo[housenumber][Name],255,"ForSale");
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
dini_IntSet(str1, "Houseid", -255);
DestroyPickup(HousePickup[housenumber]);
HousePickup[housenumber] = CreatePickup(1273, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
RemovePlayerMapIcon(playerid, housemapicon[playerid]);
return 1;
}

dcmd_buy(playerid,params[])
{
#pragma unused params
new str[255],str1[255],pname[24], housenumber;
housenumber = GetHouseID(playerid);
if(housenumber == -1) return SendClientMessage(playerid, c_r, "You are not in a house icon!");

GetPlayerName(playerid, pname, 24);
format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if(dini_Exists(str1))
{
if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, c_r, "You can only buy one house!");
}
format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, c_r, "This house isn't for sale!");
if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, c_r, "Not enough money!");
SendClientMessage(playerid, c_y, "You have bought the house!");
format(str, sizeof(str), "%s has bought houseid 0",pname);
print(str);
GivePlayerMoney(playerid, -hInfo[housenumber][Cost]);
dini_Set(str1, "Name", pname);
hInfo[housenumber][Name]=pname;
hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);

format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
if (!dini_Exists(str1)) dini_Create(str1);
new Floaty, Floatx, Floatz;
dini_IntSet(str1, "Houseid", housenumber);
if(!dini_Isset(str1,"Rentid"))
{
dini_IntSet(str1, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(str1, "SpawnX", sx);
dini_FloatSet(str1, "SpawnY", sy);
dini_FloatSet(str1, "SpawnZ", sz);
dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
DestroyPickup(HousePickup[housenumber]);
HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
return 1;
}
Reply
#5

This is most of the stript im using this isnt mine it is ahouse but my pickups wont show up for some reason i go to the house but they wont show up plus buy sell and stuff wont work plz help me with this
Reply
#6

dont bump next time use pastebin
Reply
#7

i didnt bump ot you would acully stop and think my script thing is 2 big for 1 post
Reply
#8

anhone help plz i can put in hoouses
Reply
#9

bump
Reply
#10

why did you post all of your script in like 4 posts. You would be better off posting your code in Pastebin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)