Thread: [Solved] Retrieve data from sql
View Single Post
N3v3rM1nd
Member
Join Date: Apr 2021
Old 04-26-2024 , 22:25   Re: Retrieve data from sql
Reply With Quote #5

Quote:
Originally Posted by Rohanlogs View Post
Its fine, try this. Do you know how to re-compile .sma file?
You need to edit this part of the code:

#define TABLE "zm_top"

Replace "zm_top" with your actual table name. You should have a definition '#define TABEL' inside your code which has the name of your table, then recompile. After that it 'should' work.


Once running, write amx_rank in console, or say /rank
This will do a full table scan on each command, therefore I've added antispamming.

In non-technical terms, if your database has 100s of thousands of rows, this command will be rather slow and might even cause lag if the server is really bad. However I doubt your database has that many players so it should be fine. If you run into any performance issues, we can optimize it further. But for now this should do. You may edit the displayed chat message to your liking.

This plugin will use connection info specified in amxmodx/configs/sql.cfg:

amx_sql_host "127.0.0.1"
amx_sql_user "root"
amx_sql_pass ""
amx_sql_db "amx"
amx_sql_type "mysql"
Thanks, i will test the code these days and i'll let you know the result
N3v3rM1nd is offline