SetLevel

Started by FinchDon, Sep 05, 2015, 04:12 PM

Previous topic - Next topic

FinchDon

Hello This is My Setlevel command it show msg lvl setted but not set i am using fuzzie account system


else if ( cmd == "setlevel" )
{
     if ( pstats[ player.ID ].Level < 10 ) MessagePlayer( "[#FF0000]You need to be atleast Level 10", player );
else if ( !text ) ePrivMessage( "Syntax, / " + cmd + " <Nick/ID> <Level> ", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ePrivMessage( "Unknown Player..", player );
else
{
   local lvl = GetTok( text, " ", 2);
   if (!IsNum(lvl)) ePrivMessage("Level Must Be In Numbers..",player);
   else
   {
   ePrivMessage(" Admin " + player.Name + " Set Level To " + plr.Name + ", Level: " + lvl + ".",player);
   QuerySQL(sqliteDB,"UPDATE Accounts SET Level='" + lvl + "' WHERE Name='" + plr.Name + "'");
                   EchoMessage( ICOL_RED + "Admin " + player.Name + " Set Level To " + plr.Name + ", Level: " + lvl + "." );
   }
}
}
}
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

DizzasTeR

Why run a query? Why don't you set it using:
pstats[ player.ID ].Level = lvl.tointeger();

KAKAN

Nice idea, i had the same problem :P
can u debug this?
else if ( cmd ==  FBS_PREFIX + "setlevel" )
   {
       if ( level < 6 ) EchoNotice( user, "Error - Your level is not high enough to use that command." );
            else if ( !text ) EchoNotice( user, "Error - Syntax: " + cmd + " <Nick> <Level> ");
       else
      {
          local plr, level;
  plr = GetTok(text," ", 1);
          level = NumTok( text, " ", 2 );
  if(!IsNum(level)) EchoNotice(user,"Level must be in numbers.");
  else if (!level) EchoNotice(user,"Please type the level also.");
          else
          {
              QuerySQL(sqliteDB,"UPDATE Accounts SET Level='" + level.tointeger() + "' WHERE Name='" + plr + "'" );
                    EMessage( "Owner " + user + " have  Setted Level Of Player:[ "  + plr +  " ]. To "+level.tointeger()+"." );

                }
}
      }
oh no

DizzasTeR

WHERE Name='" + plr + "'
Since when names are stored as instances?

KAKAN

So what shall i use?
oh no

.

That's what happens when you don't verify the resulted query string. And that's why this plugin was created. For those who never print the resulted query strings and then send it to a silent plugin.
.

.

.

KAKAN

As u can see I don't use GetPlayer, so i shall use plr.Name?
oh no

KAKAN

Oye no need to debug, I did it!
oh no

DizzasTeR

Quote from: KAKAN on Sep 05, 2015, 06:02 PMOye no need to debug, I did it!

Excuse me but that's pure nonsense "I did it!".

FinchDon

Quote from: Doom_Killer on Sep 05, 2015, 04:19 PMWhy run a query? Why don't you set it using:
pstats[ player.ID ].Level = lvl.tointeger();

@Doom_Killer Should Be Plr :D

@S.L.C I am using your plugin from start ;)

Topic Lock! ;)
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )