[Ajuda] Sistema salvamento
#1

Primeiramente nao intendo esse sistema de salvamento porem presciso usar ele !!!

Pra comeзar ele da erro ...
pawn Код:
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(37) : error 017: undefined symbol "ano"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(38) : error 017: undefined symbol "month"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(39) : error 017: undefined symbol "dia"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(40) : error 017: undefined symbol "horas"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(41) : error 017: undefined symbol "minutos"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(42) : error 017: undefined symbol "segundos"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(49) : error 035: argument type mismatch (argument 2)
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(51) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(52) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(53) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(54) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(55) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(56) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(57) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(58) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(59) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(60) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(61) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(62) : error 033: array must be indexed (variable "month")
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(64) : error 017: undefined symbol "PFile"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(64) : error 017: undefined symbol "file"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(65) : error 017: undefined symbol "file"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(65) : error 017: undefined symbol "file"
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(65) : error 029: invalid expression, assumed zero
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(65) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


25 Errors.
Linhas
pawn Код:
forward LoadHours(playerid);
public LoadHours(playerid)
{
   new ParameterValue[50];
   if (strcmp(DName, "Uano", false) == 0)     format(ano, 50, ParameterValue);// Linha 37
   if (strcmp(DName, "Umonth", false) == 0)   format(month, 50, ParameterValue);// Linha 38
   if (strcmp(DName, "Udia", false) == 0)     format(dia, 50, ParameterValue); // Linha 40
   if (strcmp(DName, "Uhoras", false) == 0)   format(horas, 50, ParameterValue); // Linha 41
   if (strcmp(DName, "Uminutos", false) == 0) format(minutos, 50, ParameterValue); // Linha 42
   if (strcmp(DName, "Usegundos", false) == 0)format(segundos, 50, ParameterValue); // Linha 43
   return true; // Linha 44
}// Linha 45
forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month[12],dia,horas,minutos,segundos, mes[13]; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    if(month == 1)       mes = "01"; // Linha 52
    else if(month == 2)  mes = "02"; // Linha 53
    else if(month == 3)  mes = "03"; // Linha 54
    else if(month == 4)  mes = "04"; // Linha 55
    else if(month == 5)  mes = "05"; // Linha 56
    else if(month == 6)  mes = "06"; // Linha 57
Como nao me importo ai vai o code completo

pawn Код:
#include a_samp
new DName[MAX_PLAYER_NAME];
public OnFilterScriptInit()
{
    SetTimer("ContasInativas", 1000, true);
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    LoadHours(playerid);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    SalveHours(playerid);
    return 1;
}
forward LoadHours(playerid);
public LoadHours(playerid)
{
   new ParameterValue[50];
   if (strcmp(DName, "Uano", false) == 0)     format(ano, 50, ParameterValue);// Linha 37
   if (strcmp(DName, "Umonth", false) == 0)   format(month, 50, ParameterValue);// Linha 38
   if (strcmp(DName, "Udia", false) == 0)     format(dia, 50, ParameterValue); // Linha 40
   if (strcmp(DName, "Uhoras", false) == 0)   format(horas, 50, ParameterValue); // Linha 41
   if (strcmp(DName, "Uminutos", false) == 0) format(minutos, 50, ParameterValue); // Linha 42
   if (strcmp(DName, "Usegundos", false) == 0)format(segundos, 50, ParameterValue); // Linha 43
   return true; // Linha 44
}// Linha 45
forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month[12],dia,horas,minutos,segundos, mes[13]; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    if(month == 1)       mes = "01"; // Linha 52
    else if(month == 2)  mes = "02"; // Linha 53
    else if(month == 3)  mes = "03"; // Linha 54
    else if(month == 4)  mes = "04"; // Linha 55
    else if(month == 5)  mes = "05"; // Linha 56
    else if(month == 6)  mes = "06"; // Linha 57
    else if(month == 7)  mes = "07";
    else if(month == 8)  mes = "08";
    else if(month == 9)  mes = "09";
    else if(month == 10) mes = "10";
    else if(month == 11) mes = "11";
    else if(month == 12) mes = "12";
   
    PFile = fopen(file, io_write);
    format(file, sizeof(file), "/ServerData/Players/%s", DName);
    if (!fexist(file))
    {
        format(LineForFile, 100, "Uano %i\r\n", 0);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Umonth %i\r\n", 0);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Udia %i\r\n", 0);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Uhoras %i\r\n", 0);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Uminutos %i\r\n", 0);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Usegundos %i\r\n", 0);
        fwrite(PFile, LineForFile);
    }
    else
    {
        format(LineForFile, 100, "Uano %i\r\n", ano);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Umonth %i\r\n", month);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Udia %i\r\n", dia);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Uhoras %i\r\n", horas);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Uminutos %i\r\n", minutos);
        fwrite(PFile, LineForFile);
        format(LineForFile, 100, "Usegundos %i\r\n", segundos);
        fwrite(PFile, LineForFile);
    }
    return true;
}
stock ContasInativas()
{
    #define Possiveis_Palavras  50
    new string[128];
    format(file, sizeof(file), "/ServerData/Players/%s", DName);
    for(new x = 0; x <= Possiveis_Palavras; x++)
    {
        format(string, sizeof(string), "/ServerData/Players/%s%s%s%s%s%s%s%s%s%s", random(127), random(127)
        ,random(127), random(127), random(127), random(127), random(127), random(127), random(127), random(127)
        ,random(127), random(127), random(127), random(127), random(127), random(127), random(127), random(127)
        ,random(127), random(127), random(127), random(127));
        if (fexist(string))
        {
            getdate(ano, month, dia);
            if(fwrite(File,"Udia") 6 < || dia > 6)
            {
                fremove(file);
            }
    }
    return true;
}
Aprveitando o topico ...
Queria que isso checasse se o player nao loga a 12 dias mas seila nao e bem assim que eu fiz kkkkk

pawn Код:
if (fexist(string))
        {
            getdate(ano, month, dia);
            if(fwrite(File,"Udia") 6 < || dia > 6)
            {
                fremove(file);
            }
    }
Desde ja obrigado!!!!!!
Reply
#2

pawn Код:
forward LoadHours(playerid);
public LoadHours(playerid)
{
   new ParameterValue[50], ano[50], month[50], dia[50], horas[50], minutos[50], segundos[50];
   if (strcmp(DName, "Uano", false) == 0)     format(ano, 50, ParameterValue);// Linha 37
   if (strcmp(DName, "Umonth", false) == 0)   format(month, 50, ParameterValue);// Linha 38
   if (strcmp(DName, "Udia", false) == 0)     format(dia, 50, ParameterValue); // Linha 40
   if (strcmp(DName, "Uhoras", false) == 0)   format(horas, 50, ParameterValue); // Linha 41
   if (strcmp(DName, "Uminutos", false) == 0) format(minutos, 50, ParameterValue); // Linha 42
   if (strcmp(DName, "Usegundos", false) == 0)format(segundos, 50, ParameterValue); // Linha 43
   return true; // Linha 44
}// Linha 45
forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month,dia,horas,minutos,segundos, mes[13]; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    if(month == 1)       mes = "01"; // Linha 52
    else if(month == 2)  mes = "02"; // Linha 53
    else if(month == 3)  mes = "03"; // Linha 54
    else if(month == 4)  mes = "04"; // Linha 55
    else if(month == 5)  mes = "05"; // Linha 56
    else if(month == 6)  mes = "06"; // Linha 57
   
// --- Mais Fбcil ---

forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month,dia,horas,minutos,segundos; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    format(SuaString, sizeof(SuaString), "%02d", mes); //Assim mкs ficarб com 2 digitos(01, 02...)
   
// --- Verificar Contas Off mais de 12 Dias ---

if(fexist(file)) {
    if(DOF2_GetInt(file, "TimeConnect") <= (gettime() - 12 * 24 * 60 * 60)) {
        fremove(file);
    }
}

// --- OnPlayerConnect ---
DOF2_SetInt(file, "TimeConnect", gettime());
Reply
#3

Vocк num esqueceu de
pawn Код:
#include file
Reply
#4

a_samp jб inclui file.
Reply
#5

Aй nem lembrava :/.
Reply
#6

Se deu 26 erros deve ter se esqueзido de fechar algum "}"
Reply
#7

Quote:
Originally Posted by paulor
Посмотреть сообщение
pawn Код:
forward LoadHours(playerid);
public LoadHours(playerid)
{
   new ParameterValue[50], ano[50], month[50], dia[50], horas[50], minutos[50], segundos[50];
   if (strcmp(DName, "Uano", false) == 0)     format(ano, 50, ParameterValue);// Linha 37
   if (strcmp(DName, "Umonth", false) == 0)   format(month, 50, ParameterValue);// Linha 38
   if (strcmp(DName, "Udia", false) == 0)     format(dia, 50, ParameterValue); // Linha 40
   if (strcmp(DName, "Uhoras", false) == 0)   format(horas, 50, ParameterValue); // Linha 41
   if (strcmp(DName, "Uminutos", false) == 0) format(minutos, 50, ParameterValue); // Linha 42
   if (strcmp(DName, "Usegundos", false) == 0)format(segundos, 50, ParameterValue); // Linha 43
   return true; // Linha 44
}// Linha 45
forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month,dia,horas,minutos,segundos, mes[13]; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    if(month == 1)       mes = "01"; // Linha 52
    else if(month == 2)  mes = "02"; // Linha 53
    else if(month == 3)  mes = "03"; // Linha 54
    else if(month == 4)  mes = "04"; // Linha 55
    else if(month == 5)  mes = "05"; // Linha 56
    else if(month == 6)  mes = "06"; // Linha 57
   
// --- Mais Fбcil ---

forward SalveHours(playerid); // Linha 46
public SalveHours(playerid) // Linha 47
{ // Linha 48
    new ano,month,dia,horas,minutos,segundos; // Linha 49
    getdate(ano, month, dia); // Linha 50
    gettime(horas,minutos,segundos); // Linha 51
    format(SuaString, sizeof(SuaString), "%02d", mes); //Assim mкs ficarб com 2 digitos(01, 02...)
   
// --- Verificar Contas Off mais de 12 Dias ---

if(fexist(file)) {
    if(DOF2_GetInt(file, "TimeConnect") <= (gettime() - 12 * 24 * 60 * 60)) {
        fremove(file);
    }
}

// --- OnPlayerConnect ---
DOF2_SetInt(file, "TimeConnect", gettime());
Pq DOF
To testando o resto e ja do edit!
Reply
#8

Quote:
Originally Posted by caoraivoso3
Посмотреть сообщение
Se deu 26 erros deve ter se esqueзido de fechar algum "}"
No deu 26 erros deu 25 cara

observe todos os detalhes manolo
Reply
#9

Deu seguintes erros e avisos ...
pawn Код:
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(70) : error 035: argument type mismatch (argument 1)
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(70) : error 035: argument type mismatch (argument 1)
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(73) : warning 213: tag mismatch
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(76) : warning 213: tag mismatch
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(78) : warning 213: tag mismatch
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(80) : warning 213: tag mismatch
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(82) : warning 213: tag mismatch
C:\Users\Mauricio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(84) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Code onde esta o erro ...
pawn Код:
forward SalveHours(playerid);
public SalveHours(playerid)
{
    new ano,month,dia,horas,minutos,segundos,LineForFile[50],PFile;
    getdate(ano, month, dia);
    gettime(horas,minutos,segundos);

    GetPlayerName(playerid,DName,sizeof(DName));
    format(PFile, sizeof(PFile), "/ServerData/Players/%s", DName);//comeзa aqui linha 70
   
    format(LineForFile, sizeof(LineForFile), "%02d", ano);
    fwrite(PFile, LineForFile);
   
    format(LineForFile, sizeof(LineForFile), "%02d", month);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", dia);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", horas);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", minutos);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", segundos);
    fwrite(PFile, LineForFile);
    return true;

}
Reply
#10

mudar "PFile" para uma string ao invйs de ser um inteiro.
Reply
#11

pawn Код:
forward SalveHours(playerid);
public SalveHours(playerid)
{
    new ano,month,dia,horas,minutos,segundos,LineForFile[50],PFile[128];
    getdate(ano, month, dia);
    gettime(horas,minutos,segundos);

    GetPlayerName(playerid,DName,sizeof(DName));
    format(PFile, sizeof(PFile), "/ServerData/Players/%s", DName);//comeзa aqui linha 70
   
    format(LineForFile, sizeof(LineForFile), "%02d", ano);
    fwrite(PFile, LineForFile);
   
    format(LineForFile, sizeof(LineForFile), "%02d", month);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", dia);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", horas);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", minutos);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", segundos);
    fwrite(PFile, LineForFile);
    return true;

}
Vou dar um alerta, isso ae pra ler dps nгo vai ser possнvel, pois as funзхes do samp vc tem que quebrar linhas..
Ex:

pawn Код:
format(LineForFile, sizeof(LineForFile), "%02d", month);
fwrite(PFile, LineForFile);
format(LineForFile, sizeof(LineForFile), "%02d", dia);
fwrite(PFile, LineForFile);
Supondo que o valor de month seja 05 e de dia seja 02, ficarб assim no arquivo: 0502
Reply
#12

Quote:
Originally Posted by paulor
Посмотреть сообщение
pawn Код:
forward SalveHours(playerid);
public SalveHours(playerid)
{
    new ano,month,dia,horas,minutos,segundos,LineForFile[50],PFile[128];
    getdate(ano, month, dia);
    gettime(horas,minutos,segundos);

    GetPlayerName(playerid,DName,sizeof(DName));
    format(PFile, sizeof(PFile), "/ServerData/Players/%s", DName);//comeзa aqui linha 70
   
    format(LineForFile, sizeof(LineForFile), "%02d", ano);
    fwrite(PFile, LineForFile);
   
    format(LineForFile, sizeof(LineForFile), "%02d", month);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", dia);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", horas);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", minutos);
    fwrite(PFile, LineForFile);
    format(LineForFile, sizeof(LineForFile), "%02d", segundos);
    fwrite(PFile, LineForFile);
    return true;

}
Vou dar um alerta, isso ae pra ler dps nгo vai ser possнvel, pois as funзхes do samp vc tem que quebrar linhas..
Ex:

pawn Код:
format(LineForFile, sizeof(LineForFile), "%02d", month);
fwrite(PFile, LineForFile);
format(LineForFile, sizeof(LineForFile), "%02d", dia);
fwrite(PFile, LineForFile);
Supondo que o valor de month seja 05 e de dia seja 02, ficarб assim no arquivo: 0502
Eu so esqueci de algumas coisa nele

Porem arrumei 2 erro surgiu 6 das linhas
pawn Код:
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(73) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(76) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(78) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(80) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(82) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Maurilio\Desktop\SAMPSERVER\gamemodes\Inactived.pwn(84) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Linhas
pawn Код:
forward SalveHours(playerid);
public SalveHours(playerid)
{
    new ano,month,dia,horas,minutos,segundos,Don[50],PFile[50];
    getdate(ano, month, dia);
    gettime(horas,minutos,segundos);

    GetPlayerName(playerid,DName,sizeof(DName));
    format(PFile, sizeof(PFile), "/ServerData/Players/%s", DName);
   
    format(Don, sizeof(Don), "%02d", ano);
    fwrite(PFile, Don);//erro aqui
   
    format(Don, sizeof(Don), "%02d\r\n", month);
    fwrite(PFile, Don);//erro aqui
    format(Don, sizeof(Don), "%02d\r\n", dia);
    fwrite(PFile, Don);//erro aqui
    format(Don, sizeof(Don), "%02d\r\n", horas);
    fwrite(PFile, Don);//erro aqui
    format(Don, sizeof(Don), "%02d\r\n", minutos);
    fwrite(PFile, Don);//erro aqui
    format(Don, sizeof(Don), "%02d\r\n", segundos);
    fwrite(PFile, Don);//erro aqui
    return true;

}
Reply
#13

@Double-post
Alguem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)