How to check dini file for certain amounts - 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: How to check dini file for certain amounts (
/showthread.php?tid=209862)
How to check dini file for certain amounts -
BlackWolf120 - 11.01.2011
hi,
just wondering how its possible to check e.g. who has got the highest score registered on the server.
All acounts are saved with dini so how to check these e.g. with a command?
I only know how to get the highest score from the players that are currently online.
regards..
Re: How to check dini file for certain amounts -
DeathOnaStick - 11.01.2011
Quote:
Originally Posted by BlackWolf120
hi,
just wondering how its possible to check e.g. who has got the highest score registered on the server.
All acounts are saved with dini so how to check these e.g. with a command?
I only know how to get the highest score from the players that are currently online.
regards..
|
You need
one file where every account-name is listed, else it would not be possible.
I'd suggest to first make a variable with the amount of accounts in this file and then list all accounts with dini like '1=DeathOnastick.ini\n2=Somebody.ini\n etc..'.
Re: How to check dini file for certain amounts -
Iuri - 11.01.2011
It's kinda easy, you just need to make two new variables on top like:
pawn Код:
new TopScore = 0;
new TopScorer[MAX_PLAYERS] = INVALID_PLAYER_ID;
, then go where you got the
and add this under it:
pawn Код:
if(GetPlayerScore(playerid) > TopScore)
{
TopScorer = playerid;
TopScore = GetPlayerScore(TopScorer);
// You can also send some client messages here to announce the new leader.
}
Then you must save the player's name and his score.
Re: How to check dini file for certain amounts -
XCarBOn - 11.01.2011
Much easier: MySQL!
Re: How to check dini file for certain amounts -
BlackWolf120 - 11.01.2011
mhh thx for ur answers.
Im gonna try it out.
Could someone maybe post a link to a tutorial how to do that with MySQL?
Ive never really had to do sth. with MySQL
Re: How to check dini file for certain amounts -
Joe Staff - 11.01.2011
or rather, SQLite. It's local so you don't have to get a SQL Server host and it doesn't get internet lag.
Also, it comes with samp server so you don't need to download a plugin
pawn Код:
new tmp[32];
new pname[24];
new DBResult:result=db_query(Database,"SELECT Name, Score FROM Players ORDER BY Score DESC");
db_get_field(result,0,pname,24);
db_get_field(result,1,tmp,64);
printf("%s has the highest score of %d",pname,strval(tmp));