18.05.2011, 08:59
hey guys,
i have a little bit buggy on the strcat. here we are:
first time connection
second time connection
the code that may be bugged:
thats all the code i can give. Its only bugged on the connection part
i have a little bit buggy on the strcat. here we are:
first time connection
second time connection
the code that may be bugged:
pawn Код:
stock ChooseDialog ( dialogid , playerid ) {
switch ( dialogid ) {
case DIALOG_REG: {
strcat ( mstr , ""YELLOW"This server using MySQL Cookie System that "RED"made by Mubarrak48\n" ) ;
strcat ( mstr , ""YELLOW"If you want to see more feature you can register on our "RED"database\n" ) ;
strcat ( mstr , ""YELLOW"Click "RED"Yes "YELLOW"to register on ourdatabase or\n" ) ;
strcat ( mstr , ""YELLOW"You can click "RED"No "YELLOW"to continue without registering\n" ) ;
ShowPlayerDialog ( playerid , DIALOG_REG , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , mstr , "Yes" , "No" ) ;
}
}
return 1 ;
}
pawn Код:
public OnPlayerConnect ( playerid ) {
GetPlayerName ( playerid , iName , sizeof ( iName ) ) ;
mysql_real_escape_string ( iName , iName ) ;
format ( Query , sizeof ( Query ) , "SELECT * FROM `users` WHERE `username` = '%s'" , iName ) ;
mysql_query ( Query ) ;
mysql_store_result ( ) ;
if ( mysql_num_rows ( ) == 0 ) {
ChooseDialog ( DIALOG_REG , playerid ) ;
}
else {
new
Cookies [ 1 ] ;
if ( mysql_fetch_row ( Query ) ) {
sscanf ( Query , "p<|>i" , Cookies [ 0 ] ) ;
SetPVarInt ( playerid , "Cookies" , Cookies [ 0 ] ) ;
SetPVarInt ( playerid , "Logged" , 1 ) ;
}
format ( str , sizeof ( str ) , ""YELLOW"Welcome back "RED"%s, "YELLOW"Your Amounts of "RED"cookies "YELLOW"are "RED"%i Cookie(s)" , iName , GetPVarInt ( playerid , "Cookies" ) ) ;
SendClientMessage ( playerid , -1 , str ) ;
}
mysql_free_result ( ) ;
return 1 ;
}