Alright, I would like to know how I would get the houseid of the house a player is in...
id = houseid according to SQL.
The HouseOwner[playerid] is inserted when a player /buyhouse so the ID of the house is placed in the HouseOwner variable on their account.....
It will probably put you off.....
What I want to do basically is when this command is used, I want to check that it's in the house....here.....
pawn Код:
CMD:hstoreweapon(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(HouseOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You don't have a house.");
new slot, houseid, weapon[32];
if(sscanf(params, "ds[32]", slot, weapon)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /hstoreweapon [slot] [weapon]");
if(HouseWS1[houseid] || HouseWS2[houseid] || HouseWS3[houseid] >= 1) return SendClientMessage(playerid, COLOUR_GREY, "That slot is already occupied.");
if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOUR_GREY, "Invalid slot (1-3).");
houseid = //GetPlayerHouseID(playerid);
new weaponstored, ammostored, string[128];
if(IsPlayerInRangeOfPoint(playerid, 30.0, HouseEntX[houseid], HouseEntY[houseid], HouseEntZ[houseid]))
{
if(HouseOwned[playerid] == houseid)
{
if(strcmp(weapon, "9mm", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][2] == 22 && PlayerWeaponAmmo[playerid][2] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a 9mm in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
format(string,sizeof(string), "* %s stores a 9mm in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "desert eagle", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][2] == 24 && PlayerWeaponAmmo[playerid][2] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a desert eagle in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][2];
ammostored = PlayerWeaponAmmo[playerid][2];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
}
format(string,sizeof(string), "* %s stores a desert eagle in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "shotgun", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][3] == 25 && PlayerWeaponAmmo[playerid][3] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a shotgun in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
format(string,sizeof(string), "* %s stores a shotgun in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "spas12", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][3] == 27 && PlayerWeaponAmmo[playerid][3] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a spas 12 in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][3];
ammostored = PlayerWeaponAmmo[playerid][3];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][3]);
}
format(string,sizeof(string), "* %s stores a spas 12 in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "mp5", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][4] == 29 && PlayerWeaponAmmo[playerid][4] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a spas 12 in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
format(string,sizeof(string), "* %s stores an mp5 in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "ak47", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][5] == 30 && PlayerWeaponAmmo[playerid][5] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored an AK-47 in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
format(string,sizeof(string), "* %s stores an AK-47 in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "m4", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][5] == 31 && PlayerWeaponAmmo[playerid][5] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored an M4 in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][5]);
}
format(string,sizeof(string), "* %s stores an M4 in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "rifle", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][6] == 33 && PlayerWeaponAmmo[playerid][6] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a Rifle in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][6];
ammostored = PlayerWeaponAmmo[playerid][6];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][5];
ammostored = PlayerWeaponAmmo[playerid][5];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][6];
ammostored = PlayerWeaponAmmo[playerid][6];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
format(string,sizeof(string), "* %s stores a rifle in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "sniper", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][6] == 34 && PlayerWeaponAmmo[playerid][6] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a Sniper in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][6];
ammostored = PlayerWeaponAmmo[playerid][6];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][6];
ammostored = PlayerWeaponAmmo[playerid][6];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][6];
ammostored = PlayerWeaponAmmo[playerid][6];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][6]);
}
format(string,sizeof(string), "* %s stores a sniper rifle in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "uzi", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][4] == 28 && PlayerWeaponAmmo[playerid][4] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored an UZI in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
format(string,sizeof(string), "* %s stores an uzi in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
else if(strcmp(weapon, "tec9", true, strlen(weapon)) == 0)
{
if(PlayerWeapons[playerid][4] == 32 && PlayerWeaponAmmo[playerid][4] >= 1)
{
SendClientMessage(playerid, COLOUR_GREY, "You have stored a tec 9 in your house.");
if(slot == 1)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 2)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
if(slot == 3)
{
weaponstored = PlayerWeapons[playerid][4];
ammostored = PlayerWeaponAmmo[playerid][4];
MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3",weaponstored,"houses");
MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3",ammostored,"houses");
RemovePlayerWeapon(playerid, PlayerWeapons[playerid][4]);
}
format(string,sizeof(string), "* %s stores a tec 9 in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
}
}
}
}
return 1;
}