Raised This Month: $12 Target: $400
 3% 

OciXCrom's Rank System [XP|Levels|Ranks]


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-21-2019 , 13:43   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #171

I asked a friend who knows more about MySQL and he said that the error is because you're using an old MySQL version, just like you said. Try updating to the latest one.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
totopizza
AlliedModders Donor
Join Date: Oct 2015
Location: Honduras
Old 01-22-2019 , 16:50   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #172

If you have AMXX < 1.8.3 you need that include: https://forums.alliedmods.net/showthread.php?t=149210
totopizza is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-27-2019 , 11:22   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #173

Quote:
Originally Posted by OciXCrom View Post
I asked a friend who knows more about MySQL and he said that the error is because you're using an old MySQL version, just like you said. Try updating to the latest one.
MySQL update didn't helped, but one thing helped. I changed all these symbols '' to `` in SQL lines.

A part from code how it looks now (full code in attachment):

PHP Code:
formatex(szQuerycharsmax(szQuery), "INSERT INTO %s (`Player`,`XP`,`Level`,`Next XP`,`Rank`,`Next Rank`) VALUES ('%s','%i','1','0','n/a','n/a');"g_eSettings[SQL_TABLE], szPlayeriXP
-->>>
PHP Code:
formatex(szQuerycharsmax(szQuery), "INSERT INTO %s (`Player`,`XP`,`Level`,`Next XP`,`Rank`,`Next Rank`) VALUES (`%s`,`%i`,`1`,`0`,`n/a`,`n/a`);"g_eSettings[SQL_TABLE], szPlayeriXP
But now I have a new one error..

PHP Code:
L 01/27/2019 17:55:18: [crx_ranksystem.amxxUnknown column 'BOT' in 'where clause'
L 01/27/2019 17:56:10: [crx_ranksystem.amxx] [SQL ErrorQuery failed (1054): Unknown column 'STEAM_0:1:156416040' in 'where clause'
L 01/27/2019 17:56:10: [crx_ranksystem.amxx] [SQL ErrorQuery failed (1054): Unknown column 'BOT' in 'where clause' 
Can you check this please?
Attached Files
File Type: sma Get Plugin or Get Source (crx_ranksystem_v1.sma - 339 views - 47.3 KB)
LithuanianJack is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-27-2019 , 16:12   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #174

Hey, sorry about the problems you're experiencing. It's my first time using MySQL in a plugin so I'm not very familiar with the whole thing. Try the original code again, but replace only one thing in this line:

PHP Code:
iQuery2 SQL_PrepareQuery(iSqlConnection"SELECT * FROM %s WHERE Player = `%s`;"g_eSettings[SQL_TABLE], szPlayer
Change `%s` to '%s' and see if there's any improvement.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-28-2019 , 08:48   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #175

Quote:
Originally Posted by OciXCrom View Post
Hey, sorry about the problems you're experiencing. It's my first time using MySQL in a plugin so I'm not very familiar with the whole thing. Try the original code again, but replace only one thing in this line:

PHP Code:
iQuery2 SQL_PrepareQuery(iSqlConnection"SELECT * FROM %s WHERE Player = `%s`;"g_eSettings[SQL_TABLE], szPlayer
Change `%s` to '%s' and see if there's any improvement.
Nothing changes, error persists.
LithuanianJack is offline
totopizza
AlliedModders Donor
Join Date: Oct 2015
Location: Honduras
Old 01-28-2019 , 18:51   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #176

http://php.net/manual/en/function.my...ape-string.php

It is the same, you must replace several characters:
` for \`
' for \'
" for \^"
% for \%

Nick: [MXS] Totopizza's HN.


Replace: ' for \'
Result: [MXS] Totopizza\`s HN.

Query: "SELECT * FROM %s WHERE Player = `[MXS] Totopizza\`s HN.`";

but.. without escape string:

Query: "SELECT * FROM %s WHERE Player = `[MXS] Totopizza`s HN.`";
Then... error

EDIT: https://forums.alliedmods.net/showpo...60&postcount=7

Last edited by totopizza; 01-28-2019 at 18:56.
totopizza is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-29-2019 , 15:56   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #177

@totopizza thanks for the information.

@LithuanianJack can you test with the changes mentioned above?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-30-2019 , 08:38   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #178

Quote:
Originally Posted by totopizza View Post
http://php.net/manual/en/function.my...ape-string.php

It is the same, you must replace several characters:
` for \`
' for \'
" for \^"
% for \%

Nick: [MXS] Totopizza's HN.


Replace: ' for \'
Result: [MXS] Totopizza\`s HN.

Query: "SELECT * FROM %s WHERE Player = `[MXS] Totopizza\`s HN.`";

but.. without escape string:

Query: "SELECT * FROM %s WHERE Player = `[MXS] Totopizza`s HN.`";
Then... error

EDIT: https://forums.alliedmods.net/showpo...60&postcount=7
I did something wrong. I changed these lines but nothing changes. I think I forgot something.

Spoiler


Just changed szPlayer to GetSecureName(szPlayer)

Added this:
PHP Code:
#define SECURE_NAME_LEN 31 * 2 + 1 // Twice as long as name (31 * 2 + zero terminator) in case all 31 characters are insecure 
And this:
PHP Code:
GetSecureName(const name[])
{
    new 
secureName[SECURE_NAME_LEN];
    
copy(secureNamecharsmax(secureName), name);
    
    
replace_all(secureNamecharsmax(secureName), "\", "\\");
    replace_all(secureName, charsmax(secureName), "
`", "\`");
    replace_all(secureName, charsmax(secureName), "'", "\'");
    
    return secureName;

Attached Files
File Type: sma Get Plugin or Get Source (crx_ranksystem_v2.sma - 474 views - 47.7 KB)

Last edited by LithuanianJack; 01-30-2019 at 12:04.
LithuanianJack is offline
totopizza
AlliedModders Donor
Join Date: Oct 2015
Location: Honduras
Old 01-30-2019 , 11:35   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #179

Spoiler


Can you tell me what is the error that causes you and at what time?
totopizza is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-30-2019 , 12:03   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #180

Quote:
Originally Posted by totopizza View Post
Spoiler


Can you tell me what is the error that causes you and at what time?
It causes when I connect to the server (I think when SQL trying to insert new player).

PHP Code:
[crx_ranksystem.amxxYou have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 
LithuanianJack is offline
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

Forum Jump


All times are GMT -4. The time now is 09:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode