CMD:createhouse(playerid, params[])
{
static Float:IntX;
static Float:IntY;
static Float:IntZ;
static Float:ExtX;
static Float:ExtY;
static Float:ExtZ;
static Interior;
static RWorld;
new string[256], Section[9];
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "s[9]", Section)) return SendClientMessage(playerid, COLOR_WHITE, "Server: /createhouse [exterior/interior/complete]");
{
if(strmatch("interior", Section))
{
GetPlayerPos(playerid, IntX, IntY, IntZ);
Interior = GetPlayerInterior(playerid);
format(string, sizeof(string), "Interior set. (%f %f %f - %d)", IntX, IntY, IntZ, Interior);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(strmatch("exterior", Section))
{
GetPlayerPos(playerid, ExtX, ExtY, ExtZ);
format(string, sizeof(string), "Exterior set. (%f %f %f)", ExtX, ExtY, ExtZ);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(strmatch("complete", Section))
{
format(string, sizeof(string), "House added.");
printf("%f, %f, %f, %f, %f, %f, %i", ExtX, ExtY, ExtZ, IntX, IntY, IntZ, Interior);
SendClientMessage(playerid, COLOR_WHITE, string);
SetPlayerPos(playerid, ExtX, ExtY, ExtZ);
SetPlayerInterior(playerid, 0);
new rand = random(12345);
RWorld = rand;
SaveHouse(ExtX, ExtY, ExtZ, IntX, IntY, IntZ, Interior, RWorld);
}
else return SendClientMessage(playerid, COLOR_WHITE, "Server: /addhouse [exterior/interior/complete]");
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You Aren't Admin");
return 1;
}
stock SaveHouse(Float:ExtX, Float:ExtY, Float:ExtZ, Float:IntX, Float:IntY, Float:IntZ, IntID, RWorld)
{
new
Query[2000];
mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `Houses` (`HouseName`, `HouseOwner`, `ExteriorX`, `ExteriorY`, `ExteriorZ`, `InteriorX`, `InteriorY`, `InteriorZ`, `InteriorID`, `HousePrice`, `HouseLocked`, `HouseWorld`) VALUES('NotSet', 'Nobody', '%f', '%f', '%f', '%f', '%f', '%f', '%i', '25000', '0', '%i')", ExtX, ExtY, ExtZ, IntX, IntY, IntZ, IntID, RWorld);
mysql_query(mysql, Query);
mysql_free_result();
return 1;
}
That's because you only insert the data in the database and you store them in local (temporary) variables.
You neither create the pickup etc in SaveHouse, nor store them to a global array so you can access those data later on. |