07.05.2011, 03:53
hey guys,
i made a modification on my cookie system ( a new one ) but then i start the server and i join the server.. it make the server closed down automaticly.. hope u guys can help. This is the code:
define:
onplayerconnect callbacks:
[
and OnDialogResponse callbacks:
i made a modification on my cookie system ( a new one ) but then i start the server and i join the server.. it make the server closed down automaticly.. hope u guys can help. This is the code:
define:
pawn Код:
#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DATA "cookie"
pawn Код:
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 ;
}
and OnDialogResponse callbacks:
pawn Код:
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 ;
}