/setlevel /headsetlevel /devsetlevel

Started by umar4911, Oct 29, 2017, 11:00 AM

Previous topic - Next topic

umar4911

@[MCO]We3da
Here are the cmds

player stats
Level = 0;


database connection and table
DB <- ConnectSQL("databases/Registration.db");


 QuerySQL(DB, "create table if not exists Accounts ( Name TEXT, LowerName TEXT, Password VARCHAR(255), Level NUMERIC DEFAULT 1, Money VARCHAR(255), Bank VARCHAR(255), TimeRegistered VARCHAR(255) DEFAULT CURRENT_TIMESTAMP, UID VARCHAR(255), IP VARCHAR(255), AutoLogin BOOLEAN DEFAULT true, Banned TEXT ) ");


Add this. This is onPlayerJoin and AccInfo function
function onPlayerJoin(player)
{
status[player.ID] = PlayerStats();
AccInfo(player);
}

function AccInfo(player)
{
 local q = QuerySQL(DB, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
 if (q)
 {
  status[player.ID].Level = GetSQLColumnData(q, 3);
}

Commands
else if ( cmd == "setlevel" || cmd == "darlevel")
{
if(status[player.ID].Level < 8) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access.", player);
if ( !arguments ) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else if ( NumTok( arguments, " " ) < 2 ) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else
{
local q = QuerySQL(DB , "SELECT * FROM Accounts WHERE Name ='" + GetTok( arguments, " ", 1 ) + "'" );
if(!q) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Invalid Player", player);
else
{
local plr = GetSQLColumnData(q, 0);
local plrl = GetSQLColumnData(q, 3);
if ( plrl > 7 ) MessagePlayer( "[#FFDD33]Usage Error:[#FFFFFF] You cannot set the level of head servers.", player );
else
{
local lvl = GetTok( arguments, " ", 2);
if (!IsNum(lvl)) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Level must be only in numbers.",player);
else
{
MessagePlayer("[#FFDD33]Administator Command:[#FFFFFF] Admin[" + player.Name + "] set level of player :" + plr + " to: " + lvl + ".",player);
QuerySQL(DB , "UPDATE Accounts SET Level='" + lvl + "' WHERE Name = '" + plr + "'" );
}
}
}
}
}

 
 
else if ( cmd == "headsetlevel" || cmd == "headdarlevel")
{
if(status[player.ID].Level < 10) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access.", player);
if ( !arguments ) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else if ( NumTok( arguments, " " ) < 2 ) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else
{
local q = QuerySQL(DB , "SELECT * FROM Accounts WHERE Name ='" + GetTok( arguments, " ", 1 ) + "'" );
if(!q) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Invalid Player", player);
else
{
local plr = GetSQLColumnData(q, 0);
local plrl = GetSQLColumnData(q, 3);
if ( plrl >= 15 ) MessagePlayer( "[#FFDD33]Usage Error:[#FFFFFF] You cannot set the level of the Developer.", player );
else
{
local lvl = GetTok( arguments, " ", 2);
if (!IsNum(lvl)) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Level must be only in numbers.",player);
if(lvl > "10") MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] You cannot set level of player more than 10.", player);
else
{
MessagePlayer("[#FFDD33]Administrator Command:[#FFFFFF] Admin[" + player.Name + "] set level of player :" + plr + " to: " + lvl + ".",player);
QuerySQL(DB , "UPDATE Accounts SET Level='" + lvl + "' WHERE Name = '" + plr + "'" );
status[plr.ID].Level = lvl.tointeger();

}
}
}
}
}


else if ( cmd == "devsetlevel" || cmd == "devdarlevel")
{
if(status[player.ID].Level < 20) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access.", player);
if ( !arguments ) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else if ( NumTok( arguments, " " ) < 2 ) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Use /"+cmd+" [Nick/ID] [Level]", player );
else
{
local plr = FindPlayer(GetTok(arguments, " ", 1));
local q = QuerySQL(DB , "SELECT * FROM Accounts WHERE Name ='" + plr.Name + "'" );
if(!plr) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Invalid player", player);
else if(!q) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Data of player : "+plr+" not found in database", player);
else
{
local plrl = GetSQLColumnData(q, 3);
local lvl = GetTok( arguments, " ", 2);
if (!IsNum(lvl)) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Level must be only in numbers.",player);
else
{
MessagePlayer("[#FFDD33]Developer Command:[#FFFFFF] Developer[" + player.Name + "] set level of player :" + plr + " to: " + lvl + ".",player);
QuerySQL(DB , "UPDATE Accounts SET Level='" + lvl + "' WHERE Name = '" + plr.Name + "'" );
status[plr.ID].Level = lvl.tointeger();
}
}
}
}


I am gamer, programmer and hacker. Try to find me!
xD

Mohamed Boubekri

#1
Thanks bro Umar For You Helpppppp :DDDDD But
Can You Transfer Thi Command To Fuzzi Account SYstem
 i am Download thi command but dont work for fuzzi account system
 can u modify thi command to fuzzi account system and Thanks.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

!

#2
Giving me an error: the index status does not exist.
For the f**k sake fix it or remove this topic >:( or move it to the correct place.

Discord: zeus#5155

D4rkR420R

Quote from: zeus on Oct 30, 2017, 07:25 AMGiving me an error: the index status does not exist.
For the f**k sake fix it or remove this topic >:( or move it to the correct place.

Did you even made a array named status?

!

Where the **** did he mention to make an array for the status
PS: Visit here and Read it carefully.

QuoteScript Showroom 1
Releases of full, usable scripts.

Discord: zeus#5155

umar4911

Quote from: zeus on Oct 30, 2017, 07:25 AMGiving me an error: the index status does not exist.
For the f**k sake fix it or remove this topic >:( or move it to the correct place.
Quote from: zeus on Oct 31, 2017, 06:55 AMWhere the **** did he mention to make an array for the status
PS: Visit here and Read it carefully.

QuoteScript Showroom 1
Releases of full, usable scripts.
see now and pls dont get angry
I am gamer, programmer and hacker. Try to find me!
xD

Mohamed Boubekri

@umar4911 Can u Give Me the Function Of It ? :P
if ( plrl > 7 )
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

umar4911

Quote from: Mohamed on Nov 28, 2017, 11:02 AM@umar4911 Can u Give Me the Function Of It ? :P
if ( plrl > 7 )
Read the code carefully so you can understand it
I am gamer, programmer and hacker. Try to find me!
xD

Mohamed Boubekri

@umar4911 Hmm i Dont Have Any Idea For That's Code But i Need That's.

I Added But When Me Manager Level 9 i Can Set my level To 10

:D
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

umar4911

Quote from: Mohamed on Nov 28, 2017, 06:29 PM@umar4911 Hmm i Dont Have Any Idea For That's Code But i Need That's.

I Added But When Me Manager Level 9 i Can Set my level To 10

:D
I have named the playerstats class as status
status[player.ID] = PlayerStats();This make it status[player.ID].Level
got it?
I am gamer, programmer and hacker. Try to find me!
xD

Mohamed Boubekri

@umar4911 I know That's Brother I'm Joined the Game With Level 9

And i Do /msetlevel We3da 10 // My Level is Setted To 10 Lol And I'm Manager ?

M = Manager / iWant A Function / i Can't Set my level to higher Level Can You Give Me :D
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

D4rkR420R

Quote from: Mohamed on Nov 29, 2017, 12:24 PM@umar4911 I know That's Brother I'm Joined the Game With Level 9

And i Do /msetlevel We3da 10 // My Level is Setted To 10 Lol And I'm Manager ?

M = Manager / iWant A Function / i Can't Set my level to higher Level Can You Give Me :D

Add a if statement if the manager tries to set his level higher than his.

Mohamed Boubekri

Yas Was find Of Ti @KuRiMi Gave me Example ? :/
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

D4rkR420R


Mohamed Boubekri

Here It Is @KuRiMi,

else if ( cmd == "setlevel" )
{
if( pstats[ player.ID ].Logged == false ) MessagePlayer( "[#ff0000][INFO][#ffffff] You Need Login or Register First.", player );
else if ( pstats[ player.ID ].Level < 10 ) MessagePlayer( "[#FF0000][INFO][#ffffff] You Are Not Authorized To use This Command", player );
else if ( !text ) MessagePlayer( "[#00BBFF][INFO][#ffffff] /setlevel <Nick/id> <Level>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
local plrl = GetSQLColumnData(q, 3);
if ( plrl >= 10 ) MessagePlayer( "[#FFDD33]Usage Error:[#FFFFFF] You cannot set the level of the Developer.", player );
if ( !plr ) MessagePlayer( "[#ff0000][ERROR][#ffffff] Unknown Player..", player );
else
{
local lvl = GetTok( text, " ", 2);
if (!IsNum(lvl)) MessagePlayer("[#ff0000][ERROR][#ffffff] Level Must Be In Numbers..",player);
else
{
Message("[#fff123]Administrator[#ffffff] " + player.Name + " Set Level To " + plr.Name + ", Level: " + lvl + ".");
QuerySQL( sqliteDB,"UPDATE Accounts SET Level='" + lvl + "' WHERE Name='" + plr.Name + "'");
pstats[ player.ID ].Level = lvl.tointeger();
}
}
}
}

But When I'm Level 9 I Can Set My Level To 10 :/
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].