How to Create cmd /Reloadallhouse -
DandyCorleone - 07.11.2016
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...
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;
}Â
Re: How to Create cmd /Reloadallhouse -
DandyCorleone - 07.11.2016
please.. help
Re: How to Create cmd /Reloadallhouse -
PeanutButter - 07.11.2016
Do you mean this? I didn't try it out, check if it works.
PHP код:
CMD:reloadallhouse(playerid, params[])Â
{Â
    if(pAdmin[playerid] < 8)
    {
        return Error(playerid, "You are not authorized to use this command!");Â
    }
    new labeltext[300];Â
    if(sscanf(params, "d", h))
    {
        return ShowInfoBoxEx(playerid, COLOR_SYSTEM, E_CMD_USAGE_RELOADHOUSE);Â
    }
    else
    {
        foreach(Houses, h)
        {
            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;Â
}Â
Re: How to Create cmd /Reloadallhouse -
Mencent - 07.11.2016
Do you mean it like this?
PHP код:
CMD:reloadallhouse(playerid,params[])
{
    if(pAdmin[playerid] < 8)return Error(playerid,"You are not authorized to use this command!");
    new labeltext[300];
    for(new i;i<sizeof(hInfo);i++)
    {
        DestroyHouseEntrance(i,TYPE_OUT);
        DestroyDynamicMapIcon(HouseMIcon[i]);
        DestroyDynamic3DTextLabel(HouseLabel[i]);
        if(!strcmp(hInfo[i][HouseOwner],INVALID_HOWNER_NAME,CASE_SENSETIVE))
        {
            format(labeltext,sizeof(labeltext),LABELTEXT1,hInfo[i][HouseName],ToCurrency(hInfo[i][HouseValue]),i);
            HouseMIcon[i] = CreateDynamicMapIcon(hInfo[i][CPOutX], hInfo[i][CPOutY], hInfo[i][CPOutZ], 31, -1, -1, -1, -1, MICON_VD);
        }
        else
        {
            format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[i][HouseName], hInfo[i][HouseOwner], ToCurrency(hInfo[i][HouseValue]), Answer(hInfo[i][HousePrivacy], "Open", "Closed"), i);
            HouseMIcon[i] = CreateDynamicMapIcon(hInfo[i][CPOutX], hInfo[i][CPOutY], hInfo[i][CPOutZ], 32, -1, -1, -1, -1, MICON_VD);
        }
        HouseLabel[i] = CreateDynamic3DTextLabel(labeltext,COLOR_GREEN,hInfo[i][CPOutX],hInfo[i][CPOutY],hInfo[i][CPOutZ]+0.7,TEXTLABEL_DISTANCE,.testlos = 1);
        HousePickupOut[i] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[i][CPOutX], hInfo[i][CPOutY], hInfo[i][CPOutZ], -1, -1, -1, 30.0);
        ShowInfoBox(playerid, I_H_RELOADED, i);
    }
    return 1;
}Â