28.01.2013, 02:23
PHP код:
CMD:createhouse(playerid,params[])
{
new price;
if(sscanf(params,"d",price)) return SCM(playerid,-1,"USAGE:/createhouse [house price]");
// if(pInfo[playerid][pAdmin] >= 4)
{
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
new DBResult:result;
result = db_query(houses,"SELECT FROM `Houses` WHERE `Set`='1'");
if(db_num_rows(result) >= MAX_HOUSES) return SCM(playerid,-1,"You cannot create anymore houses!");
result = db_query(houses,"INSERT INTO `Houses` (`EnterX`,`EnterY`,`EnterZ`,`EnterVw`,`EnterInt`,`Set`,`Owned`,`Price`)VALUES (`pPos[0]`,`pPos[1]`,`pPos[2]`,`GetPlayerVirtualWorld(playerid)`,`GetPlayerInterior(playerid)`,`1`,`0`,`price`)");
new query[256];
format(query,sizeof(query),"SELECT FROM `Houses` WHERE `EnterX`='%f' LIMIT 1",pPos[0]);
result = db_query(houses,query);
hInfo[db_num_rows(result)][hEntrance][0] = pPos[0];
hInfo[db_num_rows(result)][hEntrance][1] = pPos[1];
hInfo[db_num_rows(result)][hEntrance][2] = pPos[2];
hInfo[db_num_rows(result)][hEntranceVw] = GetPlayerVirtualWorld(playerid);
hInfo[db_num_rows(result)][hEntranceInt] = GetPlayerInterior(playerid);
hPickup[db_num_rows(result)] = CreateDynamicPickup(1273,19,hInfo[db_num_rows(result)][hEntrance][0],hInfo[db_num_rows(result)][hEntrance][1],
hInfo[db_num_rows(result)][hEntrance][2], GetPlayerVirtualWorld(playerid),GetPlayerVirtualWorld(playerid),-1,100.0);
hInfo[db_num_rows(result)][hSet] = true;
hInfo[db_num_rows(result)][hOwned] = false;
hInfo[db_num_rows(result)][hPrice] = price;
db_free_result(result);
}
return 1;
}