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 - Mohamed Boubekri
1
Script Showroom / [Project] Full Start GUI (STILL WORKING ON IT)
« on April 19th, 08:11 PM »
Salam Alaikum all, I am now going to present to you The Future of VCMP
Well, A Moroccan player is trying his best to offer you the best account system [GUI]
I'll give you some pictures first to understand what I mean:-





Okey, After you saw this VIDEO, I am sure that you will understand me all


Here is the video.

Well, now let's talk about it:- (Credits)

+Disable Multi Clienting. @EnForcer (When you in the server, You can't enter again)
+Players Names Conditions. @[R3V]Kelvin (Character area)
+Some help about sqlite & client-side. @AroliS^
+Nearby chat for RP. @Sonmez
+Bank Server. @Sebastian
+GUI editor. @Anik (Panel & bouttons & memo measure)
+Country Detector. @MatheuS (Original one by Nexus)
+Client Timers. @ysc3839
See the video for more details.

I Tried my best not to leave any error:- (see the console below)


How its work ?
When you joined the server its give you random names
And when you logged in, the server write your username & password in database
And when you create your character, the server write your character name in database
That is, and also there is LASTSKIN & LASTPOS system by me (see the video)


Because I will left the vcmp community, So this one now is yours feel free to edit it

https://www.mediafire.com/file/3uxtt7wp11n3fu5/.My_Server.rar/file

Remember the video is at the top.

Ramadan kareem to all muslims & arab.
2
Scripting and Server Management / Same UID for players
« on March 26th, 03:37 PM »
I have made this function:-
Code: [Select]
function Check(player)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local plr = FindPlayer(i);
if (plr.UID == player.UID )
{
MessagePlayer("Ok we kicking you out.",plr); //rani hna w last pos nzid nriglha
}
}
}
The function is not working, When i enter the server he is kick me out
The idea is, if the player was in server he is can't enter again, The server will catch him UID and kick him out.
3
I have a function in client side that like a condition:-
Code: [Select]
if (after.edit.Text.len() > 0)

if (after.edit.Text.len() < 19)
As you see these condition, now the idea is i want to add a new condition that Meaning, the name must contain a symbol
I have take a function from mta sa forum just to you understand what i meaning:-
Code: [Select]
characterName = string.gsub(tostring(characterName), " ", "_")
As i said before, i want to add a new condition that Meaning, the name must contain a symbol, and the symbole must be _ like in previous code, i want the name like John_smith, Mohamed_L'oujdi, i want if the player not typing the symbole return false.
4
Please see the script to understand me :-
Code: [Select]
function onClientScriptData( player )
{
local int = Stream.ReadInt( ),
string = Stream.ReadString ( );
switch( int.tointeger() )
{
case 74: ////login////

local str2 = Stream.ReadString ( ); ///this password
local q = QuerySQL(Database, "SELECT * FROM Accounts WHERE Username = '"+string+"'"); //i think here is the problem

MessagePlayer("Here what is in data: "+q,player); // the message its appears but what is inserted its appears null
                                             // so when its appears null then can't give right username
// Yep i've check data there is user name with name: MohamedBk
// But when insert my username its show as null
if (!q)
{
if (stats[player.ID].Password == SHA256(str2))
{
MessagePlayer("[#ffff00]Successfully Logged in. Welcome", player);
stats[player.ID].Log = true;
stats[player.ID].UID = player.UID;
stats[player.ID].IP = player.IP;
}
else Stream.StartWrite( ); Stream.WriteInt( 8 ); Stream.SendStream( player );
}
else Stream.StartWrite( ); Stream.WriteInt( 9 ); Stream.SendStream( player );
break;
}
}
We'll, see the image to understand what i meaning:-

And yea, i'm sure 'MohamedBk' is in the data.
In the normal state, MohamedBk need to appears in the message instead null value.
MohamedBk = The name that I registered with, as well as the name in the database (Which should appear in the message)
5
Scripting and Server Management / How to use two case
« on March 22nd, 07:32 PM »
I'm trying to sent two case see it below:-
Code: [Select]
function GUI::ElementRelease(element, mouseX, mouseY)
{
switch (element)
{
case regiscom.regbut: //register boutton///
GUI.InputReturn(regiscom.user); //when player click register boutton he need to fill editbox first//
GUI.InputReturn(regiscom.pas); //but as you see here three edit box: user, pasword, repassword//
GUI.InputReturn(regiscom.repas); // actually i don't know if i have a problem here or no
}
}
Ok now see the function inputreturn below:-
Code: [Select]
function GUI::InputReturn(editbox)
{
switch(editbox)
{
case regiscom.user: case regiscom.pas: case regiscom.repas: //well as you see here, please if i have a problem tell me

if (regiscom.user.Text.len() > 0)
{
if (regiscom.pas.Text.len() > 0)
{
if (regiscom.repas.Text.len() > 0)
{
if (regiscom.pas.Text == regiscom.repas.Text)
{
SendDataToServertwo( regiscom.user.Text, regiscom.pas.Text, 70 ); //ok when the conditions met its send data to serv
}                                                               //but still i have a problem i'll tell you
else hihihihi(6);
}
else hihihihi(5);
}
else hihihihi(4);
}
else hihihihi(3);
}
}
Well, know see server side func below:-
Code: [Select]
function onClientScriptData( player )
{
local int = Stream.ReadInt( ),
string = Stream.ReadString ( );
switch( int.tointeger() )
{
case 70:
local str2 = Stream.ReadString ( ); ///pasword///
local q = QuerySQL(Database, "SELECT * FROM Accounts WHERE Username = '" + string + "'");
if (!q)
{
MessagePlayer("Ok your user: "+string+" and you pass: "+str,player);  //the message its show and work great, but its send two time

// ok know i'll tell you my problem
// when the two message show its show two time

QuerySQL(Database, "INSERT INTO Accounts ( Username, Password , Admin, Cash, Bank, LastPosX, LastPosY, LastPosZ, LastPos, IP, UID, UID2 ) VALUES ( '" + string + "', '" + SHA256(str2) + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + player.IP + "', '" + player.UniqueID + "', '" + player.UniqueID2 + "' )");
MessagePlayer("[#ffff00]Successfully Registered.", player);
MessagePlayer("[#ffff00]Don't forget your password [#CC6666]" + str2, player);
stats[player.ID].Password = SHA256(str2);
stats[player.ID].Admin = 0;
stats[player.ID].UID = player.UniqueID;
stats[player.ID].UID2 = player.UniqueID2;
stats[player.ID].IP = player.IP;
stats[player.ID].Reg = true;
stats[player.ID].Log = true;
}
else Stream.StartWrite( ); Stream.WriteInt( 11 ); Stream.SendStream( player );
break;
}
}
Like i tell you, its send two time, See the picture to understand me:-

Actually the message is only not repeated twice, but three ???
I want the message to repeated Once.
6
Code: [Select]
SendDataToServertext(com.we32.Text, 15) // its send only one string
// but me i want two string one for username & one for password
// here is my function below

function SendDataToServertext(str, int)
{
    local message = Stream();
    message.WriteInt(int.tointeger());
    message.WriteString(str);
    Server.SendData(message);
}
As you saw above, How i can send two string like:- SendDataToServertext(one.Text,two.Text, 15).
7
Scripting and Server Management / How to hide the message
« on March 19th, 08:40 PM »
Need help about deleting that thing
8
I want to show an image for full screen how ?
Code: [Select]
sprite_logo = GUISprite( "image.png", VectorScreen( sX * 0.2375, sY * 0.26 ) );
sprite_logo.Size = VectorScreen(200,200);
sprite_logo.Alpha = 255;
9
Videos & Screenshots / ViceEvil Screenshots
« on April 28th, 2018, 07:15 PM »
Hello, I have make some photo and one video to show you my server.
Server aren't hosted yet, because here are no one sharing for free :P
Anyway Enjoy ;D


ViceEvil




10
Scripting and Server Management / Pickup.Remove() Problem
« on April 15th, 2018, 03:42 PM »
Hello, I know pickup.Remove() its working but, when i do it for my server say me error index "Remove" lol :'(
i'm using rel004 with latest update.
Anyway how to fix the chit?
Code: [Select]
FindPickup( text.tointeger() ).Remove();
11
Scripting and Server Management / Question About Time
« on April 13th, 2018, 11:11 AM »
Hello, i'm creating a server with matches & rounds example blue vs red
anyway, i want the functions: start time, show time left
example i need just a idea, i want show for client side start time, example when matche started then time to will started
so can anybody give me the function start time or count time

also i need time left example /timeleft (show the time left after start a one match)
Thanks!
12
General Discussion / Suicide Panel v1.0
« on April 10th, 2018, 09:40 AM »
Hello, i know my self i learned main side as complete, but client side its hard from my way
but i try to learn it as possible. i have disabled /kill cmd and i added /suicide instead
its just sample panel ;D
The Panel How its Look:-


Click Me.
13
Snippet Showroom / Command To Test An Anim
« on April 9th, 2018, 11:09 AM »
Hi, i Made Just a Sample Command To Test Anim, To work of thi Use /animstest <ID> <ID>
Example: /animstest 0 0
Code: [Select]
if ( cmd == "animstest" || cmd == "testanims")
{
if(!text) MessagePlayer("[ANIM TEST] /"+cmd+" <ID> <ID>", player );
else {
local anim = GetTok( text, " ", 1);
if ( !anim ) MessagePlayer("Make a ID For Anim 1 First..",player);
else if (!IsNum(anim)) MessagePlayer("ID's Must Be In Numbers..",player);
else {
local anim1 = GetTok( text, " ", 1);
if ( !anim1 ) MessagePlayer("Make a ID For Anim 2 First..",player);
else if (!IsNum(anim1)) MessagePlayer("ID's Must Be In Numbers..",player);
else {
player.SetAnim(anim.tointeger(),anim1.tointeger());
}
}
}
}

Don't Forget The Two Functions:-
Code: [Select]
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();
 }
14
Script Showroom / Mohamed's Account System
« on February 15th, 2018, 06:13 PM »
Hello, Here Are Sample Account System, I Have Made it, so i love Share it with All!
First Of All, Add it On Your Server.cfg
Code: [Select]
plugins sqlite04rel32 squirrel04rel32 announce04rel32 hashing04rel32 xmlconf04rel32
Then Add it On Your Main.nut
Code: [Select]
// =========================================== S E R V E R   E V E N T S ==============================================

class PlayerClass
{
 Password = null;
 Level = 0;
 Kills = 0;
 Deaths = 0;
 Cash = 0;
 Bank = 0;
 IP = null;
 AutoLogin = false;
 Log = false;
 Reg = false;
}

function onServerStart()
{
}

function onServerStop()
{
}

function onScriptLoad()
{
 SetPassword("");
 SetJoinMessages(true);
 SetServerName( "[0.4] Mohamed's Account System v1.0")
 DataBase <- ConnectSQL("DataBase.db");
 QuerySQL(DataBase, "create table if not exists Accounts ( Name TEXT, LowerName TEXT, Password VARCHAR(255), Level NUMERIC DEFAULT 1, Kills NUMERIC DEFAULT 0, Deaths NUMERIC DEFAULT 0, Cash NUMERIC DEFAULT 0, Bank NUMERIC DEFAULT 0, TimeRegistered VARCHAR(255) DEFAULT CURRENT_TIMESTAMP, IP VARCHAR(255), AutoLogin BOOLEAN DEFAULT true ) ");
 stats <- array(GetMaxPlayers(), null);
 print("Successfully Loaded Mohamed's Registration System.");
}

function onScriptUnload()
{
DisconnectSQL( DataBase );
}

// =========================================== P L A Y E R   E V E N T S ==============================================

function onPlayerJoin( player )
{
Message("[#00CC00]** [#ffffff]"+player.Name+" [#00cc00]Has Joined The Server");
stats[ player.ID ] = PlayerClass();
GetInfo(player);
}

function onPlayerPart( player, reason )
{
if (stats[ player.ID ].Log) SaveStats(player);
}
function onPlayerRequestClass( player, classID, team, skin )
{
return 1;
}

function onPlayerRequestSpawn( player )
{
return 1;
}

function onPlayerSpawn( player )
{
}
function GetStats( player )
{
local q = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
local kills = stats[ player.ID ].Kills, deaths = stats[ player.ID ].Deaths, ratio;
if ( kills >= 1 && deaths >= 1 ) ratio = format( "%.2f", kills.tofloat() / deaths.tofloat() );
else ratio = 0;
Message("[#00CC00]** Status [#ffffff]" + player.Name + " [#00CC00]Kills:[#FFFFFF] " + kills + "[#00CC00] | Death:[#ffffff] " + deaths + "[#00CC00] | Ratio:[#ffffff] " + ratio + "");
Message( "[#00CC00]** Status [#ffffff]" + player.Name + " [#00CC00]TimeRegistered: [#ffffff]" + GetSQLColumnData(q, 8) +  "");
}
function IncCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local add = cash + amount;
stats[ player.ID ].Cash = add;
player.Cash = add;
}
function DecCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local det = cash - amount;
stats[ player.ID ].Cash = det;
player.Cash = det;
}
function IncKills( player, amount )
{
local kills = stats[ player.ID ].Kills;
local add = kills + amount;
stats[ player.ID ].Kills = add;
}

function IncKilleds( player, amount )
{
local killeds = stats[ player.ID ].Killeds;
local add = killeds + amount;
stats[ player.ID ].Killeds = add;
}

function IncDeaths( player, amount )
{
local deaths = stats[ player.ID ].Deaths;
local add = deaths + amount;
stats[ player.ID ].Deaths = add;
}
function DecBank( player, amount )
{
local bank = stats[ player.ID ].Bank;
local det = bank - amount;
stats[ player.ID ].Bank = det;
}
function IncBank(player,amount)
{
local bank = stats[ player.ID ].Bank;
local add = bank + amount;
stats[ player.ID ].Bank = add;
}
function onPlayerDeath( player, reason )
{
DecCash( player, 100 );
Announce("Wasted",player,5);

if ( stats[ player.ID ].Level >= 0 )
{
stats[ player.ID ].Deaths ++;
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
}
function onPlayerKill( killer, player, reason, bodypart )
{
killer.Score ++;
if ( killer.Health <= 80 ) killer.Health += 20;
if ( reason == 6 ) player.Health = 100;
if ( stats[ killer.ID ].Level >= 1 && stats[ player.ID ].Level == 0 )
{
stats[ killer.ID ].Kills ++;
IncCash( killer, 15000 );
}
if ( stats[ killer.ID ].Level == 0 && stats[ player.ID ].Level >= 0 )
{
stats[ player.ID ].Deaths ++;
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
if ( stats[ killer.ID ].Level >= 1 && stats[ player.ID ].Level >= 0 )
{
stats[ killer.ID ].Kills ++;
stats[ player.ID ].Deaths ++;
IncCash( killer, 15000 );
if ( stats[ player.ID ].Cash >= 250 ) DecCash( player, 250 );
}
}
function onPlayerTeamKill( player, killer, reason, bodypart )
{
}

function onPlayerChat( player, text )
{
return 1;
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "cmds" || cmd == "command"|| cmd == "commands")
{
  MessagePlayer("[#00CC00]** /register, /login, /logout, /changepass" , player);
  MessagePlayer("[#00CC00]** /stats" , player);
  }
 else if (cmd == "credits")
 {
  MessagePlayer("[#00CC00]** Scripter By [#ffffff][AFt]We3da^" , player);
  MessagePlayer("[#00CC00]** Account System: [#ffffff][AFt]We3da^" , player);
  }

else if(cmd == "exec")
{
if ( stats[ player.ID ].Level < 10 ) MessagePlayer("[ERROR][#ffffff] Un Authorized Acces",player);
else if( !text ) MessagePlayer( "[#00CC00]** Syntax, /exec <Squirrel code>", player);
else
{
try
{
local script = compilestring( text );
script();
}
catch(e) MessagePlayer( "Error: " + e, player);
}
return 1;
}
else if ( cmd == "stats" )
{
if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[#00CC00]** You're Not Registered.", player );
else if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[#00CC00]** You're Not Logged-In.", player );
else if ( !text ) GetStats( player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[#00CC00]** Unknow Player.", player );
else if ( stats[ plr.ID ].Reg == false ) return MessagePlayer( "[#00CC00]** The Player Are Not Registered.", player );
else if ( stats[ plr.ID ].Log == false ) return MessagePlayer( "[#00CC00]** The Player Are Not logged-In.", player );
else if ( plr.ID == player.ID ) GetStats( player );
else GetStats( plr );
}
}
 else if (cmd == "changepass")
 {
 if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[ERROR][#ffffff] You're Not Logged-In.", player );
 else if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[ERROR][#ffffff] You're Not Registered.", player );
 else if ( !text ) MessagePlayer("[#00CC00]** Syntax, /changepass <NewPass>",player);
 else {
 local password = SHA256(text);
 QuerySQL(DataBase, "UPDATE Accounts SET Password = '" + password + "' WHERE Name = '" + escapeSQLString(player.Name) + "'");
 MessagePlayer("[#00CC00]** Successfully Changed Password To [#ffffff]"+text+" [#00CC00]Don't Forget It",player);
 }
 }
 else if (cmd == "logout")
 {
 if ( !player.IsSpawned ) MessagePlayer("[ERROR][#ffffff] You Must Be Spawn First",player);
 else {
  QuerySQL(DataBase, "UPDATE Accounts SET AutoLogin = '" + false + "' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#00CC00]** Successfully Logout",player);
  stats[ player.ID ].AutoLogin = false;
  stats[ player.ID ].Log = false;
  player.Health = 0;
  }
  }
 else if (cmd == "register")
 {
  if ( stats[ player.ID ].Log == true ) return MessagePlayer( "[#00CC00]** You're already logged in & registered.", player );
  else if ( stats[ player.ID ].Reg == true ) return MessagePlayer( "[#00CC00]** You're already register.", player );
  else if ( !text ) MessagePlayer("[#00CC00]** Syntax, /register [password]",player);
  else
  {
  local now = date();
  local password = SHA256(text);
  QuerySQL( DataBase, "INSERT INTO Accounts ( Name, LowerName, Password, Level, Kills, Deaths, Cash, Bank, TimeRegistered, IP, AutoLogin ) VALUES ( '" + escapeSQLString(player.Name) + "','" + escapeSQLString(player.Name) + "','" + password + "', '" + 1 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '"+ now.year +"/"+now.month+"/"+now.day+"/"+now.hour+":"+ now.min + "', '" + player.IP + "', '" + true + "' )" );
  MessagePlayer("[#00CC00]** Successfully Registered, Password: [#ffffff]"+text+"",player);
  player.Cash = stats[ player.ID ].Cash;
  stats[ player.ID ].Reg = true;
  stats[ player.ID ].Log = true;
  stats[ player.ID ].Level = 1;
  stats[ player.ID ].Kills = 0;
  stats[ player.ID ].Deaths = 0;
  stats[ player.ID ].Cash = 0;
  stats[ player.ID ].Bank = 0;
  stats[ player.ID ].IP = player.IP;
  stats[ player.ID ].AutoLogin = true;
 }
 }
 else if (cmd == "login")
 {
   if ( stats[ player.ID ].Log == true ) return MessagePlayer( "[ERROR][#ffffff] You're already logged in", player );
   if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[ERROR][#ffffff] You're not register.", player );
   if ( !text ) return MessagePlayer( "[#00CC00]** Syntax, /login [password]", player );
   if ( SHA256(text) != GetPass( player ) ) return MessagePlayer( "[#00CC00]** Invalid Password", player );

   player.Cash = stats[ player.ID ].Cash;
   stats[ player.ID ].Log = true;
   stats[ player.ID ].Reg = true;
   MessagePlayer("[#00CC00]** You Have Logged-In Successfully.",player);
   QuerySQL(DataBase, "UPDATE Accounts SET AutoLogin = '" + true + "' WHERE Name = '" + player.Name + "'");
   stats[ player.ID ].AutoLogin = true;
   stats[ player.ID ].IP = player.IP;
 return;
   }
 
 
 else MessagePlayer("[#00CC00]** Unknow Command Use [#ffffff]/cmds [#00CC00]For Command Server",player);
}
function onPlayerPM( player, playerTo, message )
{
return 1;
}

function onPlayerBeginTyping( player )
{
}

function onPlayerRequestSpawn(player)
{
 if (!stats[ player.ID ].Reg) MessagePlayer("[#00CC00]** Please Register First.", player);
 else if (!stats[ player.ID ].Log) MessagePlayer("[#00CC00]** Please Login First.", player);
 else return 1;
}

function onPlayerEndTyping( player )
{
}

/*
function onLoginAttempt( player )
{
return 1;
}
*/

function onNameChangeable( player )
{
}

function onPlayerSpectate( player, target )
{
}

function onPlayerCrashDump( player, crash )
{
}

function onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
{
}

function onPlayerHealthChange( player, lastHP, newHP )
{
}

function onPlayerArmourChange( player, lastArmour, newArmour )
{
}

function onPlayerWeaponChange( player, oldWep, newWep )
{
}

function onPlayerAwayChange( player, status )
{
}

function onPlayerNameChange( player, oldName, newName )
{
}

function onPlayerActionChange( player, oldAction, newAction )
{
}

function onPlayerStateChange( player, oldState, newState )
{
}

function onPlayerOnFireChange( player, IsOnFireNow )
{
}

function onPlayerCrouchChange( player, IsCrouchingNow )
{
}

function onPlayerGameKeysChange( player, oldKeys, newKeys )
{
}

// ========================================== V E H I C L E   E V E N T S =============================================

function onPlayerEnteringVehicle( player, vehicle, door )
{
return 1;
}

function onPlayerEnterVehicle( player, vehicle, door )
{
}

function onPlayerExitVehicle( player, vehicle )
{
}

function onVehicleExplode( vehicle )
{
}

function onVehicleRespawn( vehicle )
{
}

function onVehicleHealthChange( vehicle, oldHP, newHP )
{
}

function onVehicleMove( vehicle, lastX, lastY, lastZ, newX, newY, newZ )
{
}

// =========================================== P I C K U P   E V E N T S ==============================================

function onPickupClaimPicked( player, pickup )
{
return 1;
}

function onPickupPickedUp( player, pickup )
{
}

function onPickupRespawn( pickup )
{
}

// ========================================== O B J E C T   E V E N T S ==============================================

function onObjectShot( object, player, weapon )
{
}

function onObjectBump( object, player )
{
}

// =========================================== B I N D   E V E N T S ==============================================

function onKeyDown( player, key )
{
}

function onKeyUp( player, key )
{
}
function GetInfo(player)
{
 local q = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
 if (q)
 {
  stats[ player.ID ].Password = GetSQLColumnData(q, 2);
  stats[ player.ID ].Level = GetSQLColumnData(q, 3);
  stats[ player.ID ].Kills = GetSQLColumnData(q, 4);
  stats[ player.ID ].Deaths = GetSQLColumnData(q, 5);
  stats[ player.ID ].Cash = GetSQLColumnData(q, 6);
  stats[ player.ID ].Bank = GetSQLColumnData(q, 7);
  stats[ player.ID ].IP = GetSQLColumnData(q, 9);
  stats[ player.ID ].AutoLogin = GetSQLColumnData(q, 10);
  stats[ player.ID ].Reg = true;
  if (player.IP == stats[ player.ID ].IP)
  {
   if (stats[ player.ID ].AutoLogin == "true")
   {
    MessagePlayer("[#00CC00]** Welcome back To The Server", player);
    MessagePlayer("[#00CC00]** [#ffffff]"+player.Name+" [#00CC00]Auto Logged-In", player);
    player.Cash = stats[ player.ID ].Cash;
    stats[ player.ID ].Log = true;
   }
   else
   {
    MessagePlayer("[#00CC00]** Welcome back To The Server", player);
    MessagePlayer("[#00CC00]** You're Already Registered, Please Use [#ffffff]/Login [#00CC00]To Acces.", player);
   }
  }
  else
  {
   MessagePlayer("[#00CC00]** Welcome back To The Server", player);
   MessagePlayer("[#00CC00]** You're Already Registered, Please Use [#ffffff]/Login [#00CC00]To Acces.", player);
  }
 }
 else
 {
  MessagePlayer("[#00CC00]** Welcome back To The Server", player);
  MessagePlayer("[#00CC00]** Your Name Are Not In DataBase, Please Use [#ffffff]/Register [#00CC00]To Add Your Nick To DataBase.", player);
 }
 FreeSQLQuery(q);
}

function SaveStats(player)
{
QuerySQL( DataBase, "UPDATE Accounts SET Level='"+stats[ player.ID ].Level+"',IP='"+stats[ player.ID ].IP+"',Kills='"+stats[ player.ID ].Kills+"',Deaths='"+stats[ player.ID ].Deaths+"',Cash='"+stats[ player.ID ].Cash+"',Bank='"+stats[ player.ID ].Bank+"',AutoLogin='"+stats[ player.ID ].AutoLogin+"' WHERE Name LIKE '" + player.Name + "'" );
}
function GetPass( player )
 {
 local result = GetSQLColumnData( QuerySQL( DataBase, "SELECT Password FROM Accounts WHERE Name='"+player.Name+"'" ), 0 );
 if ( result ) return result;
 else return 0;
 }
 
function rotateRight(val, sbits)
 {
 return (val >> sbits) | (val << (0x20 - sbits));
 }
 
function e( string )
 {
 local hp =
   [
   0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
   0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
   ];

 local k =
   [
   0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
   0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
   0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
   0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
   0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
   0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
   0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
   0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
   ];

 local
   w   = array( 64 ),
   i   = 0,
   s   = 0,
   len = string.len( ),
   word_array = array( 0 );

 for( i = 0; i < len - 3; i += 4 )
  {
  word_array.push( string[i] << 0x18 | string[i + 1] << 0x10 | string[i + 2] << 0x08 | string[i + 3] );
  }

 switch( len % 4 )
  {
   case 0:
    i = 0x80000000;
    break;
   case 1:
    i = string[len - 1] << 0x18 | 0x80000000;
    break;
   case 2:
    i = string[len - 2] << 0x18 | string[len - 1] << 0x10 | 0x08000;
    break;
   case 3:
    i = string[len - 3] << 0x18 | string[len - 2] << 0x10 | string[len - 1] << 0x08 | 0x80;
    break;
  }
 word_array.push( i );

 while( ( word_array.len() % 0x10 ) != 0x0E )
   word_array.push( 0 );
   
 word_array.push( len >> 0x10 );
 word_array.push( ( len << 0x03 ) & 0xFFFFFFFF );

 local s0, s1;
 for( s = 0; s < word_array.len(); s += 0x10 )
   {
   for( i = 0x00; i < 0x10; i++ )
    w[i] = word_array[s + i];

   for( i = 0x10; i < 0x40; i++ )
    {
    s0 = rotateRight( w[i - 15], 7 ) ^ rotateRight( w[i - 15], 18 ) ^ ( w[i - 15] >> 3 );
    s1 = rotateRight( w[i - 2], 17 ) ^ rotateRight( w[i - 2], 19 ) ^ ( w[i - 2] >> 10 );
    w[i] = w[i - 0x10] + s0 + w[i - 7] + s1;
     }

   local a = hp[0],
    b = hp[1],
    c = hp[2],
    d = hp[3],
    e = hp[4],
    f = hp[5],
    g = hp[6],
    h = hp[7];

   for( i = 0x00; i < 0x40; i++ )
   {
    s0 = ( rotateRight( a, 2 ) ^ rotateRight( a, 13 ) ^ rotateRight( a, 22 ) );
    local maj = ( ( a & b ) ^ ( a & c ) ^ ( b & c ) );
    local t2  = ( s0 + maj );
    s1 = ( rotateRight( e, 6 ) ^ rotateRight( e, 11) ^ rotateRight( e, 25 ) );
    local ch  = ( ( e & f ) ^ ( ( ~e ) & g ) );
    local t1  = ( h + s1 + ch + k[i] + w[i] );

    h = g;
    g = f;
    f = e;
    e = d + t1;
    d = c;
    c = b;
    b = a;
    a = t1 + t2;
   }

   hp[0] += a;
   hp[1] += b;
   hp[2] += c;
   hp[3] += d;
   hp[4] += e;
   hp[5] += f;
   hp[6] += g;
   hp[7] += h;
  }

 local hash = format
   (
   "%08x%08x%08x%08x%08x%08x%08x%08x",
   hp[0],
   hp[1],
   hp[2],
   hp[3],
   hp[4],
   hp[5],
   hp[6],
   hp[7]
   );

 return hash;
 }

// ================================== E N D   OF   O F F I C I A L   E V E N T S ======================================
Good Luck Scripting
15
Snippet Showroom / [SNIPPET] Warning System
« on February 1st, 2018, 12:34 PM »
Hello, I Have Made Warning System, So i Love Share it With All! ;D
First Of All Add it In Your ( OnScriptLoad )
Code: [Select]
warn <- ConnectSQL("scripts/warn.db");
QuerySQL(warn, "create table if not exists warn ( Name VARCHAR(32), Reason TEXT, Admin TEXT, Day VARCHAR(25), Month VARCHAR(25), Year VARCHAR(25), Hour VARCHAR(25), Min VARCHAR(25) )");
Now Add it In Your ( Command )
Code: [Select]
else if ( cmd == "warn" )
{
if(!text) MessagePlayer("/warn <Player> <Reason>",player);
// else if Your Admin System
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "Error: Unknow Player.", player );
{
local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
if ( !reason ) MessagePlayer( "Error: Make Reason.", player );
else if ( plr.Name==player.Name ) MessagePlayer( "Error: You Can't Warn yourself.", player );
else {
local now = date();
QuerySQL( warn, "INSERT INTO warn ( Name, Reason, Admin, Day, Month, Year, Hour, Min ) VALUES ( '" + plr.Name + "', '" + reason + "', '" + player.Name + "', '" + now.day + "', '" + now.month + "', '" + now.year + "', '" + now.hour + "', '" + now.min + "' )" );
Message("Admin "+ player.Name +" Has Warned " +plr.Name+ " Reason: " +reason+ "");
}
}
}
}
else if ( cmd == "unwarn" )
{
local q = QuerySQL( warn,  "SELECT * FROM warn WHERE Name='" + text + "'" );
if(!text) MessagePlayer("/unwarn <Full-Nick>",player);
// else if Your Admin System
else if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "Error: " + text + " is not Warned.", player );
else {
QuerySQL( warn, "DELETE FROM warn WHERE Name='" + text + "'" );
Message("Admin "+ player.Name +" Has Unwarned " +text+ "");
}
}
else if ( cmd == "checkwarn" )
{
if(!text) MessagePlayer("/checkwarn <Full-Nick>",player);
// else if Your Admin System
else {
local q = QuerySQL( warn,  "SELECT * FROM warn WHERE Name='" + text + "'" );
if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "Error: " + text + " is not Warned.", player );
else
{
MessagePlayer( "Player Name Found!", player );
MessagePlayer( "Player : " + text, player );
MessagePlayer( "Warned by : " + GetSQLColumnData( q, 2 ), player );
MessagePlayer( "Reason : " + GetSQLColumnData( q, 1 ), player );
MessagePlayer( "Time Warned: Day: " + GetSQLColumnData( q, 3 ) + " Month: " + GetSQLColumnData( q, 6 ) + " Year: " + GetSQLColumnData( q, 5 ) + " Hour: " + GetSQLColumnData( q, 6 ) + " Min: " + GetSQLColumnData( q, 7 ) + "", player );
}
}
}
NOTE: Command is: /warn, /unwarn, /checkwarn.
NOTE: The System its Sample :D
NOTE: If You See Any Error, Please Report it Here.
NOTE: its Not Copie or Something, its Made By Me, Good Luck ;D