SA-MP Forums Archive
LAdmin Score saving - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: LAdmin Score saving (/showthread.php?tid=253235)



LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

I am having a huge problem trying to get ladmin to save scores i have edited it like one guy gave an tutorial how to save ladmin scores but it still didnt work now i simply tried to do this but it gives me errors.....

Can someone please give me the correct way to save scores in LAdmin........

}
#if defined SAVE_SCORE
new file:LAdminfile, filepath[256], string[256], Score;
getscore(Score);
format(filepath,sizeof(filepath,"ladmin/users/Score/%s.txt",filename);
LAdminfile = fopen(filepath);
format(string,sizeof(string),"[%d] %s\r\n"Score,text);
fwrite(LAdminfile,string);
fclose(LAdminfile);
#endif

return 1;
}


Re: LAdmin Score saving - MadeMan - 05.05.2011

What version do you have?


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

LAdmin4v2


Re: LAdmin Score saving - MadeMan - 05.05.2011

Where did you get it?


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

off samp forums


Re: LAdmin Score saving - MadeMan - 05.05.2011

Quote:
Originally Posted by [$A$]W33D$P33D
Посмотреть сообщение
off samp forums
Link?


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

Link is below at bottom of page


Re: LAdmin Score saving - MadeMan - 05.05.2011

Quote:
Originally Posted by [$A$]W33D$P33D
Посмотреть сообщение
"File no longer available"


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

Ok this is my edit that i made and please have a look at it and tell me what i did wrong i know it doesnt compile now because i put the #define SAVE_SCORE in if u remove that it compiles it also has all the score saving edits in witch is correct but doesnt work.....

http://pastebin.com/c6xaKHzL


Re: LAdmin Score saving - MadeMan - 05.05.2011

pawn Код:
SetPlayerScore(playerid, dUserINT(PlayerName2(playerid)).("score"));
Add this to LoginPlayer(playerid)

pawn Код:
LoginPlayer(playerid)
{
    if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
    dUserSetINT(PlayerName2(playerid)).("loggedin",1);
    PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
    PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
    PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
    PlayerInfo[playerid][hours] = dUserINT(PlayerName2(playerid)).("hours");
    PlayerInfo[playerid][mins] = dUserINT(PlayerName2(playerid)).("minutes");
    PlayerInfo[playerid][secs] = dUserINT(PlayerName2(playerid)).("seconds");
    SetPlayerScore(playerid, dUserINT(PlayerName2(playerid)).("score"));
    PlayerInfo[playerid][Registered] = 1;
    PlayerInfo[playerid][LoggedIn] = 1;
}



Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

I GET THIS ERROR NOW


F:\GTA-SA\Samp\filterscripts\ladmin4v2.pwn(6805) : error 001: expected token: "#endif", but found "-end of file-"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.






LoginPlayer(playerid);
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
PlayerInfo[playerid][hours] = dUserINT(PlayerName2(playerid)).("hours");
PlayerInfo[playerid][mins] = dUserINT(PlayerName2(playerid)).("minutes");
PlayerInfo[playerid][secs] = dUserINT(PlayerName2(playerid)).("seconds");
SetPlayerScore(playerid, dUserINT(PlayerName2(playerid)).("score"));
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;

}

if(PlayerInfo[playerid][Level] > 0)
{
format(string,sizeof(string),"ACCOUNT: You have been automatically logged in. (Level %d)", PlayerInfo[playerid][Level] );
SendClientMessage(playerid,green,string);
}
else SendClientMessage(playerid,green,"ACCOUNT: You have been automatically logged in.");
}
else SendClientMessage(playerid, green, "ACCOUNT: This nickname is registed, you can now login by typing /login [password]");
}
return 1;
}


Re: LAdmin Score saving - MadeMan - 05.05.2011

Remove this

pawn Код:
#if defined SAVE_SCORE
new file:LAdminfile, filepath[256], string[256], Score;
getscore(Score);
format(filepath,sizeof(filepath,"ladmin/users/Score/%s.txt",filename);
LAdminfile = fopen(filepath);
format(string,sizeof(string),"[%d] %s\r\n"Score,text);
fwrite(LAdminfile,string);
fclose(LAdminfile);



Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

I did


Re: LAdmin Score saving - MadeMan - 05.05.2011

It should look like this

pawn Код:
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
    #if defined SAVE_LOGS
    new File:LAdminfile, filepath[256], string[256], year,month,day, hour,minute,second;
    getdate(year,month,day); gettime(hour,minute,second);
   
    format(filepath,sizeof(filepath),"ladmin/logs/%s.txt",filename);
    LAdminfile = fopen(filepath,io_append);
    format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",day,month,year,hour,minute,second,text);
    fwrite(LAdminfile,string);
    fclose(LAdminfile);
    #endif

    return 1;
}



Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

LOL oops forgot about that thankyou i will go see if it works now will let u know....


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

IDK it frustrates me so much ty for your help but it still doesnt save the score im loosing it


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

it compiled but still nothing it doesnt save


Re: LAdmin Score saving - [$A$]W33D$P33D - 05.05.2011

TY Man i got it to work you are awsome!!!!


Re: LAdmin Score saving - Ironboy - 05.05.2011

I am using the old version of Ladmin and its saving score without doing anything.