29.04.2012, 11:33
Hi! I want to make a /setlevel command on mysql but it's not working
It's not writing in database!
If somebody have another command post here please


If somebody have another command post here please

pawn Code:
CMD:setlevel( playerid, params[ ] )
{
new u_P, i_L, string[ 128 ];
if( IsPlayerAdmin( playerid ) == 0 ) return SendError( playerid, "Only admins can use that command!");
if( sscanf( params, "ud", u_P, i_L ) ) return SendUsage( playerid, "/setlevel [playerid] [level]" );
if( u_P == INVALID_PLAYER_ID ) return SendError( playerid, "Player Is Not Connected!" );
if( i_L < 0 || i_L > 10 ) return SendError( playerid, "Invalid Admin Level!(Max: 10)" );
AccInfo[ u_P ][ Admin ] = i_L;
if ( i_L == 0 ){
format( string, sizeof( string ), "Administrator %s has deleted you Admin account!", PlayerName2( playerid ) );
return SendClientMessage( u_P, ABLUE, string );}
format( string, sizeof( string ), "Administrator %s has set your Admin level to %d!", PlayerName2( playerid ), i_L );
SendClientMessage( u_P, ~1, string );
format( string, sizeof( string ), "You have set %s Admin level to %d!", u_P, i_L );
SendClientMessage( playerid, ~1, string );
if(AccInfo[playerid][Logged] == 1)
{
new query[200];
format(query, sizeof(query), "UPDATE `Users` SET `Admin` = %d WHERE `Name` = %s", i_L, PlayerName2(u_P));
mysql_query(query);
}
return ( 1 );
}