db prob and function

Started by :P, Apr 22, 2016, 11:52 AM

Previous topic - Next topic

:P

when i use setlevel cmd for setting level its say done but not updated in db and getlevel and getleveltag not working not geting i  used it in playerchat it says null cxooooo thats null coming on leveltag place
function GetLevel(player)
{
local Level =  GetSQLColumnData( QuerySQL( sqliteDB, "SELECT Level FROM Accounts WHERE Name='" + player.Name.tolower() + "'" ), 0 );
if ( Level ) return Level;
else return 0;
}
function GetLevelTag(player)
{
local Level = GetLevel(player);
if( Level == 1 ) return "Member";
if( Level == 5 ) return "Moderator";
if( Level == 6 ) return "Admin";
if( Level == 7 ) return "Management";
if( Level == 8 ) return "Developer";
}
onplayerchat
function onPlayerChat( player, text )
   {
   local col = TeamidToRGB( player.Team ), colHex = format("#%02X%02X%02X", col.r, col.g, col.b);
 EchoMessage( ICOL_LBLUE + "[" + player.ID + "] " + player.Name + "> " + ICOL_BLUE + " " + text + " " );
 Message(GetLevelTag(player) + ": [" + colHex + "]" + player.Name + ": " + WHITE + " " + text );
 if ( text )
 {
  if ( text.slice( 0, 1 ) == "!" )
  {
   local i = NumTok( text, " " ), xp = null;

   if ( i == 1 ) onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), xp );
   else onPlayerCommand2( player, GetTok( text.slice( 1 ), " ", 1 ), GetTok( text.slice( 1 ), " ", 2, i ) );
}
}

  }
SLC is a good scripter but he always use bad words for abusing players :P

KAKAN

Use this function:
function GetLevelTag(player)
{
local Level = GetLevel(player);
switch( Level.tointeger() )
{
case 1: return "Member";
case 5: return "Moderator";
case 6: return "Admin";
case 7: return "Management";
case 8: return "Developer";
default: return "Puto!";
}
}
oh no

:P

its showing puto on any level
its means its doesent geting level from db so what i do for this
SLC is a good scripter but he always use bad words for abusing players :P

:P

thanks Kakan your function working and other prob is due wrong query i solved it thanks
SLC is a good scripter but he always use bad words for abusing players :P