SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/03/2020, 08:27 AM   #1
TechLunatic
Little Clucker
 
TechLunatic's Avatar
 
Join Date: Jun 2019
Location: Bangladesh
Posts: 14
Reputation: 0
Default MySQL Error on server start

[13:40:32] [plugins/mysql] mysql_format: no value for specifier '%e' passed
[13:40:32] [plugins/mysql] error #1065 while executing query "": Query was empty
[13:40:35] [plugins/mysql] error #1064 while executing query "UPDATE `PLAYERS` `SCORE` = 0, `CASH` = 0, `KILLS` = 0, `DEATHS` = 0 WHERE `ID` = 0 LIMIT 1": You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 0, `CASH` = 0, `KILLS` = 0, `DEATHS` = 0 WHERE `ID` = 0 LIMIT 1' at line 1

Script:
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    
Corrupt_Check[playerid]++;

    new 
DB_Query[256];
    
mysql_format(DatabaseDB_Querysizeof(DB_Query), "UPDATE `PLAYERS` `SCORE` = %d, `CASH` = %d, `KILLS` = %d, `DEATHS` = %d WHERE `ID` = %d LIMIT 1",
    
pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][ID]);

    
mysql_tquery(DatabaseDB_Query);

    if(
cache_is_valid(pInfo[playerid][Player_Cache]))
    {
        
cache_delete(pInfo[playerid][Player_Cache]);
        
pInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
    }

    
pInfo[playerid][LoggedIn] = false;
    print(
"OnPlayerDisconnect has been called.");
    return 
1;

And How to lock the server with server.cfg?
__________________
Looking for an MySQL expert
PM me on discord: TL-Lawliet#1393


TechLunatic is offline   Reply With Quote
Old 31/03/2020, 08:31 AM   #2
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,000
Reputation: 92
Default Re: MySQL Error on server start

You are missing something alot, I've colored it red.
Code:
mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = '%d', `CASH` = '%d', `KILLS` = '%d', `DEATHS` = '%d' WHERE `ID` = '%d' LIMIT 1",
    pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][ID]);
You can lock the server with a password by adding this to your server.cfg
Code:
password your_prefered_password
__________________
Coming soon (6-1-2020):

Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Official Live Beta Release Date: 1st of June, 2020
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 31/03/2020, 08:40 AM   #3
TechLunatic
Little Clucker
 
TechLunatic's Avatar
 
Join Date: Jun 2019
Location: Bangladesh
Posts: 14
Reputation: 0
Default Re: MySQL Error on server start

Still same error
__________________
Looking for an MySQL expert
PM me on discord: TL-Lawliet#1393


TechLunatic is offline   Reply With Quote
Old 31/03/2020, 09:17 AM   #4
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: MySQL Error on server start

They are different queries. The last one as jasperschellekens mentioned, you are missing SET keyword after table name.

For the other error, the size is too small. Having compiled with debug info (-d3) will log the code line to find the faulty query size. The no value found for specifier %e may or may not be from the same query.
__________________
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't start the server, mysql problem ? [Windows hosted server] Kelzano Server Support 3 19/05/2017 01:10 AM
[Mysql] Server Start Ryan50 Scripting Help 9 10/10/2015 04:59 PM
mysql start server error 26_RUSSS Server Support 3 11/12/2013 04:07 PM
MySQL server start Deividas1 Scripting Help 13 02/08/2013 04:29 PM
Start a Public IP MySQL Server Jaber_Brown Server Support 4 20/03/2013 10:09 AM


All times are GMT. The time now is 04:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.