07.11.2016, 15:03
hey.. guys, i need help for cmd /reloadallhouse.
I was exhausted having to reload all the houses one by one armpit server restarts, I need help to be able to reload all home at once.
thanks...
I was exhausted having to reload all the houses one by one armpit server restarts, I need help to be able to reload all home at once.
thanks...
PHP код:
CMD:reloadhouse(playerid, params[])
{
if(pAdmin[playerid] < 8)
return Error(playerid, "You are not authorized to use this command!");
new h;
new labeltext[300];
if(sscanf(params, "d", h)) return ShowInfoBoxEx(playerid, COLOR_SYSTEM, E_CMD_USAGE_RELOADHOUSE);
DestroyHouseEntrance(h, TYPE_OUT);
DestroyDynamicMapIcon(HouseMIcon[h]);
DestroyDynamic3DTextLabel(HouseLabel[h]);
if(!strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
{
format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[h][HouseName], ToCurrency(hInfo[h][HouseValue]), h);
HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, -1, -1, -1, MICON_VD);
}
else if(strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
{
format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[h][HouseName], hInfo[h][HouseOwner], ToCurrency(hInfo[h][HouseValue]), Answer(hInfo[h][HousePrivacy], "Open", "Closed"), h);
HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 32, -1, -1, -1, -1, MICON_VD);
}
HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOR_GREEN, hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ]+0.7, TEXTLABEL_DISTANCE, .testlos = 1);
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], -1, -1, -1, 30.0);
ShowInfoBox(playerid, I_H_RELOADED, h);
return 1;
}
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
switch(IsPlayerInAnyVehicle(playerid))
{
case 0: GetPlayerFacingAngle(playerid, a);
case 1: GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return a;
}
stock LoadHouses()
{
mysql_function_query(g_SQL_handle, "SELECT int_name,intx,inty,intz,inta,cpx,cpy,cpz,interior,value FROM interiors", true, "LoadHouseInteriorData", "");
mysql_function_query(g_SQL_handle, "SELECT house_id,hname,howner,hlocation,hpass,x,y,z,a,cpx,cpy,cpz,hvalue,hstorage,hint,hprivacy,hforsale FROM houses ORDER BY house_id", true, "LoadHouseData", "");
}
function LoadHouseInteriorData()
{
new hint, resultline[400];
mysql_store_result();
while(mysql_fetch_row_format(resultline))
{
sscanf(resultline, "p<|>s[30]fffffffii",
hIntInfo[hint][IntName],
hIntInfo[hint][IntSpawnX],
hIntInfo[hint][IntSpawnY],
hIntInfo[hint][IntSpawnZ],
hIntInfo[hint][IntSpawnAngle],
hIntInfo[hint][IntCPX],
hIntInfo[hint][IntCPY],
hIntInfo[hint][IntCPZ],
hIntInfo[hint][IntInterior],
hIntInfo[hint][IntValue]);
hint++;
}
mysql_free_result();
return 1;
}
stock UnloadHouses()
{
foreach(Houses, h)
{
DestroyHouseEntrance(h, TYPE_OUT);
DestroyHouseEntrance(h, TYPE_INT);
DestroyDynamicMapIcon(HouseMIcon[h]);
DestroyDynamic3DTextLabel(HouseLabel[h]);
}
Iter_Clear(Houses);
return 1;
}