#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DATA "cookie"
public OnPlayerConnect ( playerid ) {
new
iName [ MAX_NAMES ] ,
Query [ MAX_STRINGS ] ,
str [ MAX_MENU_STRINGS ] ;
GetPlayerName ( playerid , iName , sizeof ( iName ) ) ;
mysql_real_escape_string ( iName , iName ) ;
format ( Query , sizeof ( Query ) , "SELECT * FROM `users` WHERE `username` = '%s' LIMIT 1" , iName ) ;
mysql_query ( Query ) ;
mysql_store_result ( ) ;
if ( mysql_num_rows ( ) == 0 ) {
strcat ( str , ""YELLOW"This server is using "RED"MySQL Cookie System "YELLOW"that made by "RED"Mubarrak48.\n" ) ;
strcat ( str , ""RED"MySQL Cookie System "YELLOW"are in "RED"first version of 1.0. "YELLOW"If you want to know more updates,\n" ) ;
strcat ( str , ""YELLOW"Stay active in the server. More feature will come.\n\n" ) ;
strcat ( str , ""YELLOW"Click "RED"YES "YELLOW"if you want to register in our "RED"databasen\n" ) ;
strcat ( str , ""YELLOW"Clcik "RED"NO "YELLOW"if you want to continue without register in our "RED"database" ) ;
ShowPlayerDialog ( playerid , DIALOG_COOKIE_REG , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "YES" , "NO" ) ;
}
else {
strcat ( str , ""YELLOW"Welcome back "RED"%s, "YELLOW"You may continue when pressing "RED"Submit "YELLOW"button" ) ;
ShowPlayerDialog ( playerid , DIALOG_COOKIE_INFO , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "Submit" , "" ) ;
}
mysql_free_result ( ) ;
return 1 ;
}
public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] ) {
new
iName [ MAX_NAMES ] ,
Query [ MAX_STRINGS ] ,
str [ MAX_MENU_STRINGS ] ;
GetPlayerName ( playerid , iName , sizeof ( iName ) ) ;
mysql_real_escape_string ( iName , iName ) ;
if ( dialogid == DIALOG_COOKIE_REG ) {
if ( !response )
return 0 ;
if ( response ) {
format ( Query , sizeof ( Query ) , "INSERT INTO `users` ( `username` , `cookie` ) VALUE ( '%s' , 0 )" , iName ) ;
mysql_query ( Query ) ;
mysql_store_result ( ) ;
strcat ( str , ""YELLOW"You have successfully "RED"register in our database.\n" ) ;
strcat ( str , ""YELLOW"Have fun playing with "RED"MySQL Cookie System "YELLOW"Version 1.0" ) ;
ShowPlayerDialog ( playerid , DIALOG_COOKIE_DONE_REG , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "Submit" , "" ) ;
}
}
return 1 ;
}
Does everything compile correctly you for you? I'm unsure about the way those includes are included into the mode. Do you also have all of those includes in their correct positions?
There could be something else closing down the server, like in incorrect setup in your server.cfg file. Please post the contents of that file (removing the "rcon_password" line). Also make sure you are installing the plugins or any other scripts used in your server correctly. |
Don't you need it though to keep things in sync?
The function is needed after using mysql_store_result(). |