Raised This Month: $ Target: $400
 0% 

[Tut] MySql - Save/Load/Usefull Things (Xp Mod)


Post New Thread Reply   
 
Thread Tools Display Modes
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 07-21-2010 , 05:43   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #11

Wow. Nice TUT grim. would be cool as if u had a tutorial on how to extract those data from mysql and show it on the site . Good Job A++++
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-21-2010 , 09:20   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #12

I think ErrorCode can be non-zero even when FailState is not TQUERY_QUERY_FAILED.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 07-21-2010 , 12:02   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #13

i have one cuestion , its not the same this

PHP Code:
 if(SQL_NumResults(Query) < 1
that this

PHP Code:
 if(!SQL_NumResults(Query)) 
?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 07-21-2010 at 12:06.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-21-2010 , 17:20   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #14

Quote:
Originally Posted by lucas_7_94 View Post
i have one cuestion , its not the same this

PHP Code:
 if(SQL_NumResults(Query) < 1
that this

PHP Code:
 if(!SQL_NumResults(Query)) 
?
Pure theoreticly, the first is "if lower then 1" the other is "if equals 0". When there are bugs, strange things can occur and the first is the safest.
__________________
I am out of order!

Last edited by grimvh2; 07-21-2010 at 17:23.
grimvh2 is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-21-2010 , 17:22   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #15

Quote:
Originally Posted by Hawk552 View Post
I think ErrorCode can be non-zero even when FailState is not TQUERY_QUERY_FAILED.
if the query did'nt failed and the connection also did'nt failed, the connection should be succesfull?

edit: sorry forgot about my other post.
__________________
I am out of order!
grimvh2 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-21-2010 , 17:49   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #16

Quote:
Originally Posted by grimvh2 View Post
if the query did'nt failed and the connection also did'nt failed, the connection should be succesfull?

edit: sorry forgot about my other post.
It appears that the error code can only be non-zero when the fail state is TQUERY_QUERY_FAILED. See here:

PHP Code:
73    bool MysqlQuery::ExecuteR(QueryInfo *infochar *errorsize_t maxlength)
74    {
75        int err;
76    
77        
if ( (err=mysql_real_query(m_pDatabase->m_pMysqlm_QueryString, (unsigned long)m_QueryLen)) )
78        {
79            info->errorcode mysql_errno(m_pDatabase->m_pMysql);
80            info->success false;
81            info->affected_rows 0;
82            info->rs NULL;
83            if (error && maxlength)
84            {
85                snprintf(errormaxlength"%s"mysql_error(m_pDatabase->m_pMysql));
86            }
87        }
88        else
89        {
90            MYSQL_RES *res mysql_store_result(m_pDatabase->m_pMysql);
91            if (!res)
92            {
93                if (mysql_field_count(m_pDatabase->m_pMysql) > 0)
94                {
95                    //error !111!!11
96                    info->errorcode mysql_errno(m_pDatabase->m_pMysql);
97                    info->success false;
98                    info->affected_rows 0;
99                    info->rs NULL;
100                } else {
101                    info->errorcode 0;
102                    info->success true;
103                    info->affected_rows mysql_affected_rows(m_pDatabase->m_pMysql);
104                    info->rs NULL;
105                }
106            } else {
107                info->errorcode 0;
108                info->success true;
109                info->affected_rows mysql_affected_rows(m_pDatabase->m_pMysql);
110                MysqlResultSet *rs = new MysqlResultSet(resm_pDatabase->m_pMysql);
111                info->rs rs;
112            }
113        }
114    
115        
return info->success;
116    
That means you can ignore my comment.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 07-22-2010 , 00:22   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #17

PHP Code:
Queries SQL_PrepareQuery(SqlConnection,"CREATE TABLE IF NOT EXISTS tutorial (steamid varchar(32),exp INT(11))"
i dont get that bit. (steamid varchar(32),exp INT(11)) thats the bit i dont get. someone please explain
__________________
JailBreak Mod with Plugin API ( 90% ) Public
shuttle_wave is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-22-2010 , 04:47   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #18

As siple as it is. At the mapstart we run that query, its going to look if the table already exists in the database. if not it will create a table with 2 fields, steamid and exp. varchar(32) is the same as "new String[32]" and I guess you know what an int is.
__________________
I am out of order!
grimvh2 is offline
NzGamers
Member
Join Date: Jul 2009
Old 07-22-2010 , 05:22   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #19

Nice Tutorial man. I see u explaining to Shuttle_Wave but im not very advance so wats exp INT(11)
NzGamers is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-22-2010 , 05:43   Re: [Tutorial] easy XP Mod (MySql Version)
Reply With Quote #20

exp is a field. When u save a record (a players steam id) you can set hes field. 1 field is hes steamid, the other is the amount of exp, we call the field exp and the player hes exp will be stored in there. an INT is just simply a number and the 11 is how many numbers it can contain. for example the max is 99.999.999.999
__________________
I am out of order!
grimvh2 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 04:49.


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