Jump to content
  • 0

Problema createhouse


Dekker

Question

Am luat un sistem de case  GarHouse , cand scrie /createhouse imi apare /createhouse (house price) (ID:optional level sau ceva in genu) cand dau /createhouse 1200000 , acelasi meniu imi apare , nu se creaza casa. Ce poate avea ????

[pawn]CMD:createhouse(playerid, params[])

{

new cost, h = GetFreeHouseID(), labeltext[250], hint;

if(!IsPlayerAdmin(playerid)) return 0;

if(sscanf(params, "dD(" #DEFAULT_H_INTERIOR ")", 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 > 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

{

        fcreate(HouseFile(h));

GetPlayerPos(playerid, X, Y, Z);

GetPlayerFacingAngle(playerid, Angle);

new world = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);

hInfo[h][CPOutX] = X, hInfo[h][CPOutY] = Y, hInfo[h][CPOutZ] = Z;

format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);

format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);

format(hInfo[h][HouseLocation], MAX_ZONE_NAME, "%s", GetHouseLocation(h));

hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");

hInfo[h][HouseValue] = cost, hInfo[h][HouseStorage] = 0;

new INI:file = INI_Open(HouseFile(h));

INI_WriteFloat(file, "CPOutX", X);

INI_WriteFloat(file, "CPOutY", Y);

INI_WriteFloat(file, "CPOutZ", Z);

INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);

INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);

INI_WriteString(file, "HouseLocation", hInfo[h][HouseLocation]);

INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);

INI_WriteString(file, "HouseCreator", pNick(playerid));

INI_WriteInt(file, "HouseValue", cost);

INI_WriteInt(file, "HouseStorage", 0);

format(labeltext, sizeof(labeltext), LABELTEXT1, DEFAULT_HOUSE_NAME, cost, h);

#if GH_USE_CPS == true

HouseCPOut[h] = CreateDynamicCP(X, Y, Z, 1.5, world, interior, -1, CP_DRAWDISTANCE);

HouseCPInt[h] = CreateDynamicCP(hIntInfo[hint][intCPX], hIntInfo[hint][intCPY], hIntInfo[hint][intCPZ], 1.5, (h + 1000), hIntInfo[hint][intInterior], -1, 15.0);

#else

HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, X, Y, Z, world, interior, -1, 15.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);

#endif

#if GH_USE_MAPICONS == true

HouseMIcon[h] = CreateDynamicMapIcon(X, Y, Z, 31, -1, world, interior, -1, 50.0);

#endif

HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOUR_GREEN, X, Y, Z+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, X, Y, -2.5);

INI_WriteFloat(file, "SpawnOutX", X);

INI_WriteFloat(file, "SpawnOutY", Y);

INI_WriteFloat(file, "SpawnOutZ", Z);

INI_WriteFloat(file, "SpawnOutAngle", (180.0 + Angle));

INI_WriteInt(file, "SpawnWorld", world);

INI_WriteInt(file, "SpawnInterior", interior);

INI_WriteInt(file, "HouseInterior", hint);

hInfo[h][spawnOutX] = X, hInfo[h][spawnOutY] = Y, hInfo[h][spawnOutZ] = Z, 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;

INI_Close(file);

CurrentID++;

file = INI_Open("/GarHouse/House.ini");

INI_WriteInt(file, "CurrentID", CurrentID);

INI_Close(file);

SetPVarInt(playerid, "JustCreatedHouse", 1);

Iter_Add(Houses, h);

}

    return 1;

}[/pawn]

[email protected] - Orice mapa doriti , add me !

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.