Szerző Téma: Mentés  (Megtekintve 980 alkalommal)

Mentés
« Dátum: 2014. Április 06. - 11:04:20 »
0 Show voters
Helló.
Meg csináltam hogy mentse dinivel de csak egy .ini fájt csinál és a másodpercet percet órát nem menti le , csak 0kat ír oda. Valaki nem tudja miért?
script:
 
#include <a_samp>
#include <dini>
#include <zcmd>
#define COLOR_RED 0xFF0000FF
new fido_timer[MAX_PLAYERS];
enum JatekosInfo
{
FOra,
FPerc,
FMPerc,
}
new PlayerTime[MAX_PLAYERS][JatekosInfo];
new FIdo[MAX_PLAYERS][JatekosInfo];
forward PlayedTime(playerid);
forward Uzenet(playerid);
public OnPlayerConnect(playerid)
{
        new file[128];
fido_timer[playerid] = SetTimerEx(\"tfido\", 1000, true, \"i\", playerid);
        if(!fexist(file))
        {
                    new name[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(file,sizeof(file),\"/Szerver/%s.ini\",name);
                        if(!fexist(file))
                        {
                                dini_Create(file);
                               dini_IntSet(file, \"FMPerc\", 0);
                                dini_IntSet(file, \"FPerc\", 0);
                                dini_IntSet(file, \"FOra\", 0);
                        }
        }
        if(fexist(file))
        {
                        new name[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(file,sizeof(file),\"/Szerver/%s.ini\",name);
                        if(fexist(file))
                        {
                                        PlayerTime[playerid][FMPerc] = dini_Int(file, \"FMPerc\");
                                        PlayerTime[playerid][FPerc] = dini_Int(file, \"FPerc\");
                                        PlayerTime[playerid][FOra] = dini_Int(file, \"FOra\");
                        }
        }
        return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    format(file,sizeof(file),\"%s.ini\",name);
        if(fexist(file))
        {
              dini_IntSet(file, \"FMPerc\", PlayerTime[playerid][FMPerc]);
                dini_IntSet(file, \"FPerc\", PlayerTime[playerid][FPerc]);
                dini_IntSet(file, \"POra\", PlayerTime[playerid][FOra]);
                KillTimer(fido_timer[playerid]);
        }
        return 1;
}
forward tfido(playerid);
public tfido(playerid)
{
FIdo[playerid][FMPerc] ++;
if(FIdo[playerid][FMPerc] == 60)
{
        FIdo[playerid][FMPerc] = 0;
       FIdo[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(FIdo[playerid][FPerc] == 60)
    {
       FIdo[playerid][FMPerc] = 0;
        FIdo[playerid][FPerc] = 0;
         FIdo[playerid][FOra] ++;
          SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}
CMD:stat(playerid, params[])
{
new fido[256];
format(fido, sizeof(fido), \"|| Fent lévõ Óra: %02d | Perc: %02d | MásodPerc: %02d ||\", FIdo[playerid][FOra], FIdo[playerid][FPerc], FIdo[playerid][FMPerc]);
SendClientMessage(playerid, -1, fido);
return 1;
}

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #1 Dátum: 2014. Április 06. - 11:07:35 »
0 Show voters
dini_IntSet(file, \"POra\", PlayerTime[playerid][FOra]);

 
A POra-t akarod menteni, de FOrat töltesz be. Akkor ide is FOra kéne, nem?
 
dini_IntSet(file, \"FOra\", PlayerTime[playerid][FOra]);

Mentés
« Válasz #2 Dátum: 2014. Április 06. - 11:17:24 »
0 Show voters
Valami nemjó :S ki fagy tõle a szerver ha felépek  :S

Dupla hozzászólás automatikusan összefûzve. ( 2014. Április 06. - 11:58:06 )

Még így se menti le :S
http://kepfeltoltes.hu/view/140406/sss_www.kepfeltoltes.hu_.png
« Utoljára szerkesztve: 2014. Április 06. - 11:58:06 írta Heromen »

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #3 Dátum: 2014. Április 06. - 12:05:16 »
0 Show voters
format(file,sizeof(file),\"%s.ini\",name);

 
Esetleg e helyett nem ez kéne? Máshol így van:
 
format(file,sizeof(file),\"/Szerver/%s.ini\",name);

Mentés
« Válasz #4 Dátum: 2014. Április 06. - 12:16:54 »
0 Show voters
Az márt meg van csak még mindíg mindenhol 0-t ír

Mentés
« Válasz #5 Dátum: 2014. Április 06. - 12:29:39 »
0 Show voters
szerintem meg csináld igy de nem biztos hogy ez a baj:)
 

public tfido(playerid)
{
       PlayerTime[playerid][FMPerc] ++;
        if(PlayerTime[playerid][FMPerc] == 60)
        {
               PlayerTime[playerid][FMPerc] = 0;
        PlayerTime[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(PlayerTime[playerid][FPerc]== 60)
    {
       PlayerTime[playerid][FMPerc]= 0;
       PlayerTime[playerid][FPerc] = 0;
        PlayerTime[playerid][FOra]++;
        SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #6 Dátum: 2014. Április 06. - 12:49:33 »
0 Show voters
Idézetet írta: kriszrap date=1396780179\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"47566\" data-ipsquote-contentclass=\"forums_Topic
szerintem meg csináld igy de nem biztos hogy ez a baj:)
 

public tfido(playerid)
{
       PlayerTime[playerid][FMPerc] ++;
        if(PlayerTime[playerid][FMPerc] == 60)
        {
               PlayerTime[playerid][FMPerc] = 0;
        PlayerTime[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(PlayerTime[playerid][FPerc]== 60)
    {
       PlayerTime[playerid][FMPerc]= 0;
       PlayerTime[playerid][FPerc] = 0;
        PlayerTime[playerid][FOra]++;
        SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}

 

Most nem csináltál mást, mint azt, hogy átnevezted az FIdo-t PlayerTime-ra. Viszont érthetõ, hogy miért. Ezt én például észre sem vettem. Te két különbözõ változót használsz, ugyanarra az enumra.
 
new PlayerTime[MAX_PLAYERS][JatekosInfo];
new FIdo[MAX_PLAYERS][JatekosInfo];

 
Használj csak egyet, mondjuk akkor a PlayerTime-ot, ha már kriszrap is azt választotta. Cserélj ki MINDEN FIdo-t PlayerTime-ra, a
 
new FIdo[MAX_PLAYERS][JatekosInfo];

 
-t pedig töröld nyugodtan. Úgy már csak-csak jó lesz.

Mentés
« Válasz #7 Dátum: 2014. Április 06. - 13:01:16 »
0 Show voters
Még most se jó :S

Mentés
« Válasz #8 Dátum: 2014. Április 06. - 11:04:20 »
0 Show voters
Helló.
Meg csináltam hogy mentse dinivel de csak egy .ini fájt csinál és a másodpercet percet órát nem menti le , csak 0kat ír oda. Valaki nem tudja miért?
script:
 
#include <a_samp>
#include <dini>
#include <zcmd>
#define COLOR_RED 0xFF0000FF
new fido_timer[MAX_PLAYERS];
enum JatekosInfo
{
FOra,
FPerc,
FMPerc,
}
new PlayerTime[MAX_PLAYERS][JatekosInfo];
new FIdo[MAX_PLAYERS][JatekosInfo];
forward PlayedTime(playerid);
forward Uzenet(playerid);
public OnPlayerConnect(playerid)
{
        new file[128];
fido_timer[playerid] = SetTimerEx(\"tfido\", 1000, true, \"i\", playerid);
        if(!fexist(file))
        {
                    new name[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(file,sizeof(file),\"/Szerver/%s.ini\",name);
                        if(!fexist(file))
                        {
                                dini_Create(file);
                               dini_IntSet(file, \"FMPerc\", 0);
                                dini_IntSet(file, \"FPerc\", 0);
                                dini_IntSet(file, \"FOra\", 0);
                        }
        }
        if(fexist(file))
        {
                        new name[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(file,sizeof(file),\"/Szerver/%s.ini\",name);
                        if(fexist(file))
                        {
                                        PlayerTime[playerid][FMPerc] = dini_Int(file, \"FMPerc\");
                                        PlayerTime[playerid][FPerc] = dini_Int(file, \"FPerc\");
                                        PlayerTime[playerid][FOra] = dini_Int(file, \"FOra\");
                        }
        }
        return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    format(file,sizeof(file),\"%s.ini\",name);
        if(fexist(file))
        {
              dini_IntSet(file, \"FMPerc\", PlayerTime[playerid][FMPerc]);
                dini_IntSet(file, \"FPerc\", PlayerTime[playerid][FPerc]);
                dini_IntSet(file, \"POra\", PlayerTime[playerid][FOra]);
                KillTimer(fido_timer[playerid]);
        }
        return 1;
}
forward tfido(playerid);
public tfido(playerid)
{
FIdo[playerid][FMPerc] ++;
if(FIdo[playerid][FMPerc] == 60)
{
        FIdo[playerid][FMPerc] = 0;
       FIdo[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(FIdo[playerid][FPerc] == 60)
    {
       FIdo[playerid][FMPerc] = 0;
        FIdo[playerid][FPerc] = 0;
         FIdo[playerid][FOra] ++;
          SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}
CMD:stat(playerid, params[])
{
new fido[256];
format(fido, sizeof(fido), \"|| Fent lévõ Óra: %02d | Perc: %02d | MásodPerc: %02d ||\", FIdo[playerid][FOra], FIdo[playerid][FPerc], FIdo[playerid][FMPerc]);
SendClientMessage(playerid, -1, fido);
return 1;
}

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #9 Dátum: 2014. Április 06. - 11:07:35 »
0 Show voters
dini_IntSet(file, \"POra\", PlayerTime[playerid][FOra]);

 
A POra-t akarod menteni, de FOrat töltesz be. Akkor ide is FOra kéne, nem?
 
dini_IntSet(file, \"FOra\", PlayerTime[playerid][FOra]);

Mentés
« Válasz #10 Dátum: 2014. Április 06. - 11:17:24 »
0 Show voters
Valami nemjó :S ki fagy tõle a szerver ha felépek  :S

Dupla hozzászólás automatikusan összefûzve. ( 2014. Április 06. - 11:58:06 )

Még így se menti le :S
http://kepfeltoltes.hu/view/140406/sss_www.kepfeltoltes.hu_.png
« Utoljára szerkesztve: 2014. Április 06. - 11:58:06 írta Heromen »

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #11 Dátum: 2014. Április 06. - 12:05:16 »
0 Show voters
format(file,sizeof(file),\"%s.ini\",name);

 
Esetleg e helyett nem ez kéne? Máshol így van:
 
format(file,sizeof(file),\"/Szerver/%s.ini\",name);

Mentés
« Válasz #12 Dátum: 2014. Április 06. - 12:16:54 »
0 Show voters
Az márt meg van csak még mindíg mindenhol 0-t ír

Mentés
« Válasz #13 Dátum: 2014. Április 06. - 12:29:39 »
0 Show voters
szerintem meg csináld igy de nem biztos hogy ez a baj:)
 

public tfido(playerid)
{
       PlayerTime[playerid][FMPerc] ++;
        if(PlayerTime[playerid][FMPerc] == 60)
        {
               PlayerTime[playerid][FMPerc] = 0;
        PlayerTime[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(PlayerTime[playerid][FPerc]== 60)
    {
       PlayerTime[playerid][FMPerc]= 0;
       PlayerTime[playerid][FPerc] = 0;
        PlayerTime[playerid][FOra]++;
        SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}

Nem elérhető Dfoglalo

  • 4069
  • Globális Moderátor
    • Profil megtekintése
Mentés
« Válasz #14 Dátum: 2014. Április 06. - 12:49:33 »
0 Show voters
Idézetet írta: kriszrap date=1396780179\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"47566\" data-ipsquote-contentclass=\"forums_Topic
szerintem meg csináld igy de nem biztos hogy ez a baj:)
 

public tfido(playerid)
{
       PlayerTime[playerid][FMPerc] ++;
        if(PlayerTime[playerid][FMPerc] == 60)
        {
               PlayerTime[playerid][FMPerc] = 0;
        PlayerTime[playerid][FPerc] ++;
        SendClientMessage(playerid, -1, \"Percet ugrottál!\");
    }
    if(PlayerTime[playerid][FPerc]== 60)
    {
       PlayerTime[playerid][FMPerc]= 0;
       PlayerTime[playerid][FPerc] = 0;
        PlayerTime[playerid][FOra]++;
        SendClientMessage(playerid, -1, \"Órát ugrottál!\");
        }
}

 

Most nem csináltál mást, mint azt, hogy átnevezted az FIdo-t PlayerTime-ra. Viszont érthetõ, hogy miért. Ezt én például észre sem vettem. Te két különbözõ változót használsz, ugyanarra az enumra.
 
new PlayerTime[MAX_PLAYERS][JatekosInfo];
new FIdo[MAX_PLAYERS][JatekosInfo];

 
Használj csak egyet, mondjuk akkor a PlayerTime-ot, ha már kriszrap is azt választotta. Cserélj ki MINDEN FIdo-t PlayerTime-ra, a
 
new FIdo[MAX_PLAYERS][JatekosInfo];

 
-t pedig töröld nyugodtan. Úgy már csak-csak jó lesz.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal