SA-MP Forums Archive
[Ajuda] Must be assigned to an array - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Must be assigned to an array (/showthread.php?tid=654393)



Must be assigned to an array - Luiiiz - 27.05.2018

Voltei a mexer em minha GM para alguns estudos e estou fazendo um sistema de profissгo porйm, eu tф fazendo um TimerEx para ficar salvando a profissгo na variбvel Profissao[playerid] e salvando a profissгo que o jogador estб em DOF2. Й uma lуgica meio sem sentido mas jб que eu nгo pretendo abrir essa GM й o de menos kkk.
Estб dando o seguinte erro: error 006: must be assigned to an array
Meus planos para fazer esse sistema й fazer algo parecido com:
PHP код:
if(Profissao[playerid] == Desempregado)
{
    ...

Code:
PHP код:
forward ConferirProfissao(playerid);
public 
ConferirProfissao(playerid)
{
    new 
file[50], pname[20];
    
format(filesizeof(file), "Contas/%s.ini"pname);
        
GetPlayerName(playeridpname20);
    
Profissao[playerid] = DOF2_GetString(file"Profissao"); // Linha do erro
    
DOF2_SetString(file"Profissao"Profissao[playerid]);
    return 
1;

Bugou a identaзгo, mas й o de menos jб que no Pawno estб identada certinho.


Re: Must be assigned to an array - Minerva - 27.05.2018

PHP код:
format(Profissao[playerid], 30DOF::GetString(file"Profissao"); 



Re: Must be assigned to an array - Cleyson - 29.05.2018

PHP код:
new Profissao[MAX_PLAYERS]; // variбvel para armazenar o valor de cada prof
#define Desempregado 0 // id das prof
forward ConferirProfissao(playerid); 
public 
ConferirProfissao(playerid

    new 
file[50], pname[24]; 
    
GetPlayerName(playeridpname24);
    
format(filesizeof(file), "Contas/%s.ini"pname);  
    
Profissao[playerid] = DOF2_GetInt(file"Profissao");
    return 
1

Te aconselho a dar uma olhada sobre as funзхes do salvamento em ficheiros dof2
https://sampforum.blast.hk/showthread.php?tid=350855


Re: Must be assigned to an array - AutoMatic2 - 29.05.2018

faz um sistema de login e registro por dof2 e usa os salvamentos :v

PHP код:
Profissao[playerid] = DOF2_GetInt(file"Profissao"); 
isso aki:

PHP код:
DOF2_SetInt(file"Profissao"Profissao[playerid]); 
e quando o player desconectar do servidor

tipo:

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    if(
DOF2_FileExists(file))
    {
        
DOF2_CreateFile(file);
        
DOF2_SetInt(file"Profissao"Profissao[playerid]);
        
DOF2_SaveFile();
    }
    return 
1;

to com preguiзa de formatar o file '-' vlw flw ;-;