14.04.2019, 05:23
I make an simple house system with interoir and its work, but still have little problem, here is the code:
Can you help me to fix? when i added a house interior, it created an yellow marker, but the yellow marker not animated (go up-down) like a normal interior marker in gta san andreas. Did i miss something from the code above? really need help for this.
Code:
CMD:addhouseint(playerid, params[])
{
new giveplayerid, moneys1, string[256], tmp2[256];
if (adlvl[playerid] < 6) return 0;
if (sscanf(params, "dd", giveplayerid, moneys1)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /addhouseint [houseid] [door]");
format(string, 10, "prop%d", giveplayerid);
if (!dini_Exists(AddDirFile(dir_propfiles, string))) return SendClientMessage2(playerid, COLOR_RED, "Invalid house id.");
if (moneys1 < 1 || moneys1 > MAX_PROP_INTS) return SendClientMessage2(playerid, COLOR_RED, "Invalid door id.");
if (GetPlayerShamalID(playerid) != 0) return SendClientMessage2(playerid, COLOR_RED, "You can't add house interiors to this interior.");
new temp1, temp2;
temp1 = dini_Int(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "maxpropint");
temp2 = dini_Isset(AddDirFile(dir_propfiles, string), "interior") ? dini_Int(AddDirFile(dir_propfiles, string), "interior") : temp1+1;
format(tmp2, 12, "propint%d", temp2);
if (temp2 == temp1+1)
{
dini_IntSet(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "maxpropint", temp2);
dini_Create(AddDirFile(dir_propints, tmp2));
dini_IntSet(AddDirFile(dir_propints, tmp2), "propid", giveplayerid);
dini_IntSet(AddDirFile(dir_propfiles, string), "interior", temp2);
}
temp1 = temp2 + dini_Int(AddDirFile(dir_datafiles, FILE_TOTALSTAT), "enterexits");
GetPlayerPos(playerid, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]);
GetPlayerFacingAngleFix(playerid, adata[temp1][aa]);
adata[temp1][aa] = adata[temp1][aa] < 180.0 ? adata[temp1][aa] + 180.0 : adata[temp1][aa] - 180.0;
adata[temp1][linkto] = propdoors[moneys1-1];
adata[temp1][ax] += floatsin(-adata[temp1][aa], degrees) * 0.3;
adata[temp1][ay] += floatcos(-adata[temp1][aa], degrees) * 0.3;
dini_IntSet(AddDirFile(dir_propints, string), "locked", 0);
dini_IntSet(AddDirFile(dir_propints, tmp2), "door", propdoors[moneys1-1]);
dini_FloatSet(AddDirFile(dir_propints, tmp2), "X", adata[temp1][ax]);
dini_FloatSet(AddDirFile(dir_propints, tmp2), "Y", adata[temp1][ay]);
dini_FloatSet(AddDirFile(dir_propints, tmp2), "Z", adata[temp1][az]);
dini_FloatSet(AddDirFile(dir_propints, tmp2), "A", adata[temp1][aa]);
if (propints[temp2] != 0)
{
DestroyDynamicObject(propints[temp2]);
propints[temp2] = 0;
for (new i = 1; i <= MAX_AREAS; i++)
{
if (areatype[i][1] == temp1)
{
DestroyDynamicArea(i);
areatype[i][0] = 0;
areatype[i][1] = 0;
break;
}
}
}
propints[temp2] = CreateDynamicObject(19198, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]+0.35, 0.0, 0.0, 0.0, -1, -1, -1, 50.0);
moneys1 = CreateDynamicSphere(adata[temp1][ax], adata[temp1][ay], adata[temp1][az], 1.0, -1, -1, -1);
areatype[moneys1][0] = AREA_TYPE_ENTEREXIT;
areatype[moneys1][1] = temp1;
areatype[moneys1][2] = temp2;
for (new i = 0; i < PLAYERS; i++)
{
if (IsPlayerInRangeOfPoint(i, 50.0, adata[temp1][ax], adata[temp1][ay], adata[temp1][az]+0.35)) Streamer_Update(i);
}
format(string, 64, "Added interior to house ID %d", giveplayerid);
SendClientMessage2(playerid, COLOR_WHITE, string);
return 1;
}

