ah bro how to recompile it and how compile it Please reply.
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.
Show posts MenuTempBans <- ConnectSQL("TempBans.db");
QuerySQL(TempBans, "CREATE TABLE IF NOT EXISTS TempBans(Name TEXT, UID TEXT, UID2 TEXT, IP FLOAT, Admin TEXT, Reason TEXT, Time INTEGER, NowTime INTEGER)");
CheckTempBan( player );
if( cmd == "tempban" )
{
if(!text) MessagePlayer("Error - use /"+cmd+" <Player/ID> [Days:Hours:Minutes] <Reason>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1));local expire = GetTok(text, " ",2);local reason = GetTok(text, " ",3 NumTok(text, " "));local ban_expire = split(expire, ":");
if(!plr) MessagePlayer("Unknow player!",player);
else if(!expire) MessagePlayer("Error - Please write expire time format DAYS:HOURS:MINUTES and should numbers!",player);
else if(NumTok(expire, ":") != 3) MessagePlayer("Error - Invalid format, The format must be DAYS:HOURS:MINUTES!",player);
else if(IsNum(ban_expire[0]) && IsNum(ban_expire[1]) && IsNum(ban_expire[2]))
{
if(!reason) reason = "None";
local calc = (time()+ban_expire[0].tointeger()*24*60*60 + ban_expire[1].tointeger()*60*60 + ban_expire[2].tointeger()*60);
QuerySQL(TempBans, "INSERT INTO TempBans(Name, UID, UID2, IP, Admin, Reason, Time, NowTime) VALUES('"+plr.Name.tolower()+"', '"+plr.UniqueID+"', '"+plr.UniqueID2+"', '"+plr.IP.tofloat()+"', '"+player.Name+"', '"+reason+"', '"+calc+"', '"+time()+"')");
Message("[#FF0000]Admin:[ "+player.Name+" ] banned:[ "+plr.Name+" ] Reason:[ "+reason+" ] Time:[ "+GetRemainingTime(calc,time())+" ]");
plr.Kick();
}
else MessagePlayer("Error - Format must be integer!",player);
}
}
else if( cmd == "untempban" )
{
if(!text) MessagePlayer("Error - Syntax; /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE Name='"+text.tolower()+"'");
if(!q) MessagePlayer("Error - "+text+" is not tempbanned!.",player);
else {
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+text.tolower()+"'");
MessagePlayer("[#00FF00][SUCCESS]: [#FFFFFF]"+text+" has been untempbanned!.",player);
}
}
}
function CheckTempBan(plr)
{
local q = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
if(q){
local admin = GetSQLColumnData(q,4), reason = GetSQLColumnData(q,5),t = GetSQLColumnData(q,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(q);
}
}
else {
local uid = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE UID='"+plr.UniqueID+"'");
if(uid){
local admin = GetSQLColumnData(uid,4), reason = GetSQLColumnData(uid,5),t = GetSQLColumnData(uid,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(uid);
}
}
else {
local uid2 = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE UID2='"+plr.UniqueID2+"'");
if(uid2){
local admin = GetSQLColumnData(uid2,4), reason = GetSQLColumnData(uid2,5),t = GetSQLColumnData(uid2,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(uid2);
}
}
else {
local ip = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE IP='"+plr.IP.tofloat()+"'");
if(ip){
local admin = GetSQLColumnData(ip,4), reason = GetSQLColumnData(ip,5),t = GetSQLColumnData(ip,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(ip);
}
}
}
}
}
}
function GetRemainingTime(basict, oldt)
{
local time = basict-oldt, min = ( time / 60 ).tointeger();
local year = 0, month = 0, week = 0, day = 0, hour = 0;
local total_time = "";
while(min >= 60){hour++;min-=60;}
while(hour >= 24){day++;hour-=24;}
while(day >= 7){week++;day-=7;}
while(week >= 5){month++;week-=5;}
while(month >= 12){year++;month-=12;}
if(year > 0){if(total_time != "")total_time += year+" year(s), ";else total_time = year+" year(s) ";}
if(month > 0){if(total_time != "") total_time += month+" month(s), ";else total_time = month+" month(s) ";}
if(week > 0){if(total_time != "")total_time += week+" week(s), ";else total_time = week+" week(s) ";}
if(day > 0){if(total_time != "")total_time += day+" day(s), ";else total_time = day+" day(s) ";}
if(hour > 0){if(total_time != "")total_time += hour+" hour(s), ";else total_time = hour+" hour(s) ";}
if(min > 0){if(total_time != "")total_time += min+" minute(s)"; else total_time = min+" minute(s) ";}
if(year == 0 && month == 0 && week == 0 && day == 0 && hour == 0 && min == 0) total_time = "Some seconds and will unban";
return total_time;
}
function GetTok( string, separator, n, ... )
{
local m = ( vargv.len() > 0 ) ? vargv[ 0 ] : n, tokenized = split( string, separator ), text = "";
if ( ( n > tokenized.len() ) || ( n < 1 ) ) return null;
for ( ; n <= m; n++ )
{
text += text == "" ? tokenized[ n - 1 ] : separator + tokenized[ n - 1 ];
}
return text;
}
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
function GetPlayer( target )
{
local target1 = target.tostring();
if ( IsNum( target ) )
{
target = target.tointeger();
if ( FindPlayer( target) ) return FindPlayer( target );
else return null;
}
else if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
Quote from: gamingpro on Jun 18, 2023, 02:27 PMincorrect its must beCreateCheckpoint(player, ID, Showing(true or false), Vector(PosX, PosY, PosZ), ARGB(Alpha, Red, Green, Blue), Size);
The result is:CreateCheckpoint(null, 0, true, Vector(-902.341,-345.601,13.3802), ARGB(355, 255, 0, 0), 2);
Bans <- ConnectSQL("Bans.db");
QuerySQL(Bans, "CREATE TABLE IF NOT EXISTS Bans(player TEXT, Admin TEXT, Reason TEXT, UID TEXT, UID2 TEXT, IP FLOAT)");
print("Basic ban system has been loaded successfully by gamingpro...");
[/noae]DisconnectSQL( Bans );
[/noae]CheckBan( player ); // Check if player banned or Not.
[/noae]if(cmd == "ban"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Player> <Reason>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1)),
Reason = GetTok(text, " ",2 NumTok(text, " "));
if(!plr) MessagePlayer("[#FF0000]Error: [#FFFFFF]Unknow Player...",player);
else {
if(!Reason) Reason = "No_Reason"; // here if the admin not giving reason return to No_Reason.
Ban( plr, player.Name, Reason );
}
}
else if(cmd == "unban"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct syntax /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+text.tolower()+"'");
if(!q) MessagePlayer("[#FF0000]"+text+" is Not banned yet...",player);
else {
QuerySQL(Bans, "DELETE FROM Bans WHERE player='"+text.tolower()+"'");
ClientMessage("Adminstrator:[ "+player.Name+" ] Unbanned:[ "+text+" ]",player,0,255,0);
}
}
}
else if(cmd == "baninfo"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct syntax /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+text.tolower()+"'");
if(!q) MessagePlayer("[#FF0000]"+text+" is Not banned yet...",player);
else {
MessagePlayer("[#00FF00][BAN INFO]: [#FFFFFF]"+text+" Banned Reason:[ "+GetSQLColumnData(q,2)+" ], Admin:[ "+GetSQLColumnData(q,1)+" ]",player);
FreeSQLQuery(q);
}
}
}
}
[/noae]function Ban( banned, admin, reason ){
local nick = banned.Name.tolower();
QuerySQL(Bans, "INSERT INTO Bans(player, Admin, Reason, UID, UID2, IP) VALUES('"+nick+"', '"+admin+"', '"+reason+"', '"+banned.UniqueID+"', '"+banned.UniqueID2+"', '"+banned.IP+"')");
Message("[#db0000]Adminstrator:[#FFFFFF][ "+admin+" ] [#db0000]Banned:[#FFFFFF][ "+banned.Name+" ] [#db0000]For Reason: [#FFFFFF]"+reason);
banned.Kick(); // kicking player.
}
function CheckBan( plr ){
local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+plr.Name.tolower()+"'");
if(q){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(q,2)+" ] Admin:[ "+GetSQLColumnData(q,1)+" ].");
plr.Kick();
}
else {
local q2 = QuerySQL(Bans, "SELECT * FROM Bans WHERE UID='"+plr.UniqueID+"'");
if(q2){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(q2,2)+" ], Admin:[ "+GetSQLColumnData(q2,1)+" ].");
plr.Kick();
}
else {
local uid2 = QuerySQL(Bans, "SELECT * FROM Bans WHERE UID2='"+plr.UniqueID2+"'");
if(uid2){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(uid2,2)+" ], Admin:[ "+GetSQLColumnData(uid2,1)+" ].");
plr.Kick();
}
else {
local ip = QuerySQL(Bans, "SELECT * FROM Bans WHERE IP='"+plr.IP+"'");
if(ip){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(ip,2)+" ], Admin:[ "+GetSQLColumnData(ip,1)+" ].");
plr.Kick();
}
}
}
}
try
{
FreeSQLQuery(q);
if(q2) FreeSQLQuery(q2);
if(uid2) FreeSQLQuery(uid2);
if(ip) FreeSQLQuery(ip);
}
catch(e)
return false;
}
function GetTok( string, separator, n, ... )
{
local m = ( vargv.len() > 0 ) ? vargv[ 0 ] : n, tokenized = split( string, separator ), text = "";
if ( ( n > tokenized.len() ) || ( n < 1 ) ) return null;
for ( ; n <= m; n++ )
{
text += text == "" ? tokenized[ n - 1 ] : separator + tokenized[ n - 1 ];
}
return text;
}
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
function GetPlayer( target )
{
local target1 = target.tostring();
if ( IsNum( target ) )
{
target = target.tointeger();
if ( FindPlayer( target) ) return FindPlayer( target );
else return null;
}
else if ( FindPlayer( target ) ) return FindPlayer( target );
else return null;
}
[/noae]