House ID Help?
#1

why each I /createhouse, in id the house is always 0? how to order the house next id in /createhouse?


PHP код:
CMD:createhouse(playeridparams[])
{
    if(
pAdmin[playerid] < 4)
        return 
Error(playerid"You are not authorized to use this command!");
    if(
GetPlayerInterior(playerid) != 0)
        return 
Error(playerid"You can't create houses on any interior other than 0.");
    new 
costhint;
    new 
Float:XFloat:YFloat:Z;
    if(
sscanf(params"iD(0)"costhint)) return ShowInfoBoxEx(playeridCOLOR_SYSTEME_CMD_USAGE_CREATEHOUSE);
    if(
Iter_Count(Houses) > MAX_HOUSES) return ShowInfoBoxEx(playeridCOLOR_SYSTEM""WHITE_E"Max limit of houses reached!");
    if(
hint || hint MAX_HOUSE_INTERIORS) return ShowInfoBoxEx(playeridCOLOR_SYSTEME_INVALID_HINT);
    if(
cost MIN_HOUSE_VALUE || cost MAX_HOUSE_VALUE) return ShowInfoBoxEx(playeridCOLOR_SYSTEME_INVALID_HVALUE);
    else
    {
        
// Set a random interior if not specified.
        
if(hint == 0)
        {
             
hint random(10);
        }
        
GetPlayerPos(playeridXpYpZp);
        
GetPlayerFacingAngle(playeridAngle);
        
        new 
interior GetPlayerInterior(playerid);
        
GetPlayerPos(playeridXYZ);
        
GetPosInFrontOfPlayer(playeridXY, -2.5);
        
format(querysizeof(query), "INSERT INTO houses(house_id,hname,howner,hpass,x,y,z,a,cpx,cpy,cpz,hint,hvalue) VALUES(0,'House For Sale!','INVALID_PLAYER_ID','INVALID_HOUSE_PASSWORD', %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %d, %d)"XYZp, (180.0 Angle), XpYpZpinteriorcost);
        
MySQL_query(queryfalse"OnHouseCreate""ifffffffii"playeridXpYpZp, (180.0 Angle), XYZphintcost);
    }
    return 
1;
}
forward OnHouseCreate(playeridFloat:inXFloat:inYFloat:inZFloat:outAFloat:outXFloat:outYFloat:outZinteriorIDcost);
public 
OnHouseCreate(playeridFloat:inXFloat:inYFloat:inZFloat:outAFloat:outXFloat:outYFloat:outZinteriorIDcost)
{
    new 
cache_insert_id();
    new 
labeltext[300];
    
printf("A_I value of the newly entered house: %d"h);
    
hInfo[h][CPOutX] = inXhInfo[h][CPOutY] = inYhInfo[h][CPOutZ] = inZ;
    
hInfo[h][SpawnOutX] = outXhInfo[h][SpawnOutY] = outYhInfo[h][SpawnOutZ] = outZhInfo[h][SpawnOutAngle] = outA;
    
hInfo[h][HouseInterior] = interiorID;
    
format(hInfo[h][HousePassword], 28"%s""INVALID_HOUSE_PASSWORD");
    
format(hInfo[h][HouseName], 28"%s"DEFAULT_HOUSE_NAME);
    
format(hInfo[h][HouseOwner], 24"%s"INVALID_HOWNER_NAME);
    
format(hInfo[h][HouseLocation], 30"%s"GetHouseLocation(h));
    
hInfo[h][HouseValue] = costhInfo[h][HouseStorage] = 0hInfo[h][HouseForSale] = 0;
    
format(labeltextsizeof(labeltext), LABELTEXT1DEFAULT_HOUSE_NAMEToCurrency(cost), h);
    
HouseMIcon[h] = CreateDynamicMapIcon(inXinYinZ31, -1, -1, -1, -1MICON_VD);
    
HouseLabel[h] = CreateDynamic3DTextLabel(labeltextCOLOR_GREENinXinYinZ+0.7TEXTLABEL_DISTANCE, .testlos 1);
    
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUTPICKUP_TYPEinXinYinZ, -1, -1, -130.0);
    
HousePickupInt[h] = CreateDynamicPickup(PICKUP_MODEL_INTPICKUP_TYPEhIntInfo[interiorID][IntCPX], hIntInfo[interiorID][IntCPY], hIntInfo[interiorID][IntCPZ], (1000), hIntInfo[interiorID][IntInterior], -115.0);
    
ShowInfoBox(playeridI_H_CREATEDh);
    
format(strsizeof(str), "Server: "GREY2_E"House ID "GREY_E"[%d] "GREY2_E"created!"h);
    
SendClientMessage(playeridCOLOR_REDstr);
    
    
Iter_Add(Housesh);
    
format(querysizeof(query), "UPDATE houses SET hlocation='%s',hint=%d WHERE house_id=%d"hInfo[h][HouseLocation], interiorIDh);
    
MySQL_updateQuery(query);
    return 
1;

Reply


Messages In This Thread
House ID Help? - by DandyCorleone - 16.09.2016, 08:50
Re: House ID Help? - by Konstantinos - 16.09.2016, 08:53
Re: House ID Help? - by DandyCorleone - 16.09.2016, 09:17
Re: House ID Help? - by DandyCorleone - 16.09.2016, 10:28
Re: House ID Help? - by Konstantinos - 16.09.2016, 10:46

Forum Jump:


Users browsing this thread: 1 Guest(s)