Menu

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.

Show posts Menu

Messages - Gito Baloch

#1
Quote from: habi2 on Aug 17, 2024, 04:43 PMnice work, nice idea and good pictures.

and 'where you going?'
Thanks habi and I'm just leaving the game (: I can't state the reason why...

Quote from: PSL on Aug 18, 2024, 07:11 AMThis is a really good script, thank you for making and sharing it
Thank you ☺️
#2
World System

Hello everyone!

On the request of a very special friend, I developed this World System in Squirrel for one last time. You can find the code on Gitto's World System.

Important Note: World 1 cannot be bought or mapped; it's the main world.

World System Commands:

  • /gotoworld: <world_id> - Teleports you to the specified world by its ID (1-1000).
  • /buyworld: <world_id> - Purchases the specified world by its ID.
  • /sellworld: <world_id> - Sells the specified world by its ID.
  • /shareworld: <player_id> - Shares the world with the specified player.
  • /delshareworld: <player_id> - Removes sharing permissions for the specified world (1-1000).
  • /myworlds: - Lists all the worlds you own.
  • /sharedworlds: - Lists all the worlds shared with you.
  • /world: <world_id> - Displays information about the specified world (1-1000).
  • /addobject: <world_id> - Adds an object to the specified world.
  • /objects: <world_id> - Lists all objects in the current world.
  • /setworldname: <world_id> <name> - Sets the name of the specified world (1-1000).



Credits: Doomkiller for his map editor.

As I step away from VCMP, I'm leaving behind a part of my heart with the incredible memories made in Viceland and VFS with my CF and R2X family. 'Every goodbye brings us closer to a new hello,' but this one feels especially hard. I'll miss you all more than words can express.

Regards,
Yours truly,
gito aka Sibghat al Baloshi
#3
good work, thanks
#4
Script Showroom / Gitto's Clan System.
May 27, 2023, 11:50 AM
Hello everyone! I've been learning about loops, variables, and arrays, and as a practice exercise, I've developed a Clan System. I've uploaded the code on GitHub, and you can access it using the following link: Gitto's ClanSystem

To get started, please follow the instructions provided in the 'essentials.nut' file. By following those instructions, the code should function correctly.

Here's a list of commands available for Clan Members:

  • /createclan: Create a new clan.
  • /accept: Accept an invitation to join a clan.
  • /clanchat (or /cc): Chat with other clan members.
  • /leaveclan: Leave your current clan.
  • /clans: View a list of all clans.
  • /clan: View information about your current clan.
  • /clanmembers: View a list of members in your clan.
  • /ranks: View the ranks available in your clan.
  • /request: Send a request to join a clan.

For Clan Owners, additional commands are available:
  • /invite: Invite a player to join your clan.
  • /kick: Remove a member from your clan.
  • /giveclancash: Give clan cash to a member.
  • /setdefrank: Set the default rank for new clan members.
  • /addrank: Add a new rank to your clan.
  • /delrank: Delete an existing rank from your clan.
  • /setrank: Set a member's rank in the clan.
  • /transferownership: Transfer ownership of the clan to another member.
  • /setting: Adjust various settings for your clan. (teamID, skinID, enable/disable Tags)
  • /acceptrequest: Accept pending join requests.
  • /deleteclan (or /delclan): Delete your clan.


--> If you encounter any bugs or have any questions, feel free to reach out to me on Discord. I'm usually online and active.


Here are some screenshots of the Clan System in action.






#5
Quote from: Sandisk on May 19, 2023, 10:58 PMthe reject cmd gives errors i think it must be as this:

else if ( cmd == "reject")
{
 if( stats[player.ID].Partner == "" ) return MessagePlayer("You haven't recieved any team-up request yet.",player);
 local plr = FindPlayer(stats[player.ID].Partner);

            MessagePlayer(""+rpmsg+"-> You rejected [#" + format("%02X%02X%02X", plr.Color.r, plr.Color.g, plr.Color.b) + "]"+plr.Name+""+rpmsg+"'s team-up request.",player);
            MessagePlayer(""+rpmsg+"-> [#" + format("%02X%02X%02X", plr.Color.r, plr.Color.g, plr.Color.b) + "]"+player.Name+" "+rpmsg+"rejected your team-up request. ",plr);
  stats[player.ID].Partner = "";
  stats[player.ID].Requested = false;
}


I didn't add reject command in the updated version. Because there's a timer when someone sends you request and you ignore it, the invitation will be expired in just 30 seconds.
#6
Change this

BankDoorIn <- CreatePickup( 382, 1, 1, Vector( -899.141, -341.11, 13.3802 ), 255, false );
 BankDoorOut <- CreatePickup( 382, 1, 1, Vector( -895.855, -341.11, 13.3846 ), 255, false );

to this
BankDoorIn <- CreatePickup( 382, 0, 1, Vector( -899.141, -341.11, 13.3802 ), 255, false );
 BankDoorOut <- CreatePickup( 382, 0, 1, Vector( -895.855, -341.11, 13.3846 ), 255, false );

Check if it works  :-X
#7
I received a complaint about my previous code having numerous bugs. Therefore, I have made several changes to enhance its readability and ensure it is error-free.

Here's the updated code:

https://github.com/sibghatcodez/-VCMP-BankRobbery/blob/main/bankRobbery.nut



Add this in your class

Team = false;
 Partner = "";
 Requested = false;

 AtAmmu = false;
 BombBought = false;
 InsideLocker = false;



Add this in onScriptLoad


insideBank <- CreateCheckpoint(null, 0, true, Vector(-937.568, -351.482, 17.8038), ARGB(255,255,255,255),2)// Banklocker entrance.
outsideBank <- CreateCheckpoint(null, 0, true, Vector(-939.012, -351.882, 7.22692), ARGB(255,255,255,255),2)// Banklocker exit.
bankBomb <- CreateCheckpoint(null, 0, true, Vector(-676.604, 1206.94, 11.1082), ARGB(255,255,16,0),1)// Bank bomb.
bankPickup <- CreatePickup( 410, 1, 0, Vector(-948.597, -344.569, 7.22694), 255, true ); //Bank robbery pickup.


BankRobbed <- true;
BankGettingRobbed <- false;
BankRobTime <- 1800;
BankTime <- 0;


onPlayerCommand Function

function onPlayerCommand( player, cmd, text )
{
  switch(cmd) {

    case "bankrob":
    BankRobTimeLeft(player);
    break;
   
    case "team":
    if(!stats[player.ID].Team) MessagePlayer("-> You're not in any team. Use /teamup.",player);
    else {
      MessagePlayer("You: "+player.Name+" | Teammate: "+stats[player.ID].Partner,player);
    }
    break;

    case "teamup":
    if(!text) MessagePlayer("-> /teamup <Target Player>",player);
    else if(stats[player.ID].Team) MessagePlayer("-> You're already in team with "+stats[player.ID].Partner+". Use /leave.",player);
    else {
    local plr = FindPlayer(text);
    if(!plr) MessagePlayer("-> Target Player is offline.",player);
    else if (plr.ID == player.ID) MessagePlayer("-> You can't teamup with yourself.",player);
    else {
      MessagePlayer(">> Team invitation sent to "+plr.Name,player);
      MessagePlayer(">> Team invitation recieved from "+player.Name,plr);
      MessagePlayer(">> /accept to join his team.",plr);
      stats[plr.ID].Requested = true;
      stats[plr.ID].Partner = player.Name;
      print(plr.Name+"|"+stats[plr.ID].Partner);
      Invitation <- NewTimer("InviteExpired",30000,1,plr.ID);
    }
  }
    break;

    case "accept":
    if(!stats[player.ID].Requested) MessagePlayer("-> You have not recieved any team invitation.",player);
    else {
      local plr = FindPlayer(stats[player.ID].Partner);
      print(stats[player.ID].Partner);
      stats[player.ID].Team = true;
      stats[player.ID].Requested = false;
     
      stats[plr.ID].Team = true;
      stats[plr.ID].Partner = player.Name;

      MessagePlayer(">> You're now in team with "+stats[player.ID].Partner,player);
      MessagePlayer(">> You're now in team with "+player.Name,plr);

      teamedUp <- NewTimer("TeamInfo",1000,0,player.ID,plr.ID);
    }
    break;

  case "tc":
  case "teamchat":
  if(!stats[player.ID].Team) MessagePlayer("-> You are not in any team. /teamup with someone.",player);
  else if(!text) MessagePlayer("/teamchat text",player);
  else {
    local plr = FindPlayer(stats[player.ID].Partner);
    MessagePlayer(player.Name+" said: [#ffffff]"+text+"",player);
    MessagePlayer(player.Name+" said: [#ffffff]"+text+"",plr);
  }
  break;

    case "leave":
  if(!stats[player.ID].Team) MessagePlayer("-> You are not in any team. /teamup with someone.",player);
  else {
    local plr = FindPlayer(stats[player.ID].Partner);
    MessagePlayer(">> You're no longer teaming-up with "+plr.Name,player);
    MessagePlayer(">> "+player.Name+" is no longer teaming-up with you.",plr);

      stats[player.ID].Team = false;
      stats[player.ID].Partner = "";

      stats[plr.ID].Team = false;
      stats[plr.ID].Partner = "";
  }
  break;

  case "buybomb":
  if(!stats[player.ID].Team) MessagePlayer("-> You are not in any team. /teamup with someone.",player);
  else if(!stats[player.ID].AtAmmu) MessagePlayer("-> You must be at ammunation to use this command.",player);
  else if(stats[player.ID].BombBought) MessagePlayer("-> You already have a bomb.",player);
  else {
  stats[player.ID].BombBought = true;
  local plr = FindPlayer(stats[player.ID].Partner);
  MessagePlayer(">> Bomb purchased successfully.",player);
  MessagePlayer(">> Your teammate: "+player.Name+" has bought the bomb.",plr);
  }
  break;

  case "usebomb":
  if(!stats[player.ID].BombBought) MessagePlayer("-> You don't have bomb.",player);
  else if(!stats[player.ID].Team) MessagePlayer("-> You are not in any team. /teamup with someone.",player);
  else if(stats[player.ID].InsideLocker == false) MessagePlayer("-> You must be inside the banklocker.",player);
  else if(BankRobTime > 0) BankRobTimeLeft(player);
  else {
  local plr = FindPlayer(stats[player.ID].Partner);
  stats[player.ID].BombBought = false;
  MessagePlayer(">> You have planted the bomb.",player);
  MessagePlayer(">> It will explode in next 5 seconds.",player);
  MessagePlayer(">> Your teammate: "+player.Name+" has planted the bomb.",plr);
  NewTimer( "LoadDoor", 40000, 1 );
  NewTimer( "DoorExplode", 5000, 1 );
  cta <- CreateObject( 380, 1, Vector( -945.589, -343.758, 7.46694), 255 );
  }
  break;
  }
}



Custom functions

function Random( min, max ) // incase you don't have the random(a,b) function
{
    if ( min < max )
    return rand() % (max - min + 1) + min.tointeger();
    else if ( min > max )
    return rand() % (min - max + 1) + max.tointeger();
    else if ( min == max )
    return min.tointeger();
}

function InviteExpired(plrID){
  local plr = FindPlayer(plrID);
  if(stats[plr.ID].Requested) stats[plr.ID].Requested = false;
  else if (!plr) Invitation.Delete();
}

function TeamCheck(player){
  if(stats[player.ID].Team) {
  local plr = FindPlayer(stats[player.ID].Partner);

    MessagePlayer(">> "+player.Name+" is no longer teaming-up with you.",plr);

    stats[plr.ID].Team = false;
    stats[plr.ID].Partner = "";
  } else return false;
}


function TeamInfo(player,plr){
  local player = FindPlayer(player), plr = FindPlayer(plr);

  if(player && plr && stats[player.ID].Team && stats[plr.ID].Team && !BankGettingRobbed) {
      Announce("Teammate: ~g~"+plr.Name+" ~h~| Distance: ~g~"+DistanceFromPoint( player.Pos.x, player.Pos.y , plr.Pos.x, plr.Pos.y )+"",player,1);
      Announce("Teammate: ~g~"+plr.Name+" ~h~| Distance: ~g~"+DistanceFromPoint( player.Pos.x, player.Pos.y , plr.Pos.x, plr.Pos.y )+"",plr,1);
  } else if (BankGettingRobbed) {
      local plr = FindPlayer(stats[player.ID].Partner);
      Announce("Robbing Bank: ~g~"+BankTime+"",player,1);
      Announce("Robbing Bank: ~g~"+BankTime+"",plr,1);
  }
  else teamedUp.Delete();
}


function DoorExplode() {
  cta.Delete();
  HideMapObject(4578, -945.596, -342.627, 7.58308);
  CreateExplosion( 1, 7, -945.596, -342.627, 7.58308, -1, true );
}
function LoadDoor() {
  CreateObject( 4578, 1, -945.596, -342.627, 7.58308, 255 );
}
function BankRobTimeLeft(player) {
  local time = BankRobTime;
  local mins = floor(time / 60);
  local sec = time % 60;
  return MessagePlayer((BankRobTime > 0) ? ">> Bank can be robbed after: " + mins + " minutes " + sec + " seconds." : ">> The bank can be robbed now.",player);
}
function BankRobbery(player, plr)
{
local player = FindPlayer(player), plr = FindPlayer(plr);

if(BankTime > 0){
    BankTime--;
    player.PlaySound(370);
    plr.PlaySound(370);
    player.IsFrozen = true;
    player.IsFrozen = true;
}
else {
    local cash_1 = Random(30000,40000), cash_2 = Random(30000,40000);
    Message(">> "+player.Name +" has robbed "+(cash_1 + cash_2)+" from International Bank.");

    player.Cash += cash_1; plr.Cash += cash_2,
    player.PlaySound(470); plr.PlaySound(470);
    player.IsFrozen = false; plr.IsFrozen = false;

    BankRobbed = true;
    BankGettingRobbed = false;
    BankRobTime = 1800;
}
}


onTimeChange Function

function onTimeChange(oldHour, oldMin, newHour, newMin) {
  if(BankRobTime > 0) BankRobTime--;
}



CheckPoint Enter and Exit

    function onCheckpointEntered(player, checkpoint )
{
    if (checkpoint.ID == 0) {
        player.Pos = Vector(-934.266, -348.206, 7.22692);
        player.PlaySound(465);
        stats[player.ID].InsideLocker = true;
    }
    if (checkpoint.ID == 1) {
        player.Pos = Vector(-934.265, -351.009, 17.8038);
        player.PlaySound(465);
        stats[player.ID].InsideLocker = false;
    }
    if (checkpoint.ID == 2) {
        player.PlaySound(465);
        player.Immunity = 255;
        stats[player.ID].AtAmmu = true;
    }
}
function onCheckpointExited( player, checkpoint )
{
    if (checkpoint.ID == 2) {
        player.Immunity = 0;
        stats[player.ID].AtAmmu = false;
    }
}



Add this onPickupPickedUp

if( pickup.Model == 410  )
    {
      if(!stats[player.ID].Team) MessagePlayer("-> You are not in any team. /teamup with someone.",player);
      else if (BankGettingRobbed == true) return false;
      else if(BankRobTime > 0) BankRobTimeLeft(player);
      else {
          local plr = FindPlayer(stats[player.ID].Partner); 
          if ( DistanceFromPoint( player.Pos.x, player.Pos.y , plr.Pos.x, plr.Pos.y ) > 3 ) MessagePlayer(">> Your teammate must be near to you.", player );
      else if(BankRobTime == 0 && stats[player.ID].Team)
      {
          BankGettingRobbed = true;
          NewTimer("BankRobbery",1000,11,player.ID, plr.ID);
          BankTime = 10;
          pickup.RespawnTime = 60000;
      }
    }
  }
#8
Quoteif( Stats[ plr.ID ].raceplayer )
    {
                    Stats[ plr.ID ].raceplayer = false;
                    plr.IsFrozen = false;
                    plr.Pos = Vector( 496.26, -83.9443, 10.0302  );
    }

You are using Stats as an array here

Quoteif ( ( plr ) && ( status[ plr.ID ].raceplayer ) )
                {
                    plr.IsFrozen = false;
                }

and status here, check it, it might be causing error
#9
Quote from: Nihongo^ on Apr 12, 2023, 07:30 AMP.S Also i tried Pickup.Remove(); but giving the same error

What error does it show when you remove Pickup.remove()?
#10
Script Showroom / Re: Crew/Gang sys-
Apr 11, 2023, 07:58 AM
Quote from: H.a.S.a.N on Mar 20, 2023, 07:37 PMbut this have errors in cosole onscriptload
try this
```
cdb <- ConnectSQL( "crew.db" );
QuerySQL(cdb,"CREATE TABLE IF NOT EXISTS Crews(cName VARCHAR(25), cTag VARCHAR(5), cOWNER VARCHAR(25), cKills INTEGER, cDeaths INTEGER, cMoney INTEGER ) ");
QuerySQL(cdb, "CREATE TABLE IF NOT EXISTS Members(cName VARCHAR(25), cTag VARCHAR(5), Player VARCHAR(30) ) ");
 Stats <- array( GetMaxPlayers(), null );
```

What is the bug here? Can you share a picture of the console?
#11
Put this at the end of your onPlayerCommand & it should work correctly!


else {
  local Commands = ["register", "login", "changepass", "stats", "givecash"]; // Add your commands here...
if (cmd.len() >= 3) {
local matchFound = false;
local indexCmd = "";

for (local i = 0; i < Commands.len(); i++) {
if (cmd == Commands[i]) {
matchFound = true;
break;
}
indexCmd += cmd.slice(i, i + 1);

if (i == 1) {
break;
}
}

if (!matchFound) {
for (local i = 0; i < Commands.len(); i++) {
local currentCmd = Commands[i].slice(0, 2);

if (indexCmd == currentCmd) {
MessagePlayer("Invalid Command, did you mean '"+Commands[i]+"'", player);
matchFound = true;
break;
}
}

if (!matchFound) {
MessagePlayer("Invalid Command, check /cmds for available list of commands.", player);
}
}
} else {
MessagePlayer("Invalid Command, check /cmds for available list of commands.", player);
}
}

Explanation:This code block checks if the player has entered a valid command if the player enters an incorrect command it suggests the correct command this helps prevent errors and confusion for the player.


P.S: Please let me know if you encounter any bugs or have any suggestions for improvement.
#12
Script Showroom / Crew/Gang sys-
Nov 15, 2022, 12:09 PM
Crew System


Crew Class

[noae][noae][noae][noae]InCrew = false;
Crew = null;
CrewTag = null;
Inviter = null;
InvReq=false;
[/noae][/noae][/noae][/noae]

on Script Load
[noae][noae][noae][noae]cdb <- ConnectSQL("dataBase/crew.db");
QuerySQL(cdb,"CREATE TABLE IF NOT EXISTS Crews( cName VARCHAR(25), cTag VARCHAR(5), cOWNER VARCHAR(25), cKills INTEGER, cDeaths INTEGER, cMoney INTEGER ) ");
QuerySQL(cdb, "CREATE TABLE IF NOT EXISTS Members( cName VARCHAR(25), cTag VARCHAR(5), Player VARCHAR(30) ) ");
[/noae][/noae][/noae][/noae]


function(s)
[noae][noae][noae][noae]function cInfo(player)
{
local q = QuerySQL(cdb, "SELECT * FROM Members WHERE Player = '" + escapeSQLString(player.Name) + "'");
if(q) {
    stats[player.ID].Crew = GetSQLColumnData(q, 0);
    stats[player.ID].CrewTag = GetSQLColumnData(q, 1);
    stats[player.ID].InCrew = true;
}
else {
    stats[player.ID].Crew = null;
    stats[player.ID].CrewTag = null;
    stats[player.ID].InCrew = false;
}
}
function InvReq(playerID,plrID)
{
     local player = FindPlayer(playerID), plr = FindPlayer(plrID);
    if(stats[plr.ID].InvReq){
    stats[plr.ID].InvReq=false;
    MessagePlayer("[#ffff4d]The crew invitation sent by [#ffffff]"+player.Name+" [#ffff4d]has been timed out.",plr);
    MessagePlayer("[#ffff4d]The crew invitation you sent to [#ffffff]"+plr.Name+"[#ffff4d] has been timed out.",player);

}
}
[/noae][/noae][/noae][/noae]

on Player Join
[noae][noae][noae][noae]cInfo(player);[/noae][/noae][/noae][/noae]


on Player Death
[noae][noae][noae][noae]        if (stats[player.ID].InCrew)
{
    local q = QuerySQL(cdb, "SELECT * FROM Crews WHERE cName ='"+stats[player.ID].Crew+"'");
     local deaths = GetSQLColumnData(q,4);
     deaths++;
    QuerySQL( cdb, "UPDATE Crews SET cDeaths='"+deaths+"' WHERE cName LIKE '" + stats[player.ID].Crew + "'" );
}
[/noae][/noae][/noae][/noae]
on Player Kill
[noae][noae][noae][noae]        if (stats[killer.ID].InCrew)
{
    local q = QuerySQL(cdb, "SELECT * FROM Crews WHERE cName ='"+stats[player.ID].Crew+"'");
     local kills = GetSQLColumnData(q,3);
     local money = GetSQLColumnData(q,5);
     kills++;
     money++;
    QuerySQL( cdb, "UPDATE Crews SET cKills='"+Kills+"' WHERE cName LIKE '" + stats[player.ID].Crew + "'" );
    QuerySQL( cdb, "UPDATE Crews SET cMoney='"+money+"' WHERE cName LIKE '" + stats[player.ID].Crew + "'" );
}
[/noae][/noae][/noae][/noae]

on Player Command
[noae][noae][noae][noae]if( cmd == "addcrew" )
{
  if(!text) MessagePlayer("[#ff4d4d]/addc <crew name> <crew tag>",player);
  local texta = GetTok( text, " ",  1);
  local textb = GetTok( text, " ",  2);
    if(textb == null) MessagePlayer("[#ff4d4d]/addc <crew name> <crew tag>",player);
   else if (stats[player.ID].InCrew) return MessagePlayer("[#ff4d4d]You are already in a crew.",player);
    else {
    local q = QuerySQL(cdb, "SELECT * FROM Crews WHERE cName ='"+texta+"' ");
    if(q && texta == GetSQLColumnData(q,0)) return MessagePlayer("[#ff4d4d]There's already a crew with this name, please try another.",player);
    else {
  MessagePlayer("[#ffff4d]Crew Added: Name: [#ff9966]"+texta+" [#ffffff]| [#ffff4d]Tag: [#ff9966]"+textb+" [#ffffff]| [#ffff4d]Owner: [#ff9966]"+player.Name+"",player);
 QuerySQL(cdb,"INSERT INTO Crews(cName, cTag, cOWNER, cKills, cDeaths, cMoney) VALUES('"+texta+"', '"+textb+"', '"+escapeSQLString(player.Name)+"', '"+0+"', '"+0+"', '"+0+"')");
QuerySQL(cdb,"INSERT INTO Members(cName, cTag, Player) VALUES('"+texta+"', '"+textb+"', '"+escapeSQLString(player.Name)+"') ");
  stats[player.ID].Crew = texta;
  stats[player.ID].CrewTag = textb;
  stats[player.ID].InCrew = true;
  }
 }
}
else if (cmd == "joincrew")
{
if (!stats[player.ID].InvReq) return MessagePlayer("[#ff4d4d]You haven't recieved any invitation.",player);
else if (stats[player.ID].InCrew) return MessagePlayer("[#ff4d4d]You are already in a crew.",player);
  else {
local plr = FindPlayer( stats[ player.ID ].Inviter );
QuerySQL(cdb,"INSERT INTO Members(cName, cTag, Player) VALUES('"+stats[plr.ID].Crew+"', '"+stats[plr.ID].CrewTag+"', '"+escapeSQLString(player.Name)+"') ");
cInfo(player);
MessagePlayer("[#ffff4d]You have joined [#ff9966]"+stats[player.ID].Crew+"",player);
MessagePlayer("[#ffffff]"+player.Name+"[#ffff4d] has joined your crew",plr);
stats[player.ID].InvReq=false;
  }
}

else if (cmd == "cc" || cmd == "crewchat")
{
if (!text) MessagePlayer("/"+cmd+" text",player);
    else if (!stats[player.ID].InCrew) return MessagePlayer("[#ff4d4d]You are not in any crew.",player);
else {
     for (local i=0;i<GetMaxPlayers();i++) {
    local plr = FindPlayer(i);
    if(stats[player.ID].Crew == stats[i].Crew) {
    MessagePlayer("[#ffff4d]"+player.Name+": [#ff9966]"+text+"",plr);
}
}
}
}
else if (cmd == "crew"){
    if(stats[player.ID].InCrew==false)return MessagePlayer("[#ff4d4d]You are not in any crew.",player);
    else {
    local q = QuerySQL(cdb, "SELECT * FROM Crews WHERE cName = '"+stats[player.ID].Crew+"' ");
    if(q){
        local a = GetSQLColumnData(q,0);
        local b = GetSQLColumnData(q,1);
        local c = GetSQLColumnData(q,5);
        local d = GetSQLColumnData(q,3);
        local e = GetSQLColumnData(q,4);
        local f = GetSQLColumnData(q,2);
        MessagePlayer("[#ffff4d]Crew: [#ff9966]"+a+" ["+b+"] [#ffff4d]Money: [#ff9966]$"+c+" [#ffffff]| [#ffff4d]Kills: [#ff9966]"+d+" [#ffff4d]Deaths: [#ff9966]"+e+"",player);
        MessagePlayer("[#ffff4d]Crew Owned by [#ff9966]"+f+"",player);
    }
  }
}
else if (cmd == "invite")
{
  if (!text) MessagePlayer("[#ff4d4d]/invite player",player);
  else if (!stats[player.ID].InCrew) return MessagePlayer("[#ff4d4d]You aren't in any crew.",player);
  else {
  local plr = FindPlayer(text);
if (!plr) MessagePlayer("Unknown player",player);
  else if (stats[plr.ID].InCrew) return MessagePlayer("[#ff4d4d]Requested player is already in a crew.",player);
  else {
    MessagePlayer("[#ffff4d]You have sent crew invitation to [#ffffff]"+plr.Name+"",player);
    MessagePlayer("[#ffffff]"+player.Name+" [#ffff4d]has asked you to join his crew: [#ff9966]"+stats[player.ID].Crew+"",plr);
    stats[plr.ID].Inviter = player.Name;
    stats[plr.ID].InvReq = true;
    NewTimer( "InvReq", 5000, 1, player.ID,plr.ID);
  }
}
}
else if (cmd == "leavecrew")
{
    if (!stats[player.ID].InCrew) return MessagePlayer("[#ff4d4d]You are not in any crew.",player);
else {
    local q = QuerySQL(cdb,"SELECT * FROM Crews WHERE cOWNER = '"+escapeSQLString(player.Name)+"' ");
        if (q && player.Name == GetSQLColumnData(q,2)) {
    MessagePlayer("[#ff4d4d]You cannot leave the crew because you are the owner.",player);
    }
    else {
            stats[player.ID].InCrew = false;
            stats[player.ID].CrewTag = "null";
            QuerySQL( cdb, "DELETE FROM Members WHERE Player='"+player.Name+"'" );
    MessagePlayer("[#ffff4d]You have left the crew: [#ff9966]"+stats[player.ID].Crew+"",player);
            stats[player.ID].Crew = "null";
    }
}
}

else if (cmd == "crewcmds")
{
    MessagePlayer("[#ff9966]/addcrew | /invite | /joincrew | /leavecrew | /crew | /crewchat(cc)",player);
}
[/noae][/noae][/noae][/noae]

Total commands (6): /addcrew | /invite | /joincrew | /leavecrew | /crew | /crewchat(cc).


#13
Script Showroom / ( Simple ) Account System.
Nov 11, 2022, 01:42 PM
CLASS.
[noae][noae][noae][noae]class PlayerStats
{


Reg = false;
Log = false;
Password = null;

Kills = 0;
Deaths = 0;

Money = 0;
Bank = 0;
Level = 0;

IP = null;
UID = null;
AutoLog = false;
}
[/noae][/noae][/noae][/noae]

onScriptLoad.

[noae][noae][noae][noae]stats <- array(GetMaxPlayers(), null);

db <- ConnectSQL("dataBase.db");
QuerySQL(db, "CREATE TABLE IF NOT EXISTS Account( Name TEXT, IP VARCHAR(15), Pass VARCHAR(255), Level NUMERIC DEFAULT 1, TimeReg VARCHAR(255) )");
QuerySQL(db, "CREATE TABLE IF NOT EXISTS Stats( Name TEXT, Money NUMERIC, Bank NUMERIC, Kills NUMERIC, Deaths NUMERIC ) ");
[/noae][/noae][/noae][/noae]

onPlayerJoin.
[noae][noae][noae][noae]    stats[player.ID] = PlayerStats();
    accInfo(player);
[/noae][/noae][/noae][/noae]


onPlayerPart.
[noae][noae][noae][noae]    if(stats[player.ID].Reg) {
     QuerySQL( db, "UPDATE Account SET Level='"+stats[ player.ID ].Level+"'WHERE Name LIKE '" + player.Name + "'" );
     QuerySQL( db, "UPDATE Stats SET Money='"+stats[ player.ID ].Money+"', Bank='"+stats[ player.ID ].Bank+"', Kills='"+stats[ player.ID ].Kills+"', Deaths='"+stats[ player.ID ].Deaths+"' WHERE Name LIKE '" + player.Name + "'" );
     }
[/noae][/noae][/noae][/noae]

accInfo function.
[noae][noae]function accInfo(player)
{
local q = QuerySQL(db, "SELECT * FROM Account WHERE Name = '" + escapeSQLString(player.Name) + "'");
if(q)
{
stats[ player.ID ].IP = GetSQLColumnData(q, 1);
stats[ player.ID ].Password = GetSQLColumnData(q, 2);
stats[ player.ID ].Level = GetSQLColumnData(q, 3);
}
local q = QuerySQL(db, "SELECT * FROM Stats WHERE Name = '" + escapeSQLString(player.Name) + "'");
if(q) {
stats[ player.ID ].Money = GetSQLColumnData(q, 1);
stats[ player.ID ].Bank = GetSQLColumnData(q, 2);
stats[ player.ID ].Kills = GetSQLColumnData(q, 3);
stats[ player.ID ].Deaths = GetSQLColumnData(q, 4);
stats[ player.ID ].Reg = true;
}

 if (player.IP == stats[ player.ID ].IP)
 {
    MessagePlayer("[#ffffff]"+player.Name+" [#1ABC9C]has auto-logged into the server.", player);
    player.Cash = stats[ player.ID ].Money;
    stats[ player.ID ].Log = true;
   }
       if (stats[player.ID].Reg == true && !stats[player.ID].Log)
       {
    stats[ player.ID ].Log = false;
        stats[ player.ID ].AutoLog = false;
       MessagePlayer("[#E74C3C]Your account is not logged-in, please type [#ffffff]/login <password> [#E74C3C]to access the account.",player);
   }
if (stats[player.ID].Reg == false && stats[player.ID].Log == false)
{
MessagePlayer("[#E74C3C]Your account is not registered. please type [#ffffff]/register <password>[#E74C3C] to access the server.",player);
}
}
[/noae][/noae][/noae][/noae]

Commands.
[noae][noae][noae][noae]if (cmd =="register")
{
        if(!text) MessagePlayer("[#1ABC9C]/register <your password>",player);
        else if (stats[player.ID].Reg == true) MessagePlayer("[#E74C3C]Your account is already registered.",player);
        else {
local password = SHA256(text);
        local now = date();
QuerySQL(db,"INSERT INTO Account(Name, IP, Pass, Level, TimeReg) VALUES('"+escapeSQLString(player.Name)+"', '"+player.IP+"', '"+password+"', '"+0+"', '"+now.year+"-"+now.month+"-"+now.day+"' ) ");
        QuerySQL(db,"INSERT INTO Stats(Name, Money, Bank, Kills, Deaths) VALUES('"+escapeSQLString(player.Name)+"','"+0+"','"+0+"','"+0+"', '"+0+"') ");
        {
            stats[player.ID].Reg = true;
            stats[player.ID].Log = true;
            stats[player.ID].Level = 1;
            stats[player.ID].Money = 0;
            stats[player.ID].Bank = 0;
            stats[player.ID].Kills = 0;
            stats[player.ID].Deaths = 0;
            stats[player.ID].AutoLog = true;
            accInfo(player);
Message(""+player.Name+" [#1ABC9C]has registered in the server.");
        }
}
}

else if (cmd == "login")
{
                if(!text) MessagePlayer("[#1ABC9C]/login <your password>",player);
                else if (stats[player.ID].Reg == false) MessagePlayer("[#E74C3C]Your account is not registered.",player);
                else if (stats[player.ID].Log == true) MessagePlayer("[#E74C3C]Your account is already logged-in.",player);
else {
local q = QuerySQL(db, "SELECT * FROM Account WHERE Name = '" + escapeSQLString(player.Name) + "'");
    if (q)
    {
        if ( SHA256(text) !=  GetSQLColumnData(q, 2)) MessagePlayer( "The password you entered is invalid.", player );
        else {
            stats[player.ID].Log = true;
Message(""+player.Name+" [#1ABC9C]has logged-in to the server.");
}
    }
    }
    }
 else if (cmd == "stats")
 {
        if (stats[player.ID].Reg == false) MessagePlayer("[#E74C3C]Your account is not registered.",player);
        else if (stats[player.ID].Reg == true && stats[player.ID].Log == false) MessagePlayer("[#E74C3C]Your account is not logged-in.",player);
                else {
MessagePlayer("[#1ABC9C]Kills: "+stats[player.ID].Kills+" | Deaths: "+stats[player.ID].Deaths+" | Money: $"+stats[player.ID].Money+" | Bank: $"+stats[player.ID].Bank+" | Level: "+stats[player.ID].Level+" ",player);
}
 }

 else if (cmd == "changepass")
 {
                if(!text) MessagePlayer("[#1ABC9C]/changepass <new password>",player);
                else if (stats[player.ID].Reg == false) MessagePlayer("[#E74C3C]Your account is not registered.",player);
                else if (stats[player.ID].Reg == true && stats[player.ID].Log == false) MessagePlayer("[#E74C3C]Your account is not logged-in.",player);
                else {
          local password = SHA256(text);
 QuerySQL(db, "UPDATE Account SET Pass = '" + password + "' WHERE Name = '" + escapeSQLString(player.Name) + "'");
          MessagePlayer("[#1ABC9C]Your password has been changed to: [#ffffff]"+text+"[#1ABC9C] (DO NOT FORGET IT)",player);
                }
 }
[/noae][/noae][/noae][/noae]
Commands - (4): /register | /login | /changepass | /stats

onPlayerDeath.
[noae][noae][noae][noae]        stats[player.ID].Deaths++;
[/noae][/noae][/noae][/noae]

onPlayerKill.
[noae][noae][noae][noae]    stats[player.ID].Deaths++;
    stats[killer.ID].Kills++;
[/noae][/noae][/noae][/noae]

onPlayerRequestSpawn.
[noae][noae][noae][noae] if(!stats[player.ID].Reg) { MessagePlayer([#E74C3C]Your account is not registered. please type [#ffffff]/register <password>[#E74C3C] to access the server.",player); return 0; }
     if(stats[player.ID].Reg && stats[player.ID].Log == false) {  MessagePlayer("[#E74C3C]Your account is not logged-in, please type [#ffffff]/login <password> [#E74C3C]to access the account.",player); return 0; }
[/noae][/noae][/noae][/noae]

Hello guys so it's me again ;D first time trying to make my own account system it might have alot of bugs if you encounter any so please let me know. The script is tested btw.


#14
Servers / Deathmatch Smashing ZonE.
Jul 08, 2022, 06:34 AM


Hello lads! Presenting you DeathMatch Smashing ZonE lead by Gitto and scripted by Atom, OreoT and Gitto.

The server game mode is based on normal death matching. There are many minigames which you can play while you get bored like WaterFight, GunGame, Parkour and TDM(like in PUBG)

There are many ways to earn dtc (dtc is our currency name "DeathMatch Coin")

If you face any issue you can contact us at our discord server, here's the invite link:  https://discord.gg/ctrpcbmWeJ

We do not have any forum and we have no intent in making one so everything will be on discord.

Server IP: 51.178.65.136-8282

Thanks for reading!
#15
Wow man amazing! I was waiting for this desperately, Thanks alot.