Setlevel

Started by Finch, Apr 17, 2015, 07:18 AM

Previous topic - Next topic

Finch

My setlevel command not working when i do/setlevel 0 7 its say level set to 7 when i do /admins level does not change this is command
else if ( cmd == "setlevel" )
   {
   if( stats[ player.ID ].Logged == false ) MessagePlayer( "Error - You don't have Login acess.", player);
   else if ( stats[ player.ID ].Level < 7 ) MessagePlayer( "Error - You don't have access to it.", player);
   else if ( !text ) yPrivMessage( "Syntax, / " + cmd + " <Nick/ID> <Level 3, 4 ,5> ", player );
   local plr = GetPlayer( GetTok( text, " ", 1 ) ), lvl = GetTok( text, " ", 2 );
   if ( !plr ) yPrivMessage( "Unknown Player..", player );
   else
    {
      if (!IsNum(lvl)) yPrivMessage("Level Must Be In Numbers..",player);
      else
      {
      yPrivMessage(" Admin " + player.Name + " Set Level To " + plr.Name + ", Level: " + lvl + ".",player);
      QuerySQL( sqliteDB,"UPDATE Accounts SET Level='" + lvl + "' WHERE Name='" + player.Name.tolower() + "'");
      }
   }
   }
Beztone is a scripter but he is too stupid

DizzasTeR

First of all the query you use to update level will update YOUR level no matter whos id you give brcause you are using WHERE Name = player.Name and not plr.Name.

Second you have to update the array as well for the plr to have updated level.

stats[plr.ID].Level = lvl;