Well, I was lurking around with scripting and scripted a filterscript. It is a Dynamic House system. Hope you like it:
Features:
- Totally Dynamic + MYSQL R41
- Drugs storage
- Money storage
-- I did this in one day btw, so any errors please tell me, i didnt find any bug btw.
CMDS:
- /ahouse - for admin to create or edit house
- /house for the owner
I havent took screenshots and its just simple so no ss:
AND I know ppl will say this is same thing others have posted so yeah maybe but this is basic for someone to learn or Maybe I myself will learn by posting here.
Criticism is highly appreciated.
CODE: (Pastenbin is dead)
Features:
- Totally Dynamic + MYSQL R41
- Drugs storage
- Money storage
-- I did this in one day btw, so any errors please tell me, i didnt find any bug btw.
CMDS:
- /ahouse - for admin to create or edit house
- /house for the owner
I havent took screenshots and its just simple so no ss:
AND I know ppl will say this is same thing others have posted so yeah maybe but this is basic for someone to learn or Maybe I myself will learn by posting here.
Criticism is highly appreciated.
CODE: (Pastenbin is dead)
PHP Code:
#define FILTERSCRIPT
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <a_zones>
new MySQL:MySQL;
#define mysql_host "localhost"
#define mysql_user "root"
#define mysql_password ""
#define mysql_database "lvrporiginal"
#define MAX_HOUSES 200
#define DRUGS_TYPES 3
#define HOUSE_WEAPON_SLOTS 2
#define PUBLIC:%0(%1) forward %0(%1); public %0(%1)
#define COLOR_GREY 0x5D5D5DFF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_BLACK 0x000000FF
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x33AA33AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_SUCCESS 0x33AA33AA
// macros
#define CANT_USE_CMD "You are not allowed to use this cmd."
#define PNF "Player is not connected"
RPName(playerid)
{
new pname[24];
format(pname, 24, NoUnderscore(GetName(playerid)));
return pname;
}
enum pDatais
{
Admin,
pDrugs[DRUGS_TYPES],
Money,
}
new pData[MAX_PLAYERS][pDatais];
enum HouseData
{
hOwner[24],
Float:hX,
Float:hY,
Float:hZ,
hInt,
hVW,
hAlarm,
hMoney,
hInteriorPack,
hPickupID,
Text3D:hLabel,
hActive,
hLocked,
hSell,
hSafe,
hDrugs [DRUGS_TYPES],
hGuns [HOUSE_WEAPON_SLOTS],
hAmmo [HOUSE_WEAPON_SLOTS],
}
new hData[MAX_HOUSES][HouseData];
enum
{
DRUG_COCAINE,
DRUG_CANNABIS,
DRUG_HEROIN,
}
enum drugstypes
{
drugid, // id
drugname[24], // name
drugprice, // Drug dealer has to buy for
drughp, // health ++
}
new DrugData[DRUGS_TYPES][drugstypes] = {
{DRUG_CANNABIS, "Cannabis", 100, 20}, // 0
{DRUG_COCAINE, "Cocaine", 100, 30}, // 1
{DRUG_HEROIN, "Heroin", 100, 40} // 2
};
enum _Interiors {
hintpack,
Float:hintx,
Float:hinty,
Float:hintz,
hinterior,
hvirtual,
hprice,
}
new HouseInteriors[][_Interiors] = {
// intpack x y z int vw price
{0, 445.04, 508.86, 1001.42, 12, 2, 0 },
{1, 2807.62, -1171.90, 1025.57, 8, 15, 100000},
{2, 27.13, 1341.15, 1084.38, 10, 20, 100000},
{3, 2333.11, -1075.10, 1049.02, 6, 17, 100000},
{4, 261.00, 1286.00, 1080.2600, 4, 1, 100000},
{5, 2350.34, -1181.65, 1027.98, 5, 16, 100000},
{6, 2268.39, -1210.45, 1047.75, 10, 18, 100000},
{7, 318.57, 1118.21, 1083.88, 5, 19, 100000},
{8, 219.34, 1251.26, 1082.15, 2, 4, 100000},
{9, 295.34, 1473.09, 1080.26, 15, 3, 100000},
{10, 447.73, 1400.44, 1084.30, 2, 8, 100000},
{11, 2282.91, -1138.29, 1050.90, 11, 14, 100000},
{12, 83.30, 1324.70, 1083.86, 9, 11, 100000},
{13, 2194.79, -1204.35, 1049.02, 6, 12, 100000},
{14, 2365.30, -1132.92, 1050.88, 8, 13, 100000},
{15, 227.72, 1114.39, 1080.99, 5, 9, 100000},
{16, 225.74, 1024.54, 1084.00, 7, 10, 100000},
{17, 1261.4819, -785.4633, 1091.9063, 9, 11, 100000}
};
enum
{
DIALOG_ADMIN_HOUSE,
DIALOG_ADMIN_HOUSE_OWNER,
DIALOG_ADMIN_HOUSE_SELL,
DIALOG_ADMIN_HOUSE_INT,
DIALOG_ADMIN_HOUSE_MONEY,
DIALOG_PLAYER_HOUSE_OUT,
DIALOG_PLAYER_HOUSE_SELL,
DIALOG_PLAYER_HOUSE_ALARM,
DIALOG_PLAYER_HOUSE_INT,
DIALOG_PLAYER_HOUSE,
DIALOG_PLAYER_HOUSE_IN,
DIALOG_HOUSE_IN_SAFE,
DIALOG_HOUSE_IN_MONEY,
DIALOG_HOUSE_IN_DRUGS,
DIALOG_HOUSE_IN_GUNS,
DIALOG_HOUSE_MONEY_TAKE,
DIALOG_HOUSE_MONEY_PUT,
DIALOG_HOUSE_DRUGS_TAKE,
DIALOG_HOUSE_DRUGS_PUT,
DIALOG_HOUSE_GUNS_TAKE,
DIALOG_HOUSE_GUNS_PUT,
DIALOG_HOUSE_DRUGS_TAKE0,
DIALOG_HOUSE_DRUGS_TAKE1,
DIALOG_HOUSE_DRUGS_TAKE2,
DIALOG_HOUSE_DRUGS_PUT0,
DIALOG_HOUSE_DRUGS_PUT1,
DIALOG_HOUSE_DRUGS_PUT2,
}
public OnFilterScriptInit()
{
MySQL = mysql_connect(mysql_host, mysql_user, mysql_password, mysql_database);
if(mysql_errno() == 0)
{
print("================================================================");
print(" MySQL has successfully connected to the database ");
print("================================================================");
}
else
{
print("================================================================");
print(" MySQL has FAILED!!! to connect to the database ");
print("================================================================");
SendRconCommand("exit");
}
LoadHouses();
}
LoadHouses()
{
mysql_tquery(MySQL, "SELECT * FROM `housedata`", "OnLoadHouses");
}
PUBLIC:OnLoadHouses()
{
if(cache_num_rows())
{
new hid;
for(new i = 0; i < cache_num_rows(); i++)
{
cache_get_value_name_int(i, "SQLID", hid);
cache_get_value_name(i, "Owner", hData[hid][hOwner]);
cache_get_value_name_float(i, "hX", hData[hid][hX]);
cache_get_value_name_float(i, "hY", hData[hid][hY]);
cache_get_value_name_float(i, "hZ", hData[hid][hZ]);
cache_get_value_name_int(i, "hInt", hData[hid][hInt]);
cache_get_value_name_int(i, "hVW", hData[hid][hVW]);
cache_get_value_name_int(i, "hAlarm", hData[hid][hAlarm]);
cache_get_value_name_int(i, "hMoney", hData[hid][hMoney]);
cache_get_value_name_int(i, "hInteriorPack", hData[hid][hInteriorPack]);
cache_get_value_name_int(i, "hLocked", hData[hid][hLocked]);
cache_get_value_name_int(i, "hSell", hData[hid][hSell]);
cache_get_value_name_int(i, "hSafe", hData[hid][hSafe]);
new iGet[256];
cache_get_value_name(i, "hDrugs", iGet);
new iP[35];
strcat(iP, "p<,>");
for(new drugID = 0; drugID < sizeof(DrugData); drugID++) strcat(iP, "i");
sscanf(iGet, iP, hData[hid][hDrugs][0], hData[hid][hDrugs][1], hData[hid][hDrugs][2]);
cache_get_value_name(i, "hGuns", iGet);
new iPP[35];
strcat(iPP, "p<,>");
for(new gunID = 0; gunID < HOUSE_WEAPON_SLOTS; gunID++) strcat(iPP, "i");
sscanf(iGet, iPP, hData[hid][hGuns][0], hData[hid][hGuns][1]);
cache_get_value_name(i, "hAmmo", iGet);
new iPPP[35];
strcat(iPPP, "p<,>");
for(new ammoID = 0; ammoID < HOUSE_WEAPON_SLOTS; ammoID++) strcat(iPPP, "i");
sscanf(iGet, iPPP, hData[hid][hAmmo][0], hData[hid][hAmmo][1]);
hData[hid][hActive] = 1;
hData[hid][hPickupID] = CreateDynamicPickup(1273, 23, hData[hid][hX], hData[hid][hY], hData[hid][hZ], hData[hid][hVW], hData[hid][hInt], -1, 100.0);
new string[512], zone[48];
GetZone(hData[hid][hX], hData[hid][hY], hData[hid][hZ], zone);
if(hData[hid][hSell] < 1) format(string,sizeof(string),"Owner: %s\nAddress: %s, %d",NoUnderscore(hData[hid][hOwner]),zone,hid);
else format(string,sizeof(string),"Owner: %s\nAddress: %s %d\nPrice: $%d (/buyhouse to buy)",NoUnderscore(hData[hid][hOwner]),zone,hid, hData[hid][hSell]);
hData[hid][hLabel] = CreateDynamic3DTextLabel(string, -1, hData[hid][hX], hData[hid][hY], hData[hid][hZ], 20, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 5);
}
}
}
InsertHouse(hid)
{
new mQuery[800];
mysql_format(MySQL, mQuery, 800, "INSERT INTO `housedata` (`SQLID`, `Owner`, `hX`, `hY`, `hZ`, `hInt`, `hVW`, \
`hAlarm`, `hMoney`, `hInteriorPack`, `hLocked`, `hSell`, `hSafe`, `hDrugs`, `hGuns`, `hAmmo`) VALUES ('%i', '%s', '%f', '%f', '%f', '%i', '%i', \
'%i', '%i', '%i', '%i', '%i', '%i', '%e', '%e', '%e')", hid, hData[hid][hOwner], hData[hid][hX], hData[hid][hY], hData[hid][hZ], hData[hid][hInt], hData[hid][hVW], hData[hid][hAlarm], hData[hid][hMoney], hData[hid][hInteriorPack], hData[hid][hLocked], hData[hid][hSell],
hData[hid][hSafe], "0,0,0", "0,0", "0,0");
mysql_tquery(MySQL, mQuery);
}
SaveHouse(hid)
{
new iString[ 50 ], tmp[ 10 ];
new iString2[ 50 ], tmp2[ 10 ];
new iString3[ 50 ], tmp3[ 10 ];
for(new c = 0; c < DRUGS_TYPES; c++)
{
format(tmp,sizeof(tmp),"%d,", hData[hid][hDrugs][c]);
strcat(iString,tmp);
}
strdel(iString, strlen(iString)-1, strlen(iString));
for(new c = 0; c < HOUSE_WEAPON_SLOTS; c++)
{
format(tmp2,sizeof(tmp2),"%d,", hData[hid][hGuns][c]);
strcat(iString2,tmp2);
}
strdel(iString2, strlen(iString2)-1, strlen(iString2));
for(new c = 0; c < HOUSE_WEAPON_SLOTS; c++)
{
format(tmp3,sizeof(tmp3),"%d,", hData[hid][hAmmo][c]);
strcat(iString3,tmp3);
}
strdel(iString3, strlen(iString3)-1, strlen(iString3));
new mQuery[800];
mysql_format(MySQL, mQuery, 800, "UPDATE `housedata` SET `Owner` = '%e', `hX` = '%f', `hY` = '%f', `hZ`= '%f', `hInt` = '%i', `hVW` = '%i', \
`hAlarm` = '%i', `hMoney`= '%i', `hInteriorPack`= '%i', `hLocked`= '%i', `hSell`= '%i', hDrugs = '%e', `hGuns` = '%e', `hAmmo` = '%e', `hSafe` = '%i' WHERE `SQLID` = '%i'", hData[hid][hOwner], hData[hid][hX], hData[hid][hY], hData[hid][hZ], hData[hid][hInt], hData[hid][hVW],
hData[hid][hAlarm], hData[hid][hMoney], hData[hid][hInteriorPack], hData[hid][hLocked], hData[hid][hSell], iString, iString2, iString3, hData[hid][hSafe], hid);
mysql_tquery(MySQL, mQuery);
}
PUBLIC:SaveHouses()
{
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] != 1) continue;
SaveHouse(i);
}
}
DeleteHouse(hid)
{
DestroyDynamicPickup(hData[hid][hPickupID]);
DestroyDynamic3DTextLabel(hData[hid][hLabel]);
hData[hid][hActive] = 0;
new mQuery[256];
mysql_format(MySQL, mQuery, 256, "DELETE FROM `housedata` WHERE SQLID = '%i'", hid);
mysql_tquery(MySQL, mQuery);
}
ReloadHouse(hid)
{
SaveHouse(hid);
DestroyDynamicPickup(hData[hid][hPickupID]);
DestroyDynamic3DTextLabel(hData[hid][hLabel]);
hData[hid][hActive] = 0;
new mQuery[256];
mysql_format(MySQL, mQuery, 256, "SELECT * FROM `housedata` WHERE `SQLID` = '%i' LIMIT 1", hid);
mysql_tquery(MySQL, mQuery, "OnReloadHouse", "i", hid);
}
PUBLIC:OnReloadHouse(hid)
{
if(cache_num_rows())
{
cache_get_value_name(0, "Owner", hData[hid][hOwner]);
cache_get_value_name_float(0, "hX", hData[hid][hX]);
cache_get_value_name_float(0, "hY", hData[hid][hY]);
cache_get_value_name_float(0, "hZ", hData[hid][hZ]);
cache_get_value_name_int(0, "hInt", hData[hid][hInt]);
cache_get_value_name_int(0, "hVW", hData[hid][hVW]);
cache_get_value_name_int(0, "hAlarm", hData[hid][hAlarm]);
cache_get_value_name_int(0, "hMoney", hData[hid][hMoney]);
cache_get_value_name_int(0, "hInteriorPack", hData[hid][hInteriorPack]);
cache_get_value_name_int(0, "hLocked", hData[hid][hLocked]);
cache_get_value_name_int(0, "hSell", hData[hid][hSell]);
cache_get_value_name_int(0, "hSafe", hData[hid][hSafe]);
new iGet[256];
cache_get_value_name(0, "hDrugs", iGet);
new iP[35];
strcat(iP, "p<,>");
for(new drugID = 0; drugID < sizeof(DrugData); drugID++) strcat(iP, "i");
sscanf(iGet, iP, hData[hid][hDrugs][0], hData[hid][hDrugs][1], hData[hid][hDrugs][2]);
cache_get_value_name(0, "hGuns", iGet);
new iPP[35];
strcat(iPP, "p<,>");
for(new gunID = 0; gunID < HOUSE_WEAPON_SLOTS; gunID++) strcat(iPP, "i");
sscanf(iGet, iPP, hData[hid][hGuns][0], hData[hid][hGuns][1]);
cache_get_value_name(0, "hAmmo", iGet);
new iPPP[35];
strcat(iPPP, "p<,>");
for(new ammoID = 0; ammoID < HOUSE_WEAPON_SLOTS; ammoID++) strcat(iPPP, "i");
sscanf(iGet, iPPP, hData[hid][hAmmo][0], hData[hid][hAmmo][1]);
hData[hid][hActive] = 1;
hData[hid][hPickupID] = CreateDynamicPickup(1273, 23, hData[hid][hX], hData[hid][hY], hData[hid][hZ], hData[hid][hVW], hData[hid][hInt], -1, 100.0);
new string[512], zone[48];
GetZone(hData[hid][hX], hData[hid][hY], hData[hid][hZ], zone);
if(hData[hid][hSell] < 1) format(string,sizeof(string),"Owner: %s\nAddress: %s, %d",NoUnderscore(hData[hid][hOwner]),zone,hid);
else format(string,sizeof(string),"Owner: %s\nAddress: %s %d\nPrice: $%d (/buyhouse to buy)",NoUnderscore(hData[hid][hOwner]),zone,hid, hData[hid][hSell]);
hData[hid][hLabel] = CreateDynamic3DTextLabel(string, -1, hData[hid][hX], hData[hid][hY], hData[hid][hZ], 20, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 5);
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & 16 && !IsPlayerInAnyVehicle(playerid))
{
EnteringHouse(playerid);
ExitingHouse(playerid);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ADMIN_HOUSE:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(listitem == 0) // owner
{
ShowPlayerDialog(playerid, DIALOG_ADMIN_HOUSE_OWNER, DIALOG_STYLE_INPUT, "House Owner", "Please enter the Owner Name you want to set:", "Enter", "Quit");
}
if(listitem == 1) // interior
{
ShowPlayerDialog(playerid, DIALOG_ADMIN_HOUSE_INT, DIALOG_STYLE_INPUT, "House Interior", "Please enter the Interior Pack (0-16) you want to set:", "Enter", "Quit");
}
if(listitem == 2) // alarm
{
if(hData[hid][hAlarm] == 0)
{
hData[hid][hAlarm] = 1;
SendClientSuccess(playerid, "Added alarm to the house successfully.");
}
else
{
hData[hid][hAlarm] = 0;
SendClientSuccess(playerid, "Removed alarm from the house successfully.");
}
}
if(listitem == 3) // money
{
ShowPlayerDialog(playerid, DIALOG_ADMIN_HOUSE_MONEY, DIALOG_STYLE_INPUT, "House Money", "Please enter the amount you want to set:", "Enter", "Quit");
}
if(listitem == 4) // locked
{
if(hData[hid][hLocked] == 0)
{
hData[hid][hLocked] = 1;
SendClientSuccess(playerid, "Locked the house successfully.");
}
else
{
hData[hid][hLocked] = 0;
SendClientSuccess(playerid, "Unlocked the house successfully.");
}
}
if(listitem == 5) // sell
{
ShowPlayerDialog(playerid, DIALOG_ADMIN_HOUSE_SELL, DIALOG_STYLE_INPUT, "Sell House", "Please enter the amount you want to sell for:", "Enter", "Quit");
}
if(listitem == 6) // save
{
SaveHouse(hid);
SendClientSuccess(playerid, "Saved the house successfully.");
}
if(listitem == 7) // reload
{
ReloadHouse(hid);
SendClientSuccess(playerid, "Reloaded the house successfull.");
}
if(listitem == 8) // delete
{
DeleteHouse(hid);
SendClientSuccess(playerid, "Deleted the house successfully.");
}
}
}
case DIALOG_ADMIN_HOUSE_OWNER:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(!strlen(inputtext)) return SendClientError(playerid, "Please type the name of owner you want to set.");
format(hData[hid][hOwner], 24, inputtext);
SendClientSuccess(playerid, "Changed the owner successfully.");
}
}
case DIALOG_ADMIN_HOUSE_INT:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(!strlen(inputtext)) return SendClientError(playerid, "Please type the interior pack you want to set.");
if(!IsNumeric(inputtext) || strval(inputtext) < 0 || strval(inputtext) > 17) return SendClientError(playerid, "Only 0-16 Packs allowed.");
hData[hid][hInteriorPack] = strval(inputtext);
SendClientSuccess(playerid, "Changed the interior successfully.");
}
}
case DIALOG_ADMIN_HOUSE_MONEY:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(!strlen(inputtext)) return SendClientError(playerid, "Please enter the amount you want to set.");
if(!IsNumeric(inputtext) || strval(inputtext) < 0) return SendClientError(playerid, "Please type the AMOUNT you want to set.");
hData[hid][hMoney] = strval(inputtext);
SendClientSuccess(playerid, "Changed the money successfully.");
}
}
case DIALOG_ADMIN_HOUSE_SELL:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(!strlen(inputtext)) return SendClientError(playerid, "Please enter the amount you want to sell for.");
if(!IsNumeric(inputtext) || strval(inputtext) < 0) return SendClientError(playerid, "Please type the AMOUNT you want to sell for.");
hData[hid][hSell] = strval(inputtext);
SendClientSuccess(playerid, "Changed the SALE PRICE successfully.");
}
}
case DIALOG_PLAYER_HOUSE_OUT:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(listitem == 0) // sell
{
ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE_SELL, DIALOG_STYLE_INPUT, "Sell House", "Please enter the amount you want to sell for:", "Enter", "Quit");
}
if(listitem == 1) // upgrade
{
new mstr[256], tmpr[256];
format(mstr, 256, "%i\tLevel %i\t$%i", 0, HouseInteriors[0][hintpack], HouseInteriors[0][hprice]);
for(new i = 1; i < sizeof(HouseInteriors); i++)
{
format(tmpr, 256, "%i\tLevel %i\t$%i", i, HouseInteriors[i][hintpack], HouseInteriors[i][hprice]);
strcat(mstr, tmpr);
}
ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE_INT, DIALOG_STYLE_TABLIST, "House Upgrade Interior", mstr, "OK", "Exit");
}
if(listitem == 2) // alarm
{
if(hData[hid][hAlarm] != 0) return SendClientError(playerid, "Your house already has installed alarm.");
else ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE_ALARM, DIALOG_STYLE_MSGBOX, "House Alarm", "Are you sure you want to buy house alarm?\n House alarm costs {33AA33}$50,000.", "Yes", "No");
}
if(listitem == 3) // lock
{
if(hData[hid][hLocked] == 0)
{
hData[hid][hLocked] = 1;
GameTextForPlayer(playerid,"~r~Locked", 3000, 3);
}
else
{
hData[hid][hLocked] = 0;
GameTextForPlayer(playerid,"~g~Unlocked", 3000, 3);
}
}
}
}
case DIALOG_PLAYER_HOUSE_SELL:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(!strlen(inputtext) || !IsNumeric(inputtext)) return SendClientError(playerid, "Please type the amount you want to sell this house for.");
if(strval(inputtext) < 0) return SendClientError(playerid, "Can not be less than zero.");
hData[hid][hSell] = strval(inputtext);
ReloadHouse(hid);
}
}
case DIALOG_PLAYER_HOUSE_INT:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(GetPlayerMoneyEx(playerid) < HouseInteriors[strval(inputtext)][hprice]) return SendClientError(playerid, "You do not have enough money.");
hData[hid][hInteriorPack] = strval(inputtext);
GivePlayerMoneyEx(playerid, -HouseInteriors[strval(inputtext)][hprice]);
SendClientSuccess(playerid, "You have successfully upgraded the interior.");
ReloadHouse(hid);
}
}
case DIALOG_PLAYER_HOUSE_ALARM:
{
if(response)
{
new hid = IsPlayerOutHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not outside the house anymore.");
if(GetPlayerMoneyEx(playerid) < 50000) return SendClientError(playerid, "You do not have enough money.");
GivePlayerMoneyEx(playerid, -50000);
hData[hid][hAlarm] = 1;
SendClientSuccess(playerid, "You have successfully added alarm to the house.");
ReloadHouse(hid);
}
}
case DIALOG_PLAYER_HOUSE_IN:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
if(hData[hid][hSafe] == 0) // unlocked
{
new mstr[256];
format(mstr, 256, "Money: {33AA33}$%i\nDrugs\nWeapons", hData[hid][hMoney]);
ShowPlayerDialog(playerid, DIALOG_HOUSE_IN_SAFE, DIALOG_STYLE_LIST, "House Safe", mstr, "OK", " Exit");
}
else if(hData[hid][hSafe] == 1) // locked
{
if(strcmp(hData[hid][hOwner], GetName(playerid), false)) return SendClientError(playerid, "The safe is locked, you dont have keys aswell.");
else return SendClientError(playerid, "Please unlock the safe first.");
}
}
if(listitem == 1)
{
if(strcmp(hData[hid][hOwner], GetName(playerid), false)) return SendClientError(playerid, "You dont have keys to unlock the safe.");
if(hData[hid][hSafe] == 0)
{
hData[hid][hSafe] = 1;
return GameTextForPlayer(playerid,"~r~Locked", 3000, 3);
}
if(hData[hid][hSafe] == 1)
{
hData[hid][hSafe] = 0;
return GameTextForPlayer(playerid,"~g~Unlocked", 3000, 3);
}
}
}
}
case DIALOG_HOUSE_IN_SAFE:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_IN_MONEY, DIALOG_STYLE_LIST, "House Safe", "Take Money\nPut Money", "OK", " Exit");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_IN_DRUGS, DIALOG_STYLE_LIST, "House Safe", "Take Drugs\nPut Drugs", "OK", " Exit");
}
if(listitem == 2)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_IN_GUNS, DIALOG_STYLE_LIST, "House Safe", "Take Guns\nPut Guns", "OK", " Exit");
}
}
}
case DIALOG_HOUSE_IN_MONEY:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0) // take
{
if(hData[hid][hMoney] < 1) return SendClientError(playerid, "There is no money in the safe to take from.");
else ShowPlayerDialog(playerid, DIALOG_HOUSE_MONEY_TAKE, DIALOG_STYLE_INPUT, "Take Money", "Please enter the amount you want to take:", "Enter", "Quit");
}
if(listitem == 1) // put
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_MONEY_PUT, DIALOG_STYLE_INPUT, "Put Money", "Please enter the amount you want to put:", "Enter", "Quit");
}
}
}
case DIALOG_HOUSE_IN_DRUGS:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0) // take
{
new mstr[256];
format(mstr, 256, "%s: %i\n%s: %i\n%s: %i", DrugData[0][drugname], hData[hid][hDrugs][0], DrugData[1][drugname], hData[hid][hDrugs][1], DrugData[2][drugname], hData[hid][hDrugs][2]);
if(hData[hid][hDrugs][0] == 0 && hData[hid][hDrugs][1] == 0 && hData[hid][hDrugs][2] == 0) return SendClientError(playerid, "There is no any drugs stored");
else ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_TAKE, DIALOG_STYLE_LIST, "Take Drugs", mstr, "OK", "Exit");
}
if(listitem == 1) // put
{
new mstr[256];
format(mstr, 256, "%s: %i\n%s: %i\n%s: %i", DrugData[0][drugname], hData[hid][hDrugs][0], DrugData[1][drugname], hData[hid][hDrugs][1], DrugData[2][drugname], hData[hid][hDrugs][2]);
ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_PUT, DIALOG_STYLE_LIST, "Put Drugs", mstr, "OK", "Exit");
}
}
}
case DIALOG_HOUSE_IN_GUNS:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0) // take
{
new mstr[256];
if(hData[hid][hGuns][0] == 0 && hData[hid][hGuns][1] == 0) return SendClientError(playerid, "No any weapon is stored in the safe.");
format(mstr, 256, "Weapon Slot 1 (%s - %i)\nWeapon Slot 2 (%s - %i)", GetWeaponNameByID(hData[hid][hGuns][0]), hData[hid][hAmmo][0], GetWeaponNameByID(hData[hid][hGuns][1]), hData[hid][hAmmo][1]);
ShowPlayerDialog(playerid, DIALOG_HOUSE_GUNS_TAKE, DIALOG_STYLE_LIST, "Take Gun", mstr, "OK", "Exit");
}
if(listitem == 1) // put
{
new mstr[256];
format(mstr, 256, "Weapon Slot 1 (%s - %i)\nWeapon Slot 2 (%s - %i)", GetWeaponNameByID(hData[hid][hGuns][0]), hData[hid][hAmmo][0], GetWeaponNameByID(hData[hid][hGuns][1]), hData[hid][hAmmo][1]);
ShowPlayerDialog(playerid, DIALOG_HOUSE_GUNS_PUT, DIALOG_STYLE_LIST, "Put Gun", mstr, "OK", "Exit");
}
}
}
case DIALOG_HOUSE_GUNS_TAKE:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
if(hData[hid][hGuns][0] == 0) return SendClientError(playerid, "There is no any gun stored in this slot.");
GivePlayerWeapon(playerid, hData[hid][hGuns][0], hData[hid][hAmmo][0]);
hData[hid][hGuns][0] = 0;
hData[hid][hAmmo][0] = 0;
GameTextForPlayer(playerid,"~g~Taken Gun", 3000, 3);
}
if(listitem == 1)
{
if(hData[hid][hGuns][1] == 0) return SendClientError(playerid, "There is no any gun stored in this slot.");
GivePlayerWeapon(playerid, hData[hid][hGuns][1], hData[hid][hAmmo][1]);
hData[hid][hGuns][1] = 0;
hData[hid][hAmmo][1] = 0;
GameTextForPlayer(playerid,"~g~Taken Gun", 3000, 3);
}
}
}
case DIALOG_HOUSE_GUNS_PUT:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
if(hData[hid][hGuns][0] != 0) return SendClientError(playerid, "There is a gun stored in the slot already.");
if(GetPlayerWeapon(playerid) == 0) return SendClientError(playerid, "You are not holding any gun!");
hData[hid][hGuns][0] = GetPlayerWeapon(playerid);
hData[hid][hAmmo][0] = GetPlayerAmmo(playerid);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
GameTextForPlayer(playerid,"~g~Put Gun", 3000, 3);
}
if(listitem == 1)
{
if(hData[hid][hGuns][1] != 0) return SendClientError(playerid, "There is a gun stored in the slot already.");
if(GetPlayerWeapon(playerid) == 0) return SendClientError(playerid, "You are not holding any gun!");
hData[hid][hGuns][1] = GetPlayerWeapon(playerid);
hData[hid][hAmmo][1] = GetPlayerAmmo(playerid);
RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
GameTextForPlayer(playerid,"~g~Put Gun", 3000, 3);
}
}
}
case DIALOG_HOUSE_MONEY_TAKE:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to take.");
if(strval(inputtext) > hData[hid][hMoney]) return SendClientError(playerid, "There is not this much amount in the safe.");
GivePlayerMoneyEx(playerid, strval(inputtext));
hData[hid][hMoney] -= strval(inputtext);
GameTextForPlayer(playerid,"~g~Taken Money", 3000, 3);
}
}
case DIALOG_HOUSE_MONEY_PUT:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to put.");
if(strval(inputtext) > GetPlayerMoneyEx(playerid)) return SendClientError(playerid, "You do not have this much money on you.");
GivePlayerMoneyEx(playerid, -strval(inputtext));
hData[hid][hMoney] += strval(inputtext);
GameTextForPlayer(playerid,"~g~Put Money", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_TAKE:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
if(hData[hid][hDrugs][0] < 1) return SendClientError(playerid, "There is no drug stored.");
else ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_TAKE0, DIALOG_STYLE_INPUT, "Take Cannabis", "Please enter the amount you want to take:", "OK", "Exit");
}
if(listitem == 1)
{
if(hData[hid][hDrugs][1] < 1) return SendClientError(playerid, "There is no drug stored.");
else ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_TAKE1, DIALOG_STYLE_INPUT, "Take Cocaine", "Please enter the amount you want to take:", "OK", "Exit");
}
if(listitem == 2)
{
if(hData[hid][hDrugs][2] < 1) return SendClientError(playerid, "There is no drug stored.");
else ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_TAKE2, DIALOG_STYLE_INPUT, "Take Heroin", "Please enter the amount you want to take:", "OK", "Exit");
}
}
}
case DIALOG_HOUSE_DRUGS_TAKE0:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to take.");
if(strval(inputtext) > hData[hid][hDrugs][0]) return SendClientError(playerid, "You do not have this much drugs in the safe.");
pData[playerid][pDrugs][0] += strval(inputtext);
hData[hid][hDrugs][0] -= strval(inputtext);
GameTextForPlayer(playerid, "~g~Taken Cannabis", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_TAKE1:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to take.");
if(strval(inputtext) > hData[hid][hDrugs][1]) return SendClientError(playerid, "You do not have this much drugs in the safe.");
pData[playerid][pDrugs][1] += strval(inputtext);
hData[hid][hDrugs][1] -= strval(inputtext);
GameTextForPlayer(playerid, "~g~Taken Cocaine", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_TAKE2:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to take.");
if(strval(inputtext) > hData[hid][hDrugs][2]) return SendClientError(playerid, "You do not have this much drugs in the safe.");
pData[playerid][pDrugs][2] += strval(inputtext);
hData[hid][hDrugs][2] -= strval(inputtext);
GameTextForPlayer(playerid, "~g~Taken Heroin", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_PUT:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_PUT0, DIALOG_STYLE_INPUT, "Put Cannabis", "Please enter the amount you want to put:", "OK", "Exit");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_PUT1, DIALOG_STYLE_INPUT, "Put Cocaine", "Please enter the amount you want to put:", "OK", "Exit");
}
if(listitem == 2)
{
ShowPlayerDialog(playerid, DIALOG_HOUSE_DRUGS_PUT2, DIALOG_STYLE_INPUT, "Put Heroin", "Please enter the amount you want to put:", "OK", "Exit");
}
}
}
case DIALOG_HOUSE_DRUGS_PUT0:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to put.");
if(strval(inputtext) > pData[playerid][pDrugs][0]) return SendClientError(playerid, "You do not have this much drugs on you.");
pData[playerid][pDrugs][0] -= strval(inputtext);
hData[hid][hDrugs][0] += strval(inputtext);
GameTextForPlayer(playerid, "~g~Put Cannabis", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_PUT1:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to put.");
if(strval(inputtext) > pData[playerid][pDrugs][1]) return SendClientError(playerid, "You do not have this much drugs on you.");
pData[playerid][pDrugs][1] -= strval(inputtext);
hData[hid][hDrugs][1] += strval(inputtext);
GameTextForPlayer(playerid, "~g~Put Cocaine", 3000, 3);
}
}
case DIALOG_HOUSE_DRUGS_PUT2:
{
new hid = IsPlayerInHouse(playerid);
if(hid == -1) return SendClientError(playerid, "You are not inside the house anymore.");
if(response)
{
if(!strlen(inputtext) || !IsNumeric(inputtext) || strval(inputtext) < 1) return SendClientError(playerid, "Please enter the amount you want to put.");
if(strval(inputtext) > pData[playerid][pDrugs][2]) return SendClientError(playerid, "You do not have this much drugs on you.");
pData[playerid][pDrugs][2] -= strval(inputtext);
hData[hid][hDrugs][2] += strval(inputtext);
GameTextForPlayer(playerid, "~g~Put Heroin", 3000, 3);
}
}
}
return 1;
}
CMD:ahouse(playerid, params[])
{
new wat[10];
if(pData[playerid][Admin] < 5) return SendClientError(playerid, CANT_USE_CMD);
new hid = IsPlayerOutHouse(playerid);
new hd = IsPlayerInHouse(playerid);
if(hid != -1 && hd == -1) // if outside
{
new mstr[256], onestr[256], alrm[10], locked[10];
format(onestr, 256, "%s's House (ID: %i)", hData[hid][hOwner], hid);
if(hData[hid][hAlarm] == 0) format(alrm, 10, "No"); else format(alrm, 10, "Yes");
if(hData[hid][hLocked] == 0) format(locked, 10, "No"); else format(locked, 10, "Yes");
format(mstr, 256, "Owner:\t\t\t%s\nInterior:\t\t%i\nAlarm:\t\t\t%s\nMoney:\t\t\t$%i\nLocked:\t\t%s\nSell:\t\t\t%i\nSave\nReload\nDelete",
hData[hid][hOwner], hData[hid][hInteriorPack], alrm, hData[hid][hMoney], locked, hData[hid][hSell]);
ShowPlayerDialog(playerid, DIALOG_ADMIN_HOUSE, DIALOG_STYLE_LIST, onestr, mstr, "OK", "Exit");
}
else if(hid == -1 && hd == -1)
{
if(sscanf(params, "s[10]", wat)) return SendClientUsage(playerid, "/ahouse [create]");
if(!strcmp(wat, "create", true, 6))
{
hid = GetUnusedHouseID();
format(hData[hid][hOwner], 24, "None");
new Float:tmpx, Float:tmpy, Float:tmpz, intt, vww;
GetPlayerPos(playerid, tmpx, tmpy, tmpz);
intt = GetPlayerInterior(playerid);
vww = GetPlayerVirtualWorld(playerid);
hData[hid][hX] = tmpx;
hData[hid][hY] = tmpy;
hData[hid][hZ] = tmpz;
hData[hid][hInt] = intt;
hData[hid][hVW] = vww;
hData[hid][hAlarm] = 0;
hData[hid][hMoney] = 0;
hData[hid][hInteriorPack] = 0;
hData[hid][hLocked] = 0;
hData[hid][hSell] = 0;
hData[hid][hActive] = 1;
InsertHouse(hid);
hData[hid][hActive] = 1;
hData[hid][hPickupID] = CreateDynamicPickup(1273, 23, hData[hid][hX], hData[hid][hY], hData[hid][hZ], hData[hid][hVW], hData[hid][hInt], -1, 100.0);
new string[512], zone[48];
GetZone(hData[hid][hX], hData[hid][hY], hData[hid][hZ], zone);
if(hData[hid][hSell] < 1) format(string,sizeof(string),"Owner: %s\nAddress: %s, %d",NoUnderscore(hData[hid][hOwner]),zone,hid);
else format(string,sizeof(string),"Owner: %s\nAddress: %s %d\nPrice: $%d (/buyhouse to buy)",NoUnderscore(hData[hid][hOwner]),zone,hid, hData[hid][hSell]);
hData[hid][hLabel] = CreateDynamic3DTextLabel(string, -1, hData[hid][hX], hData[hid][hY], hData[hid][hZ], 20, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 5);
}
}
else if(hid == -1 && hd != -1)
{
SendClientError(playerid, "You cant use this cmd inside a house.");
}
return 1;
}
CMD:house(playerid, params[])
{
new hid = IsPlayerOutHouse(playerid);
new hd = IsPlayerInHouse(playerid);
if(hid == -1 && hd == -1) // away
{
if(GetPlayerHouses(playerid) == 0) return SendClientError(playerid, "You do not own any house");
new onestr[256], mstr[256], tmpstr[256], zone[20], cnt = 0;
format(onestr, 256, "%s's Houses", RPName(playerid));
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] != 1) continue;
if(!strcmp(hData[i][hOwner], GetName(playerid), false))
{
if(cnt == 0)
{
cnt++;
GetZone(hData[i][hX], hData[i][hY], hData[i][hZ], zone);
format(tmpstr, 256, "House ID: %i at %s", i, zone);
}
else
{
GetZone(hData[i][hX], hData[i][hY], hData[i][hZ], zone);
format(tmpstr, 256, "\nHouse ID: %i at %s", i, zone);
}
strcat(mstr, tmpstr);
}
}
ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE, DIALOG_STYLE_LIST, onestr, mstr, "OK", "Exit");
}
if(hid != -1 && hd == -1) // outside
{
if(strcmp(hData[hid][hOwner], GetName(playerid), false)) return SendClientError(playerid, "You do not own this house.");
new onestr[256], mstr[256], lock[10], alrm[10];
format(onestr, 256, "%s's House (ID: %i)", hData[hid][hOwner], hid);
if(hData[hid][hLocked] == 1) format(lock, 10, "Yes"); else format(lock, 10, "No");
if(hData[hid][hAlarm] == 1) format(alrm, 10, "Yes"); else format(alrm, 10, "No");
format(mstr, 256, "Sell\nUpgrade\nAlarm:\t\t\t%s\nLocked:\t\t%s", alrm, lock);
ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE_OUT, DIALOG_STYLE_LIST, onestr, mstr, "OK", "Exit");
}
if(hid == -1 && hd != -1) // inside
{
new onestr[256], mstr[256], lock[10];
format(onestr, 256, "%s's House Safe", hData[hd][hOwner]);
if(hData[hd][hSafe] == 0) format(lock, 10, "Unlocked"); else format(lock, 10, "Locked");
format(mstr, 256, "Open Safe\nSafe Status: %s", lock);
ShowPlayerDialog(playerid, DIALOG_PLAYER_HOUSE_IN, DIALOG_STYLE_LIST, onestr, mstr, "OK", "Exit");
}
return 1;
}
EnteringHouse(playerid)
{
new tmps;
tmps = IsPlayerOutHouse(playerid);
if(tmps != -1 && !IsPlayerInAnyVehicle(playerid))
{
if(hData[tmps][hLocked] == 1) return GameTextForPlayer(playerid,"~r~Locked", 3000, 3);
new intp = GetHouseInteriorID(tmps);
SetPlayerInterior(playerid, HouseInteriors[intp][hinterior]);
SetPlayerVirtualWorld(playerid, tmps+1);
SetPlayerPos(playerid, HouseInteriors[intp][hintx], HouseInteriors[intp][hinty], HouseInteriors[intp][hintz]);
SetCameraBehindPlayer(playerid);
LetItLoadLOL(playerid);
}
return 1;
}
ExitingHouse(playerid)
{
new tmps;
tmps = IsPlayerInHouse(playerid, 5.0);
if(tmps != -1 && !IsPlayerInAnyVehicle(playerid))
{
SetPlayerInterior(playerid, hData[tmps][hInt]);
SetPlayerVirtualWorld(playerid, hData[tmps][hVW]);
SetPlayerPos(playerid, hData[tmps][hX], hData[tmps][hY], hData[tmps][hZ]);
SetCameraBehindPlayer(playerid);
LetItLoadLOL(playerid);
}
return 1;
}
LetItLoadLOL(playerid)
{
TogglePlayerControllable(playerid, false);
GameTextForPlayer(playerid,"~r~Loading Map", 5000, 3);
SetTimerEx("LoadedLOL", 5000, false, "i", playerid);
}
PUBLIC:LoadedLOL(playerid)
{
TogglePlayerControllable(playerid, true);
}
GetPlayerHouses(playerid)
{
new isyes = 0;
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] != 1) continue;
if(!strcmp(hData[i][hOwner], GetName(playerid), false)) isyes++;
}
return isyes;
}
GetUnusedHouseID()
{
new isyes = -1;
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] == 0)
{
isyes = i;
break;
}
}
return isyes;
}
IsPlayerOutHouse(playerid)
{
new isyes = -1;
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] != 1) continue;
if(IsPlayerInRangeOfPoint(playerid, 5.0, hData[i][hX], hData[i][hY], hData[i][hZ]))
{
if(GetPlayerInterior(playerid) == hData[i][hInt] && GetPlayerVirtualWorld(playerid) == hData[i][hVW])
{
isyes = i;
break;
}
}
}
return isyes;
}
IsPlayerInHouse(playerid, Float:range = 30.0)
{
new isyes = -1;
for(new i = 0; i < MAX_HOUSES; i++)
{
if(hData[i][hActive] != 1) continue;
new intp = GetHouseInteriorID(i);
if(intp != -1)
{
if(GetPlayerInterior(playerid) == HouseInteriors[intp][hinterior] && GetPlayerVirtualWorld(playerid) == i+1)
{
if(IsPlayerInRangeOfPoint(playerid, range, HouseInteriors[intp][hintx], HouseInteriors[intp][hinty], HouseInteriors[intp][hintz]))
{
isyes = i;
break;
}
}
}
}
return isyes;
}
GetHouseInteriorID(hid)
{
new isyes = -1;
for(new i = 0; i < sizeof(HouseInteriors); i++)
{
if(hData[hid][hInteriorPack] == HouseInteriors[i][hintpack])
{
isyes = i;
break;
}
}
return isyes;
}
stock GetWeaponNameByID(wid) // By JONNy5
{
new gunname[32];
switch (wid)
{
case 1 .. 17,
22 .. 43,
46 : GetWeaponName(wid,gunname,sizeof(gunname));
case 0: format(gunname,32,"%s","None");
case 18: format(gunname,32,"%s","Molotov Cocktail");
case 44: format(gunname,32,"%s","Night Vis Goggles");
case 45: format(gunname,32,"%s","Thermal Goggles");
default: format(gunname,32,"%s","Invalid Weapon Id");
}
return gunname;
}
stock NoUnderscore(string[]) // by w00t
{
new str[512];
strmid(str,string,0,strlen(string), 512);
for(new i = 0; i < 512; i++)
{
if (str[i] == '_') str[i] = ' ';
}
return str;
}
stock IsNumeric(const str[])
{
for(new i, len = strlen(str); i < len; i++)
{
if(!('0' <= str[i] <= '9')) return false;
}
return true;
}
stock SendClientError(playerid, const msg[])
{
new dstr[512];
format(dstr, sizeof(dstr), "[Error] %s", msg);
return SendClientMessage(playerid, COLOR_RED, dstr);
}
stock SendClientSuccess(playerid, const msg[])
{
new dstr[512];
format(dstr, sizeof(dstr), "[Success] %s", msg);
return SendClientMessage(playerid, COLOR_SUCCESS, dstr);
}
stock SendClientUsage(playerid, const msg[])
{
new dstr[512];
format(dstr, sizeof(dstr), "[Usage] %s", msg);
return SendClientMessage(playerid, COLOR_GREY, dstr);
}
stock GetPlayerMoneyEx(playerid)
{
return pData[playerid][Money];
}
stock GivePlayerMoneyEx(playerid, amount)
{
GivePlayerMoney(playerid, amount);
pData[playerid][Money] += amount;
}
stock RemovePlayerWeapon(playerid, weaponid)
{
SetPlayerArmedWeapon(playerid, weaponid);
if (GetPlayerWeapon(playerid) != 0) GivePlayerWeapon(playerid, GetPlayerWeapon(playerid), -(GetPlayerAmmo(playerid)));
return 1;
}
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}