stock LoadEmpresas()
{
new lcount = 0;
for(new l=1; l <= MAX_EMPRESAS; l++)
{
new labeltext[256];
format(STREmp, sizeof(STREmp), "Empresas/%d.ini", l);
if(DOF2_FileExists(STREmp))
{
new text[32];
if(DOF2_GetInt(STREmp, "Estado") != 1)
{
format(text, sizeof(text), "Sim");
}
else
{
format(text, sizeof(text), "Nгo");
}
if(DOF2_GetInt(STREmp, "Tipo Empresa") == 0)
{
PickupEmp[l] = CreateDynamicPickup(1275, 23, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ"), 0, 0, -1, 15.0);
}
else if(DOF2_GetInt(STREmp, "Tipo Empresa") == 1)
{
PickupEmp[l] = CreateDynamicPickup(2867, 23, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ"), 0, 0, -1, 15.0);
}
if(strcmp(PegarDonoEmpresa(l), "Ninguйm", CASE_SENSETIVE))
{
format(labeltext, sizeof(labeltext), "Nome da Loja: %s\nLoja б Venda\nPreзo da Loja: $%d\nLevel: %d\nTrancado: %s\nID Loja: %d", PegarNomeEmpresa(l), GetEmpresaValue(l), DOF2_GetInt(STREmp, "Level"), text, l);
LabelEmp[l] = Create3DTextLabel(labeltext, -1, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ")+0.4, 25, 0, 1);
}
if(!strcmp(PegarDonoEmpresa(l), "Ninguйm", CASE_SENSETIVE))
{
format(labeltext, sizeof(labeltext), "Nome da Loja: %s\nDono: %s\nGerente: %s\nTrancado: %s\nID Loja: %d", PegarNomeEmpresa(l), DOF2_GetString(STREmp,"Dono"), DOF2_GetString(STREmp,"Gerente"), text, l);
LabelEmp[l] = Create3DTextLabel(labeltext, -1, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ")+0.4, 25, 0, 1);
}
lcount++;
}
}
return printf("Total Empresas Loaded: %d", lcount);
}
stock PegarDonoEmpresa(emp)
{
new eowner[MAX_PLAYER_NAME];
format(eowner, MAX_PLAYER_NAME, "Ninguйm");
format(STREmp, sizeof(STREmp), "/Empresas/%d.ini", emp);
if(DOF2_FileExists(STREmp))
{
format(eowner, MAX_PLAYER_NAME, "%s", DOF2_GetString(STREmp, "Dono"));
return eowner;
}
return eowner;
}
stock PegarNomeEmpresa(emp_id)
{
new lname[MAX_PLAYER_NAME];
format(STREmp, sizeof(STREmp), "Empresas/%d.ini", emp_id);
if(DOF2_FileExists(STREmp))
{
format(lname, 64, "%s", DOF2_GetString(STREmp, "Nome da Empresa"));
return lname;
}
return lname;
}
stock GetEmpresaValue(emp_id)
{
format(STREmp, sizeof(STREmp), "Empresas/%d.ini", emp_id);
if(DOF2_FileExists(STREmp))
{
return DOF2_GetInt(STREmp, "Preco");
}
else return printf("Nгo foi possivel localizar o valor de compra da Empresa ID %d. Aqruivo nгo existente...", emp_id);
}
stock LoadEmpresas()
{
new lcount = 0;
print("Entrei no Load Empresas");
for(new l = 1; l <= MAX_EMPRESAS; l++)
{
format(STREmp, sizeof(STREmp), "Empresas/%d.ini", l);
if(DOF2_FileExists(STREmp))
{
new text[32], labeltext[256];
if(DOF2_GetInt(STREmp, "Estado") != 1) format(text, sizeof(text), "Sim");
else format(text, sizeof(text), "Nгo");
if(strcmp(PegarDonoEmpresa(l), "Ninguйm", CASE_SENSETIVE)) format(labeltext, sizeof(labeltext), "Nome da Loja: %s\nLoja б Venda\nPreзo da Loja: $%d\nLevel: %d\nTrancado: %s\nID Loja: %d", PegarNomeEmpresa(l), GetEmpresaValue(l), DOF2_GetInt(STREmp, "Level"), text, l);
else format(labeltext, sizeof(labeltext), "Nome da Loja: %s\nDono: %s\nGerente: %s\nTrancado: %s\nID Loja: %d", PegarNomeEmpresa(l), DOF2_GetString(STREmp,"Dono"), DOF2_GetString(STREmp,"Gerente"), text, l);
PickupEmp[l] = CreateDynamicPickup( DOF2_GetInt(STREmp, "Tipo Empresa") == 0 ? (1275) : (2867), 23, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ"), 0, 0, -1, 15.0);
LabelEmp[l] = Create3DTextLabel(labeltext, -1, DOF2_GetFloat(STREmp, "SaidaX"), DOF2_GetFloat(STREmp, "SaidaY"), DOF2_GetFloat(STREmp, "SaidaZ")+0.4, 25, 0, 1);
lcount++;
}
}
printf("Total Empresas Loaded: %d", lcount);
}
Verifique se Existe a Pasta Empresas dentro da pasta Scriptfiles, existindo a pasta empreasas, verifique se existe o arquivo das empresas estб lб. Se a pasta e os arquivos existirem Certifique-se de que o LoadEmpresas() se encontra no OnGameModeInit, execute com a funзгo que deixei abaixo e verifique no painel se aparece o seguinte texto: Entrei no Load Empresas. Se nгo aparecer troque stock por public! Obs: Lembrando que precisa criar uma forward. pawn Код:
|
public OnGameModeInit()
{
/* Inicializaзгo do servidor */
printf("\n\tServidor inicializado com sucesso!!!\n");
/*------------------ Servidor ---------------------------------------------*/
SetGameModeText("SV - RP/G");
EnableStuntBonusForAll(0);
ShowPlayerMarkers(0);
DisableInteriorEnterExits();
Carregar3DLabels();
CarregarObjectos();
CarregarPickups();
CarregarMapIcons();
/*------------------ Empresas ------------------------------------------------*/
LoadEmpresas();
/*------------------------------------------------------------------------*/
Reloginho1 = TextDrawCreate(543.000000, 1.000000, "~w~~h~00/00/0000");
TextDrawBackgroundColor(Reloginho1, 50);
TextDrawFont(Reloginho1, 1);
TextDrawLetterSize(Reloginho1, 0.360000, 1.900000);
TextDrawColor(Reloginho1, -1);
TextDrawSetOutline(Reloginho1, 1);
TextDrawSetProportional(Reloginho1, 1);
TextDrawSetShadow(Reloginho1, 1);
TextDrawSetSelectable(Reloginho1, 0);
Reloginho2 = TextDrawCreate(551.000000, 28.000000, "~w~~h~00:00:00");
TextDrawBackgroundColor(Reloginho2, 50);
TextDrawFont(Reloginho2, 1);
TextDrawLetterSize(Reloginho2, 0.360000, 1.900000);
TextDrawColor(Reloginho2, -1);
TextDrawSetOutline(Reloginho2, 1);
TextDrawSetProportional(Reloginho2, 1);
TextDrawSetShadow(Reloginho2, 1);
TextDrawSetSelectable(Reloginho2, 0);
/*------------------------------------------------------------------------*/
SetTimer("Reloginho", 1000, true);
/*------------------------------------------------------------------------*/
return 1;
}