27.02.2018, 07:21
Quote:
Seu mйtodo й muito ruim. Faзa assim:
Код:
new Float:posto_pos[][] = { {0.0, 0.0, 0.0}, {1.1, 1.1, 1.1}, {2.2, 2.2, 2.2} // Adicione mais coordenadas }; new Text3D:GasTOTAL[20 /*nъmero de labels*/]; stock NoPosto(playerid) { for(new i = 0; i < sizeof posto_pos; ++ i) { if(IsPlayerInRangeOfPoint(playerid, 15.0, posto_pos[i][0], posto_pos[i][1], posto_pos[i][2])) return true; } return false; } stock CriarPostoTxtLabel() // OnGameModeInit { for(new i = 0; i < sizeof GasTOTAL; ++ i) GasTOTAL[i] = Create3DTextLabel(quantGas, -1, posto_pos[i][0], posto_pos[i][1], posto_pos[i][2], 50, 0, 0); return true; } |
Fiz um comando para testar a adiзгo de combustнvel, para somar em todos os postos. Porйm, a quantia no database nгo bate com o valor das Label, por exemplo, na Label bate 5 litros, no .ini bate 22 litros.
Poderia me ajudar?
PHP код:
new Entrega_Gas; // Valor Dinвmico Combustнvel
#define Quantia_Gas "TotalGasolina.ini"
PHP код:
for(new i = 0; i < sizeof posto_pos; ++ i) // OnGameMode
{
new quantGas[80];
format(quantGas, 128,"{FFFFFF}Posto de Combustнvel\n/Abastecer\n{00FF7F}Disponнvel: %i L", Entrega_Gas);
GasTOTAL[i] = Create3DTextLabel(quantGas, -1, posto_pos[i][0], posto_pos[i][1], posto_pos[i][2], 50, 0, 0);
}
CarregarGasolina();
PHP код:
stock CarregarGasolina() {
if(DOF2_FileExists(Quantia_Gas)) {
Entrega_Gas = DOF2_GetInt(Quantia_Gas, "Entrega_Gas");
printf("[GAS] Ha um total de %i litros de combustivel nos postos.\r\n", Entrega_Gas);
}
else if(!DOF2_FileExists(Quantia_Gas)) {
DOF2_CreateFile(Quantia_Gas);
DOF2_SetInt(Quantia_Gas, "Entrega_Gas", 200);
DOF2_SaveFile();
}
return 1;
}
stock SalvarGasolina() {
if(DOF2_FileExists(Quantia_Gas))
{
DOF2_SetInt(Quantia_Gas, "Entrega_Gas", Entrega_Gas);
DOF2_SaveFile();
}
else if(!DOF2_FileExists(Quantia_Gas))
{
DOF2_CreateFile(Quantia_Gas);
DOF2_SetInt(Quantia_Gas, "Entrega_Gas", 200);
DOF2_SaveFile();
}
CarregarGasolina();
return 1;
}
Estou usando a atribuiзгo como:
PHP код:
Entrega_Gas++;