•  
Welcome, Guest. Please login or register.

News: Sezaro has been accepted as trainee!.
       


Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gito baloch

Pages: [1]
1
Scripting / ( Simple ) Nogoto on/off system.
« on: July 18, 2021, 09:34:57 am »
NOGOTO SYSTEM BY GITO

Class

Code: [Select]
Class PlayerStats{
nogoto = false;
}

Database
Code: [Select]
function onScriptLoad() {
nogoto <- ConnectSQL("Nogoto.db");
QuerySQL(nogoto, "create table if not exists nogoto ( Name Text ,nogoto TEXT) ");
}

Database Close
Code: [Select]
function onScriptUnload() {
DisconnectSQL(nogoto);
}

Functions
Code: [Select]
function Nogoto(player)
{
    local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + escapeSQLString(player.Name) + "'");
    if (q)
    {
        stats[ player.ID ].nogoto = GetSQLColumnData( q, 1 );
    }
    else QuerySQL( nogoto, "INSERT INTO nogoto ( Name, nogoto ) VALUES ( '" + escapeSQLString(player.Name) + "', ' false ' )" );
}

function Nogotodb(player)
{
    QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'");
}


PlayerJoin
Code: [Select]
function onPlayerJoin(player){
Nogoto(player);
}

PlayerPart
Code: [Select]
function onPlayerPart(player); {
Nogotodb(player);
}

PlayerCommand
Code: [Select]
function onPlayerCommand(player, cmd, text){
else if(cmd == "nogoto")
{
if(!text) MessagePlayer("[#ff0000]Error: [#ffffff]/" + cmd + " <on/off>", player);
else
{
if(text == "on" || text == "1" || text == "set" || text == "true")
{
                local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + player.Name + "'");
            if (stats[player.ID].nogoto == true) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already on!",player);
            else if( q && GetSQLColumnData(q, 1) == "true" ) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already on!",player);
else {
stats[player.ID].nogoto = true;
MessagePlayer("[#ffa447]Nogoto has been turned on, Now no one will be able to teleport to you.",player);
QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'");
        }
        }
if(text == "off" || text == "0" || text == "del" || text == "false")
{
            if (stats[player.ID].nogoto == false) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already off!",player);
else {
stats[player.ID].nogoto = false;
MessagePlayer("[#ffa447]Nogoto has been turned off, Everyone will be able to teleport to you.",player);
     QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'");
}
    }
}
return 0;
}
}



Goto Line
Put this on goto command
Code: [Select]
        local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + plr.Name + "'");
    if( q && GetSQLColumnData(q, 1) == "true" ) MessagePlayer("[#ff0000]Error: [#ffffff]Target player has his nogoto enabled!",player);
        else if (stats[plr.ID].nogoto == true) MessagePlayer("[#ff0000]Error: [#ffffff]Target player has his nogoto enabled!",player);






2
Scripting / ( Simple ) Ban System.
« on: July 11, 2021, 07:41:46 am »
Ban System (DURATION)


Creating Database
[noae]
Code: [Select]
DataBase <- ConnectSQL("Databases/BanSys.db");   
QuerySQL(DataBase, "create table if not exists Bans ( Name TEXT, UID TEXT, UID2 TEXT, Admin TEXT, Reason TEXT, Time INTEGER, IP REAL)");
[/noae]

onPlayer Join
[noae]
Code: [Select]
CheckBan( player );
[/noae]

OnPlayer Command
[noae]
Code: [Select]
else if (cmd == "ban")
{
if (!stats[player.ID].Registered) return MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player);
else if (!stats[player.ID].Logged) return MessagePlayer("[#FF0000]You're Not Logged in.", player);
else if ( stats[ player.ID ].Level < 3 ) return MessagePlayer("[#FF0000]You don't have Authorization to to use this command.", player);
else if ( !text ) PrivMessage( player, format( "Error: Use /%s <player> Days Hours Reason", cmd ) );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( plr )
{
local d = GetTok( text, " ", 2 ), h = GetTok( text, " ", 3 );
local reason = GetTok( text, " ", 4 NumTok( text, " " ) );
if (!IsNum(d)) return MessagePlayer("[#FF0000]Error: Days Must be in integers.",player);
else if (!IsNum(h)) return MessagePlayer("[#FF0000]Error: Hours Must be in integers.",player);
else if (!reason) return MessagePlayer("[#FF0000]ERROR: Reason is Missing.",player);
else if ( reason && d && h && IsNum( d ) && IsNum( h ) ) Ban( plr, player.Name, reason, d.tointeger(), h.tointeger() );
}
else MessagePlayer("Invalid Player.",player);
}
        return 0;
}


else if (cmd == "unban")
{
        if(stats[player.ID].Level < 3) MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player);
        else if (!text) MessagePlayer("Correct syntax - /"+cmd+" Full player name",player);
else
{
DelBan( player.Name, text );
Message("[#ffffff]"+player.Name + "[#25A5F9] has unbanned[#ffffff] ( " + text + " ) ");
}
        return 0;
}
[/noae]

Functions
[noae]
Code: [Select]
function Ban( player, admin, reason, d, h )
{
local name = player.Name.tolower(), Time = time() + d * 86400 + h * 3600;
QuerySQL( DataBase, "INSERT INTO Bans ( Name, UID, UID2, Admin, Reason, Time, IP ) VALUES ( '" + name + "', '" + player.UniqueID + "', '" + player.UniqueID2 + "', '" + admin + "', '" + reason + "', '" + Time.tointeger() + "', '" + player.IP + "')" );
Message( admin + " banned " + name + ", reason:[ " + reason + " ] time: [ " + d + " days, " + h + " hours ]." );
KickPlayer( player );
}
function GetLastDay( t1, t2 )
{
    local time = t2 - t1, min = ( time / 60 ).tointeger(), week = 0, hour = 0, day = 0;
while( min >= 60 ) { hour += 1; min -= 60; }
while( hour >= 24 ) { day += 1; hour -= 24; }
while( day >= 7 ) { week += 1; day -= 7; }
return ( week == 0 ? day + " days " + hour + " hours " + min + " minutes" : week + " weeks " + day + " days" );
}
function CheckBan( plr )
{
local q = QuerySQL( DataBase, "SELECT * FROM Bans WHERE UID='" + plr.UniqueID + "'" ), q2, q3;
if ( q )
{
local time1 = GetSQLColumnData( q, 5 ).tointeger();
if ( time1 && time() >= time1 )
{
QuerySQL( DataBase, "DELETE FROM Bans WHERE UID='" + plr.UniqueID + "'" );
FreeSQLQuery(q);
return false;
}
    local admin = GetSQLColumnData( q, 3 ), reason = GetSQLColumnData( q, 4 ), relname = GetSQLColumnData( q, 0 );

Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." );
    KickPlayer( plr );
FreeSQLQuery( q );
return true;
}
else
{
q2 = QuerySQL( DataBase, "SELECT * FROM Bans WHERE IP='" + plr.IP + "'" );
if ( q2 )
{
local time1 = GetSQLColumnData( q2, 5 ).tointeger();
if ( time1 && time() >= time1 )
{
QuerySQL( DataBase, "DELETE FROM Bans WHERE IP='" + plr.IP + "'" );
FreeSQLQuery(q2);
return false;
}
      local admin = GetSQLColumnData( q2, 3 ), reason = GetSQLColumnData( q2, 4 ), relname = GetSQLColumnData( q2, 0 );

Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." );
    KickPlayer( plr );
FreeSQLQuery( q2 );
return true;
}
else
{
q3 = QuerySQL( DataBase, "SELECT * FROM Bans WHERE LOWER(Name)='" + plr.Name.tolower() + "'" );
if ( q3 )
{
local time1 = GetSQLColumnData( q3, 5 ).tointeger();
if ( time1 && time() >= time1 )
{
QuerySQL( DataBase, "DELETE FROM Bans WHERE LOWER(Name)='" + plr.Name + "'" );
FreeSQLQuery(q3);
return false;
}
      local admin = GetSQLColumnData( q3, 3 ), reason = GetSQLColumnData( q3, 4 ), relname = GetSQLColumnData( q3, 0 );

Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." );
    KickPlayer( plr );
FreeSQLQuery( q3 );
return true;
}
}
}
try
{
FreeSQLQuery( q );
if ( q2 ) FreeSQLQuery( q2 );
if ( q3 ) FreeSQLQuery( q3 );
}
catch(e)
return false;
}

function DelBan( admin, banned )
{
QuerySQL( DataBase, "DELETE FROM Bans WHERE Name='" + banned.tolower() + "'" );
Message( "done." );
}
[/noae]

3
Scripting / ( Simple ) Admin System.
« on: July 11, 2021, 07:30:47 am »
----------///---LEVEL SYSTEM---\\\----------

Player Class
Code: [Select]
class PlayerClass
{
    Level = 0;
}

Creating Database
Code: [Select]
Admin <- ConnectSQL("Level.db");
QuerySQL(Admin, "create table if not exists Level ( Name Text ,Level NUMERIC DEFAULT 0) ");

Functions
Code: [Select]
function AdminInfo(player)
{
    local q = QuerySQL(Admin, "SELECT * FROM Level WHERE Name = '" + escapeSQLString(player.Name) + "'");
    if (q)
    {
        stats[ player.ID ].Level = GetSQLColumnData(q, 1);
    }
    else QuerySQL( Admin, "INSERT INTO Level ( Name, Level ) VALUES ( '" + escapeSQLString(player.Name) + "', ' 0 ' )" );
}

function SaveAdmin(player)
{
    QuerySQL( Admin, "UPDATE Level SET Level='"+ stats[ player.ID ].Level +"' WHERE Name = '"+player.Name+"'");
}

OnPlayer Join
Code: [Select]
AdminInfo();

OnPlayer Part
Code: [Select]
SaveAdmin();
Set Level Command
Code: [Select]
   else if ( ( cmd == "setlevel" ) || ( cmd == "setlvl" ) )
{
if ( stats[ player.ID ].Level < 5 ) MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player);
else if ( !text ) PrivMessage( player, format( "Error: Use /%s <player> <Level>", cmd ) );
else
{
local txt = split( text, " " );
if ( txt.len() >= 2 )
{
local plr = FindPlayer( txt[ 0 ] ), lvl = txt[ 1 ];
if ( !plr ) PrivMessage( player, "Error: Unknown player." );
else if ( !IsNum( lvl ) ) ClientMessage( player, "Error: Level must be in numbers...",player, 255, 0, 0 );
else if ( ( lvl.tointeger() < 1 ) || ( lvl.tointeger() > 7 ) ) ClientMessage( "ERROR: Allowed Level amount are between 1 and 7.", player, 255, 0, 0 );
else if ( stats[ plr.ID ].Level == lvl.tointeger() ) PrivMessage( player, format( "Error: %s's Level is %d already.", plr.Name, lvl.tointeger() ) );
else
{
stats[ plr.ID ].Level = lvl.tointeger();
Message( "[#ffffff]"+player.Name+" [#25AAAA]changed the level of[#ffffff] "+plr.Name+"[#25AAAA] to [#ffffff]["+lvl.tointeger()+"].");
                }
}
else PrivMessage( player, format( "Error: Usage /%s <player> <Level>", cmd ) );
}
return 0;
}

Example command
Code: [Select]
else if ( cmd=="assrocket")
{
if(stats[player.ID].Level < 2) return MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player);
else
{
if (!text) MessagePlayer("[#51FF06]Usage :[#FFFFFF] /assrocket <Name/ID>",player);
else
{
local plr = FindPlayer(text);
plr.Pos = player.Pos;
Message("[#ffffff]"+player.Name+ "[#25AAAA] has bombed [#ffffff]" +plr.Name);
CreateExplosion( 1, 1,plr.Pos.x -3 , plr.Pos.y -5, plr.Pos.z, -1, true );
CreateExplosion( 1, 2,plr.Pos.x -3, plr.Pos.y -5, plr.Pos.z, -1, true );
CreateExplosion( 1, 3,plr.Pos.x -3, plr.Pos.y -5, plr.Pos.z, -1, true );
CreateExplosion( 1, 4,plr.Pos.x -3 , plr.Pos.y -5, plr.Pos.z, -1, true );
}
}
return 0;
}

4


Like n subscribe please guys!

Pages: [1]