How to Create cmd /Reloadallhouse
#1

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(playeridparams[])
{
    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(playeridCOLOR_SYSTEME_CMD_USAGE_RELOADHOUSE);
    
DestroyHouseEntrance(hTYPE_OUT);
    
DestroyDynamicMapIcon(HouseMIcon[h]);
    
DestroyDynamic3DTextLabel(HouseLabel[h]);
    
    if(!
strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAMECASE_SENSETIVE))
    {
        
format(labeltextsizeof(labeltext), LABELTEXT1hInfo[h][HouseName], ToCurrency(hInfo[h][HouseValue]), h);
        
HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, -1, -1, -1MICON_VD);
    }
    else if(
strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAMECASE_SENSETIVE))
    {
        
format(labeltextsizeof(labeltext), LABELTEXT2hInfo[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, -1MICON_VD);
    }
    
HouseLabel[h] = CreateDynamic3DTextLabel(labeltextCOLOR_GREENhInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ]+0.7TEXTLABEL_DISTANCE, .testlos 1);
    
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUTPICKUP_TYPEhInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], -1, -1, -130.0);
    
ShowInfoBox(playeridI_H_RELOADEDh);
    return 
1;
}
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:yFloat:distance)
{
    new 
Float:a;
    
GetPlayerPos(playeridxya);
    switch(
IsPlayerInAnyVehicle(playerid))
    {
        case 
0GetPlayerFacingAngle(playerida);
        case 
1GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    
+= (distance floatsin(-adegrees));
    
+= (distance floatcos(-adegrees));
    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 
hintresultline[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(
Housesh)
    {
        
DestroyHouseEntrance(hTYPE_OUT);
        
DestroyHouseEntrance(hTYPE_INT);
        
DestroyDynamicMapIcon(HouseMIcon[h]);
        
DestroyDynamic3DTextLabel(HouseLabel[h]);
    }
    
Iter_Clear(Houses);
    return 
1;

Reply
#2

please.. help
Reply
#3

Do you mean this? I didn't try it out, check if it works.

PHP код:
CMD:reloadallhouse(playeridparams[]) 

    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(playeridCOLOR_SYSTEME_CMD_USAGE_RELOADHOUSE); 
    }
    else
    {
        foreach(
Housesh)
        {
            
DestroyHouseEntrance(hTYPE_OUT); 
            
DestroyDynamicMapIcon(HouseMIcon[h]); 
            
DestroyDynamic3DTextLabel(HouseLabel[h]); 
            if(!
strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAMECASE_SENSETIVE)) 
            { 
                
format(labeltextsizeof(labeltext), LABELTEXT1hInfo[h][HouseName], ToCurrency(hInfo[h][HouseValue]), h);
                
HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, -1, -1, -1MICON_VD); 
            } 
            else if(
strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAMECASE_SENSETIVE)) 
            { 
                
format(labeltextsizeof(labeltext), LABELTEXT2hInfo[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, -1MICON_VD); 
            } 
            
HouseLabel[h] = CreateDynamic3DTextLabel(labeltextCOLOR_GREENhInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ]+0.7TEXTLABEL_DISTANCE, .testlos 1); 
            
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUTPICKUP_TYPEhInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], -1, -1, -130.0); 
            
ShowInfoBox(playeridI_H_RELOADEDh);
        }
    }
    
    return 
1

Reply
#4

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, -1MICON_VD);
        }
        else
        {
            
format(labeltextsizeof(labeltext), LABELTEXT2hInfo[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, -1MICON_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_OUTPICKUP_TYPEhInfo[i][CPOutX], hInfo[i][CPOutY], hInfo[i][CPOutZ], -1, -1, -130.0);
        
ShowInfoBox(playeridI_H_RELOADEDi);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)