House System (/createhouse) - just 23 houses... -
I need some help with this command! It works fine for 23 houses ... but after that says Unknown Command... so i guess something return 0 in that command after 23 ..
pawn Код:
CMD:createhouse(playerid, params[])
{
new cost, h = GetFreeHouseID(), labeltext[250], hint;
if(pInfo[playerid][pAdmin] < 1)
return SendClientMessage(playerid, COLOR_RED, "{FFFFFF}[{6B6B6B}ERROR{FFFFFF}] "RED_E"You are not authorized to use this command!");
if(sscanf(params, "iD(0)", cost, hint)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_CMD_USAGE_CREATEHOUSE);
if(h < 0)
{
ShowInfoBox(playerid, E_TOO_MANY_HOUSES, MAX_HOUSES);
return 1;
}
if(hint == 0)
{
hint = random(10);
}
if(hint < 0 || hint > MAX_HOUSE_INTERIORS) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HINT);
if(IsHouseInteriorValid(hint) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_HINT_DOESNT_EXIST);
if(cost < MIN_HOUSE_VALUE || cost > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HVALUE);
else
{
new file[80];
format(file, sizeof(file), "Houses/%d.json", h);
djCreateFile(file);
GetPlayerPos(playerid, Xp, Yp, Zp);
GetPlayerFacingAngle(playerid, Angle);
new world = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
hInfo[h][CPOutX] = Xp, hInfo[h][CPOutY] = Yp, hInfo[h][CPOutZ] = Zp;
format(HouseNameP[h], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
format(HouseOwnerP[h], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
format(hInfo[h][HouseLocation], MAX_ZONE_NAME, "%s", GetHouseLocation(h));
HousePassword[h] = "9996";
hInfo[h][HouseValue] = cost, hInfo[h][HouseStorage] = 0;
djSetFloat(file, "CPOutX", Xp);
djSetFloat(file, "CPOutY", Yp);
djSetFloat(file, "CPOutZ", Zp);
djSet(file, "HouseName", DEFAULT_HOUSE_NAME);
djSet(file, "HouseOwner", INVALID_HOWNER_NAME);
djSet(file, "HouseLocation", hInfo[h][HouseLocation]);
djSet(file, "HousePassword", HousePassword[h]);
djSet(file, "HouseCreator", pInfo[playerid][pName]);
djSetInt(file, "HouseValue", cost);
djSetInt(file, "HouseStorage", 0);
format(labeltext, sizeof(labeltext), LABELTEXT1, DEFAULT_HOUSE_NAME, cost, h);
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, Xp, Yp, Zp, world, interior, -1, 40.0);
HousePickupInt[h] = CreateDynamicPickup(PICKUP_MODEL_INT, PICKUP_TYPE, hIntInfo[hint][IntCPX], hIntInfo[hint][IntCPY], hIntInfo[hint][IntCPZ], (h + 1000), hIntInfo[hint][IntInterior], -1, 15.0);
HouseMIcon[h] = CreateDynamicMapIcon(Xp, Yp, Zp, 31, -1, world, interior, -1, 50.0);
HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOUR_GREEN, Xp, Yp, Zp+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, world, interior, -1, TEXTLABEL_DISTANCE);
ShowInfoBox(playerid, I_H_CREATED, h);
GetPosInFrontOfPlayer(playerid, Xp, Yp, -2.5);
djSetFloat(file, "SpawnOutX", Xp);
djSetFloat(file, "SpawnOutY", Yp);
djSetFloat(file, "SpawnOutZ", Zp);
djSetFloat(file, "SpawnOutAngle", (180.0 + Angle));
djSetInt(file, "SpawnWorld", world);
djSetInt(file, "SpawnInterior", interior);
djSetInt(file, "HouseInterior", hint);
hInfo[h][SpawnOutX] = Xp, hInfo[h][SpawnOutY] = Yp, hInfo[h][SpawnOutZ] = Zp, hInfo[h][SpawnOutAngle] = (180.0 + Angle);
hInfo[h][SpawnWorld] = world, hInfo[h][SpawnInterior] = interior, hInfo[h][HouseInterior] = hint;
hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
CurrentID++;
format(file, sizeof(file), "SE/House/%d.json", h);
djSetInt(file, "CurrentID", CurrentID);
Iter_Add(Houses, h);
}
return 1;
}
Re: House System (/createhouse) - just 23 houses... -
Re: House System (/createhouse) - just 23 houses... -
Re: House System (/createhouse) - just 23 houses... -
Re: House System (/createhouse) - just 23 houses... -
Re: House System (/createhouse) - just 23 houses... -
Re: House System (/createhouse) - just 23 houses... -