Top killers of all time question
#1

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.
Reply
#2

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
Reply
#3

Well the thing is how can I make the server read all files with yini?
Reply
#4

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
Reply
#5

Statistics like that are not feasible with flat file systems.
Reply
#6

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
Reply
#7

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'
Reply
#8

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"
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)