how to make offline /makeadmin - 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)
+--- Thread: how to make offline /makeadmin (
/showthread.php?tid=657709)
how to make offline /makeadmin -
severance - 14.08.2018
I was wondering how do you demote someone offline, I'm using MySQL r41-2 and I need to know how can you check if someone exists on the database? are there any tutorials regarding this ?
Re: how to make offline /makeadmin -
Akeem - 14.08.2018
You command should run a query on your database
Код:
INSERT INTO accounts( `adminlevel`) VALUES(`%d`) WHERE `pname` = `%e`, newAdminLevel, NameOfPlayer
Make a command to run that query on your database fitting in the right things and it should work.
Re: how to make offline /makeadmin -
severance - 14.08.2018
Quote:
Originally Posted by Akeem
You command should run a query on your database
Код:
INSERT INTO accounts( `adminlevel`) VALUES(`%d`) WHERE `pname` = `%e`, newAdminLevel, NameOfPlayer
Make a command to run that query on your database fitting in the right things and it should work.
|
Yeah thanks, but what about detecting the player on the database?, like, "This user is not registered in our database", what are the right checks ?
Re: how to make offline /makeadmin -
coool - 14.08.2018
Quote:
Originally Posted by severance
Yeah thanks, but what about detecting the player on the database?, like, "This user is not registered in our database", what are the right checks ?
|
Check out a MySQL tutorial almost every tutorial has a check...
You do this query [/PHP]SELECT * FROM `users` WHERE `username` = '%s'[/PHP]and check if a row is returned or not.
Re: how to make offline /makeadmin -
Banditul18 - 14.08.2018
Quote:
Originally Posted by Akeem
You command should run a query on your database
Код:
INSERT INTO accounts( `adminlevel`) VALUES(`%d`) WHERE `pname` = `%e`, newAdminLevel, NameOfPlayer
Make a command to run that query on your database fitting in the right things and it should work.
|
If you decide to help atleast make sure the information you give its correct. Its not INSERT INTO, it suppose to be UPDATE
Код:
UPDATE acounts SET adminlevel = %i WHERE name = '%s'
OP: If you run the query using mysql_tquery, and call a callback you can use
https://sampwiki.blast.hk/wiki/MySQL/R40..._affected_rows to check if the update was made or not. (if wasnt made means the player doesnt exist)
Edit: coool method works aswell
Re: how to make offline /makeadmin -
xMoBi - 14.08.2018
Use the
affected rows method.
Re: how to make offline /makeadmin -
sammp - 14.08.2018
Quote:
Originally Posted by Banditul18
If you decide to help atleast make sure the information you give its correct. Its not INSERT INTO, it suppose to be UPDATE
Код:
UPDATE acounts SET adminlevel = %i WHERE name = '%s'
OP: If you run the query using mysql_tquery, and call a callback you can use https://sampwiki.blast.hk/wiki/MySQL/R40..._affected_rows to check if the update was made or not. (if wasnt made means the player doesnt exist)
Edit: coool method works aswell
|
Ideally, you should be working with unique ID's when altering ANYTHING to do with accounts to avoid data duplication, or editing the data of the wrong account.