CarregarCasa(casas)
{
new query[250];
new dono[64];
for(new c = 0; c < MAX_CASAS; c++)
{
format(query, sizeof(query), "Casas/Casa%d.ini", c);
houseData[c][houseX] = DOF2_GetFloat(query, "PosX");
houseData[c][houseY] = DOF2_GetFloat(query, "PosY");
houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ");
strcat(dono, DOF2_GetString(query, "Dono"));
houseData[c][Dono] = dono;
houseData[c][PrecoH] = DOF2_GetInt(query, "Preco");
houseData[c][CasaID] = DOF2_GetInt(query, "CasaId");
CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0);
format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono],c);
CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0);
}
return 1;
}
format(houseData[c][Dono], 24, DOF2_GetString(query, "Dono"));
Leia isso: https://sampwiki.blast.hk/wiki/Strcat
PHP код:
|
format(houseData[c][Dono], 24, "%s", DOF2_GetString(query, "Dono"));
new Text3D:LabelCasa[MAX_CASAS];
CarregarCasa(casas)
{
new query[250];
new dono[64];
new PickupId;
for(new c = 0; c < MAX_CASAS; c++)
{
format(query, sizeof(query), "Casas/Casa%d.ini", c);
houseData[c][houseX] = DOF2_GetFloat(query, "PosX");
houseData[c][houseY] = DOF2_GetFloat(query, "PosY");
houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ");
houseData[c][Dono] = DOF2_GetString(query, "Dono"));
houseData[c][PrecoH] = DOF2_GetInt(query, "Preco");
houseData[c][CasaID] = DOF2_GetInt(query, "CasaId");
PickupId = CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0);
DOF2_SetInt(query, "PickupId", PickupId);
format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c);
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0);
}
return 1;
}
PHP код:
mas acho que assim tbm da acho que falto o LabelCasa esse carregar casa se vc for colocar no OnGameModeInit a minha e outra funзгo que so carrega: Pickup, mapicon й TextLabel o resto carrega sem erros e conflitos |
Dessa forma funcionou, porйm gerou outro bug, quando atualiza o 3DTextLabel ele fica sobreposto com o antigo em vez de atualizar
|
new Text3D:LabelCasa[MAX_CASAS]; CarregarCasa(casas) { new query[250]; new dono[64]; new PickupId; for(new c = 0; c < MAX_CASAS; c++) { format(query, sizeof(query), "Casas/Casa%d.ini", c); houseData[c][houseX] = DOF2_GetFloat(query, "PosX"); houseData[c][houseY] = DOF2_GetFloat(query, "PosY"); houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ"); houseData[c][Dono] = DOF2_GetString(query, "Dono")); houseData[c][PrecoH] = DOF2_GetInt(query, "Preco"); houseData[c][CasaID] = DOF2_GetInt(query, "CasaId"); PickupId = CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0); DOF2_SetInt(query, "PickupId", PickupId); format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c); if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID) { LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0); } else { Update3DTextLabelText(LabelCasa[c], -1, STRX); } } return 1; }
Vocк tem que checar se hб uma textdraw criada para aquela casa, se hб, vocк deve atualiza-la, nгo criar outra.
Код:
new Text3D:LabelCasa[MAX_CASAS]; CarregarCasa(casas) { new query[250]; new dono[64]; new PickupId; for(new c = 0; c < MAX_CASAS; c++) { format(query, sizeof(query), "Casas/Casa%d.ini", c); houseData[c][houseX] = DOF2_GetFloat(query, "PosX"); houseData[c][houseY] = DOF2_GetFloat(query, "PosY"); houseData[c][houseZ] = DOF2_GetFloat(query, "PosZ"); houseData[c][Dono] = DOF2_GetString(query, "Dono")); houseData[c][PrecoH] = DOF2_GetInt(query, "Preco"); houseData[c][CasaID] = DOF2_GetInt(query, "CasaId"); PickupId = CreateDynamicPickup(1273, 1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], -1, -1, -1, 3.0); DOF2_SetInt(query, "PickupId", PickupId); format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c); if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID) { LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0); } else { Update3DTextLabelText(LabelCasa[c], -1, STRX); } } return 1; } |
format(STRX, sizeof(STRX), "{00FFFF}Dono(a): {FFFFFF}%s \n\n{00FFFF}CasaID:{FFFFFF}%d", houseData[c][Dono], c);
UpdateDynamic3DTextLabelText(LabelCasa[c], Branco, STRX);
if(LabelCasa[c] == Text3D:INVALID_3DTEXT_ID)
{
LabelCasa[c] = CreateDynamic3DTextLabel(STRX, -1, houseData[c][houseX], houseData[c][houseY], houseData[c][houseZ], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 3.0);
}
else
{
UpdateDynamic3DTextLabelText(LabelCasa[c], Branco, STRX);
}
Tenta assim:
PHP код:
ou assim: PHP код:
|