CMD:adminai(playerid,params[]) { new Index, query[ 300 ], str [ 1200 ]; mysql_query( "SELECT `vardas`,`admin`,`online` FROM `zaidejai` WHERE `admin` > '0'" ); mysql_store_result(); if ( mysql_num_rows( )) { while( mysql_fetch_row( query )) { new name[ MAX_PLAYER_NAME ], adminid, OnlineEx; sscanf( query, "p<|>s[24]ii", name, adminid, OnlineEx ); if ( !OnlineEx ) { format( str, 1200, "{FFFFFF}%s%s - %s - {FF0000}OFFLINE\n{FFFFFF}", str, name, ReplaceAdminName( adminid ) ); Index++; } else { format( str, 1200, "{FFFFFF}%s%s - %s - {00FF00}ONLINE\n{FFFFFF}", str, name, ReplaceAdminName( adminid ) ); Index++; } } } mysql_free_result(); if ( !Index ) { ShowPlayerDialog( playerid, 2501, DIALOG_STYLE_MSGBOX, "{FF0000}Adminai", "{FF0000}Atsiprasome siuo metu nera isrinktas nei vienas direktorius!", "Gerai", "" ); } else { ShowPlayerDialog( playerid, 2502, DIALOG_STYLE_MSGBOX, "{00FF00}Adminai", str, "Gerai", "" ); } return 1; } |
print(query);
printf("%s %d %d", name, adminid, OnlineEx);
Wait a second.... Are you telling me that this script should show a list of online admins? If so, you don't even need mysql.
|
print(query); printf("%s Admin id: %d Online: %d", name, adminid, OnlineEx); |
[10:44:34] CMySQLHandler::FetchRow() - Return: Ance_Zas|3|1 |
sscanf( query, "p<|>s[24]ii", name, adminid, OnlineEx ); |
CMD:adminai(playerid,params[])
{
new
Index,
query[ 300 ],
str [ 1200 ];
mysql_query( "SELECT `vardas`,`admin`,`online` FROM `zaidejai` WHERE `admin` > '0'" );
mysql_store_result();
if ( mysql_num_rows( ))
{
while( mysql_fetch_row( query ))
{
new
name[ MAX_PLAYER_NAME ],
adminid,
OnlineEx;
sscanf( query, "p<|>s[24]ii", name, adminid, OnlineEx );
// Print result
print(query);
printf("%s, %d, %d", name, adminid, OnlineEx);
if ( !OnlineEx )
{
format( str, 1200, "{FFFFFF}%s%s - %s - {FF0000}OFFLINE\n{FFFFFF}", str, name, ReplaceAdminName( adminid ) );
Index++;
}
else
{
format( str, 1200, "{FFFFFF}%s%s - %s - {00FF00}ONLINE\n{FFFFFF}", str, name, ReplaceAdminName( adminid ) );
Index++;
}
}
}
mysql_free_result();
if ( !Index )
{
ShowPlayerDialog( playerid, 2501, DIALOG_STYLE_MSGBOX, "{FF0000}Adminai", "{FF0000}Atsiprasome siuo metu nera isrinktas nei vienas direktorius!", "Gerai", "" );
}
else
{
ShowPlayerDialog( playerid, 2502, DIALOG_STYLE_MSGBOX, "{00FF00}Adminai", str, "Gerai", "" );
}
return 1;
}
[11:57:06] Ance_Zas|3|1 [11:57:06] Ance_Zas|3|1, 0, 0 |