Top killers of all time question -
Youssef221 - 26.07.2015
I wonder how can I do that? How can I list the top killers of all time with yini in a dialog? I just need an example since I don't know how to make one.
Re: Top killers of all time question -
jamesbond007 - 26.07.2015
every time someone gets a kill you add it to a variable KillCount[playerid] or somthing.
then when they quit or disconnect you write it into a file..
then u would load them but reading all files every time u do that command. it might be slow idk, if u have many players, maybe u can put it all in one file and make different lines represent different player kill count. idk i think u get the idea
Re: Top killers of all time question -
Youssef221 - 26.07.2015
Well the thing is how can I make the server read all files with yini?
Re: Top killers of all time question -
jamesbond007 - 26.07.2015
idk then put it all in one file containing everyone's kill count on different lines.
maybe wait for someone else reply cause they might have a better idea but im pretty sure this is the way you do it
Re: Top killers of all time question -
Vince - 26.07.2015
Statistics like that are not feasible with flat file systems.
Re: Top killers of all time question -
jamesbond007 - 27.07.2015
Quote:
Originally Posted by Vince
Statistics like that are not feasible with flat file systems.
|
but i just gave him a solution. why wouldnt that work putting it all in one file? maybe u can sort it as well for speed
Re: Top killers of all time question -
Abagail - 27.07.2015
You should consider using SQLite(or MySQL if you really need it, though you likely don't). You can simply execute a query such as:
pawn Код:
INSERT INTO `kills` (killerid, playerid, reason, time) VALUES (%d, %d, %d, %d)", playerDatabaseId(killerid), playerDatabaseId(playerid), reason, time);
This gives you easy to use information regarding the kill. Where do you see the amount of kills they have!? You don't! You don't even need to store and or update the value at all, simply execute a query and use db_num_rows(or whatever function for the type of SQL implementation you're using) such as:
pawn Код:
SELECT * FROM `kills` WHERE `playerid` = '%d'
Re: Top killers of all time question -
jamesbond007 - 27.07.2015
Quote:
Originally Posted by Abagail
You should consider using SQLite(or MySQL if you really need it, though you likely don't). You can simply execute a query such as:
pawn Код:
INSERT INTO `kills` (killerid, playerid, reason, time) VALUES (%d, %d, %d, %d)", playerDatabaseId(killerid), playerDatabaseId(playerid), reason, time);
This gives you easy to use information regarding the kill. Where do you see the amount of kills they have!? You don't! You don't even need to store and or update the value at all, simply execute a query and use db_num_rows(or whatever function for the type of SQL implementation you're using) such as:
pawn Код:
SELECT * FROM `kills` WHERE `playerid` = '%d'
|
but he said using yini.. why cant he use just regular files? also why do u need a reason for the kill
rofl what is the point of saving killerid and such? it has nothing to do with "top killer of all time"
Re: Top killers of all time question -
Abagail - 27.07.2015
It allows you to see more kill statistics later on, it just shows the great capabilities of using SQL. And files just make more work, will be slower and have no advantages even if you can get it to work properly.
Re: Top killers of all time question -
Youssef221 - 27.07.2015
I don't know how to use MySQL or SQL, Can you give me the link of a good SQL tutorial so I convert from yini please?