setlevel cmd not work :/

Started by ali_vcmp, Nov 20, 2014, 06:43 PM

Previous topic - Next topic

ali_vcmp

I Make This Setlevel cmd and i set any player level /setlevel ali 10 is doesnt Work :/ I Was Tried
else if ( cmd == "setlevel" )
{
if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + player.Name.tolower() + "'");
   }
}
}

MatheuS

#1
Quote from: ali_vcmp on Nov 20, 2014, 06:43 PMI Make This Setlevel cmd and i set any player level /setlevel ali 10 is doesnt Work :/ I Was Tried
else if ( cmd == "setlevel" )
{
if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + player.Name.tolower() + "'");
   }
}
}

ePrivMessage // you have this function in the script?


PrivMessage( "Unknown Player..", player );
  // this wrong
PrivMessage( player, "Hey you, have fun here!");  // certain function

Look here!
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Sk

#2
try this and let me know
else if ( cmd == "setlevel" )
{
if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
else
{
local plr = FindPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + plr.Name.tolower() + "'");
}
}
}
}




ali_vcmp


ali_vcmp

Quote from: MatheuS on Nov 20, 2014, 07:48 PM
Quote from: ali_vcmp on Nov 20, 2014, 06:43 PMI Make This Setlevel cmd and i set any player level /setlevel ali 10 is doesnt Work :/ I Was Tried
else if ( cmd == "setlevel" )
{
if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + player.Name.tolower() + "'");
   }
}
}

ePrivMessage // you have this function in the script?


PrivMessage( "Unknown Player..", player );
  // this wrong
PrivMessage( player, "Hey you, have fun here!");  // certain function

Look here!
function ePrivMessage( text, player )
{
    ClientMessage( "** pm >> " + text, player, 255, 165, 0);
}
yes i have

Sk

#5
ok i edited the line
WHERE user='"+player.Name.tolower()+"' into WHERE user='"+plr.Name.tolower()+"'
new code
else if ( cmd == "setlevel" )
{
if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
else
{
local plr = FindPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + plr.Name.tolower() + "'");
}
}
}
}
try editing and then try
and if you could show me/us some console error? i might help even further

ali_vcmp


MatheuS

else if ( cmd == "setlevel" )
   {
   if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Level> ", player );
   local plr = GetPlayer( GetTok( text, " ", 1 ) );
   if ( !plr ) PrivMessage( player, "Unknown 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(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + player.Name.tolower() + "'");
      }
   }
   }

try.
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

ali_vcmp


MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

ali_vcmp

i type /setlevel ali 10 Server Send ME admin change ali_vcmp level 10 and i type level its not change my level :/ 

Sk

Quote from: MatheuS on Nov 20, 2014, 08:28 PMhttp://forum.vc-mp.org/?topic=113.0
yup please show us what error from console.....
(yar koi tasweer ly kr error ki upload kro or humain dikhao) to eng -> (bro please upload the picture of the error and show us..)

MatheuS

Quote from: ali_vcmp on Nov 20, 2014, 08:32 PMi type /setlevel ali 10 Server Send ME admin change ali_vcmp level 10 and i type level its not change my level :/ 

So the error is here:

QuerySQL(database,"UPDATE registration SET account_level='" + lvl + "' WHERE user='" + player.Name.tolower() + "'");
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Sk

can,t help without console error picture or something