[Script] Simple Rob Systems for servers

Started by H.a.S.a.N, Aug 11, 2023, 04:32 PM

Previous topic - Next topic

H.a.S.a.N

Hello guys I have been made simple rob system I maked database for rob + cash
And All my thanks for gito Baloch for his perfect bank rob script

const Creator = "H.a.S.a.N";
const Creators = "H.a.S.a.N , Gito Baloch";
const BankRobCreator = "Gito Baloch";
const rpmsg = "[#FCFB92]";
class PlayerStats
{
Robskills = 0;
Cash = 0;
Team = false;
 Partner = "";
 Requested = false;
 AtAmmu = false;
 BombBought = false;
 InsideLocker = false;
}

function onScriptLoad()
{
    print( "---- Rob System ----: Loaded" );
    print( "---- Bank Rob System ----: Loaded By  "+Creators+" " );
    print( "---- Bank Rob Script ----: Loaded By  "+BankRobCreator+" " );
stats <- array ( GetMaxPlayers(), null );
Robs <- ConnectSQL("Robs.db");
QuerySQL( Robs, "CREATE TABLE IF NOT EXISTS Accounts( Nickname TEXT, Robskills INTEGER, Cash INTEGER )");
randomrob <- [ 1000, 1600, 2000, 2100, 2600, 3000, 3100, 3600, 4000, 4100, 4600, 5000, 5100, 5600, 6000, 6100, 6600, 7000, 7100, 7600, 8100, 8600, 9100, 9600, 10100, 10600, 11000 25000, 15000, 55000, 25100, 350006, 55100, 13200 ];
Loade();
BankRobbed <- true;
BankGettingRobbed <- false;
BankRobTime <- 1800;
BankTime <- 0;
}

function onScriptUnload()
{
 DiscconectSQL( Robs );
}

function PlayerRobInfo(player)
{
local p = QuerySQL( Robs, "SELECT * FROM Accounts WHERE Nickname='"+player.Name+"'" );
if (p)
{
stats[ player.ID ].Robskills = GetSQLColumnData( p, 1 );
stats[ player.ID ].Cash = GetSQLColumnData( p, 2 );
}
}

function RemoveCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local det = cash - amount;
stats[ player.ID ].Cash = det;
player.Cash = det;
}

function UpdateRobInfo(player)
{
QuerySQL( Robs, "UPDATE Accounts SET Cash='"+stats[ player.ID ].Cash+"', Robskills = '"+stats[ player.ID ].Robskills+"' WHERE Nickname= '" + player.Name + "'" );
print("Stats saved!");
}

// =========================================== P L A Y E R  E V E N T S ==============================================
function onPlayerJoin( player )
{
stats[ player.ID ] = PlayerStats();
PlayerRobInfo(player)
      player.RequestModuleList();
}

function onPlayerChat( player, text )
{
    print( player.Name + ": " + text );
    return 1;
}

function onPlayerCommand( player, cmd, text )
{
    if (cmd == "heal")
    {
        local hp = player.Health;
        if( hp == 100) MessagePlayer("[#FF3636]Error - [#8181FF]Use this command when you have less than 100% hp !",player);
        else {
            player.Health = 100.0;
            MessagePlayer( "[#FFFF81]---> You have been healed !", player );
        }
    }
    else if ( cmd == "info" )
    {
        MessagePlayer( "[#ffffff]Server Name:[ " + GetServerName() + " ].", player );
        MessagePlayer( "[#ffffff]Script Rob( v0.1 ) , Created by "+Creator+"", player );
        MessagePlayer( "[#ffffff]Script Bank Rob Created by "+BankRobCreator+"", player );
        MessagePlayer( "[#ffffff]Players:( " + GetPlayers() + "/" + GetMaxPlayers() + " ).", player );   
        MessagePlayer( "[#ffffff]Cars:( " + GetVehicleCount() + " ) ", player );   
        MessagePlayer( "[#ffffff]Game speed:( " + GetGamespeed() + " )." , player );
        MessagePlayer( "[#ffffff]Pickups count:( " + GetPickupCount() + " )." , player );
    }
else if ( cmd == "cmds" || cmd == "commands" )
{
if (!text) MessagePlayer("[#ff0000]Error: [#ffffff]Correct syntax: /"+cmd+" <1/2>.", player);
else if ( text == "1" )
{
MessagePlayer("[#00ff00]====== G E N E R A L  C O M M A N D S ======", player);
MessagePlayer("[#ffffff]Available commands: (/) cmds, heal, info, stats .",player);
}
else if ( text == "2" )
{
MessagePlayer("[#00ff00]====== B A N K  R O B  C O M M A N D S ======", player);
MessagePlayer("[#00ff00]Available commands: (/) teamup, team, bankrob, buybomb, usebomb, invite, reject.", player);
}
else MessagePlayer("[#ff0000]Error: use /"+cmd+" <1/2/>.", player);
}
else if ( cmd == "stats" )
{
if (!text)
{
MessagePlayer("[#00ff00]Your stats: Robskills: "+stats[ player.ID ].Robskills+", Cash: "+stats[ player.ID ].Cash+".", player);
}
else if (text)
{
local plr = FindPlayer(text);
if (!plr) MessagePlayer("[#ff0000]Error:[#ffffff] Player not found.", player);
else{
MessagePlayer("[#f0f0ff]"+plr.Name+" statistics: Robskills: "+stats[ plr.ID ].Robskills+", Cash: "+stats[ plr.ID ].Cash+".", player);
}
}
}
else if ( cmd == "reject")
{
 if( stats[player.ID].Partner == "" ) return MessagePlayer("You haven't recieved any team-up request yet.",player);
 else if ( stats[player.ID].Team == true ) return MessagePlayer("you are already it team",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;
}
    else if ( cmd == "bankrob" )
    {
    BankRobTimeLeft(player);
}
 
      else if ( cmd == "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);
    }
}
    else if ( cmd == "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);
    }
  }
}
    else if ( cmd == "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);
    }
}
    else if ( cmd == "teamchat" || cmd == "tc" )
    {
  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);
  }
}
    else if ( cmd == "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 = "";
  }
}
    else if ( cmd == "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 if( stats[player.ID].Cash >= 4000 ) MessagePlayer("[#ff0000]You can't buy this item, it costs $4000, you have $"+player.Cash,player);
  else {
  stats[player.ID].BombBought = true;
RemoveCash( player, 4000 );
UpdateRobInfo(player);
  local plr = FindPlayer(stats[player.ID].Partner);
  MessagePlayer(">> Bomb purchased successfully.",player);
  MessagePlayer(">> Your teammate: "+player.Name+" has bought the bomb.",plr);
  }
}
    else if ( cmd == "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 );
  }
  }
else MessagePlayer("[#ff00ff]/"+cmd+" Unkown cmd[#ffffff] try /cmds.",player);

    return 1;
}

function onPlayerGameKeysChange( player, oldKeys, newKeys )
{
    player.Cash = stats[player.ID].Cash;
    player.Score = stats[player.ID].Robskills;
    player.RequestModuleList();
}

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;
}
}

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();
}

//onTimeChange Function

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

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

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

function onPickupPickedUp( player, pickup )
{
        if ( pickup.Model == 408 )
        {
            if(player.Vehicle) return false
            MessagePlayer("You want leave car for claim pickup",player)
      {
 pickup.RespawnTime = 90000;
  Message("[#FF0000]"+ player.Name +" has Robbed the "+ GetDistrictName( player.Pos.x, player.Pos.y ) +"");
  local a = randomrob[rand()% randomrob.len()]
  stats[ player.ID ].Cash = stats[ player.ID ].Cash + a ;
  Announce( "~y~ You have Robbed :"+ a +"", player )
  player.Cash = stats[ player.ID ].Cash;
player.WantedLevel++;
  stats[ player.ID ].Robskills++;
UpdateRobInfo(player)
}
}
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;
      }
    }
  }
}

function onPickupRespawn( pickup )
{
}

// ====================================== C H E C K P O I N T  E V E N T S ==========================================

    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) {
        MessagePlayer("you now in ammunation check commands bank rob /cmds 2",player)
        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;
    }
}

// ================================== E N D  OF  O F F I C I A L  E V E N T S ======================================
 function Loade()
 {
 CreatePickup(508, Vector( 390.96, -506.26, 9.39 ));
CreatePickup(408, Vector( 207.214, -470.93, 11.0699 ));  // bunchoftools
CreatePickup(408, Vector( 467.072, -53.9059, 11.4837 ));  // malibu
CreatePickup(408, Vector( 418.765, 91.317, 11.2808 ));  // pizzavc
CreatePickup(408, Vector( 491.143, 701.207, 12.1033 ));  // hospitalvc
CreatePickup(408, Vector( 450.729, 782.371, 12.954 ));  // storevc
CreatePickup(408, Vector( 472.171, 1009.33, 19.1462 ));  // tarbrush1
CreatePickup(408, Vector( 471.983, 1014.02, 20.0473 ));  // tarbrush2
CreatePickup(408, Vector( 421.842, 1026.69, 25.2993 ));  // gash
CreatePickup(408, Vector( 364.444, 1052.46, 19.213 ));  // ammunationmall
CreatePickup(408, Vector( 363.719, 1074.71, 19.0613 ));  // tooledup
CreatePickup(408, Vector( 351.45, 1111.41, 25.3879 ));  // musicshop
CreatePickup(408, Vector( 469.438, 1206.76, 19.0103 ));  // jewelry
CreatePickup(408, Vector( 2.39992, 956.954, 11.1667 ));  // film
CreatePickup(408, Vector( -680.664, 1204.1, 11.1093 ));  // ammudowntown
CreatePickup(408, Vector( -822.855, 1138.59, 12.4111 ));  // hospitaldt
CreatePickup(408, Vector( -853.756, 850.456, 11.3846 ));  // jewelrydt
CreatePickup(408, Vector( -905.961, 799.732, 11.4661 ));  // pizzadt
CreatePickup(408, Vector( -830.144, 742.221, 11.2885 ));  // medicaldt
CreatePickup(408, Vector( -594.15, 643.695, 11.6765 ));  // bikers
CreatePickup(408, Vector( -846.475, -71.8574, 11.5403 ));  // medicallh
CreatePickup(408, Vector( -1079.9, -275.156, 12.0882 ));  // printworks
CreatePickup(408, Vector( -1038.02, 80.8385, 11.6263 ));  // pizzalh
CreatePickup(408, Vector( -997.021, 186.33, 12.434 ));  // kaufman
CreatePickup(408, Vector( -887.722, -474.079, 13.1115 ));  // hospitallh
CreatePickup(408, Vector( -881.679, -575.985, 15.0586 ));  // cherrypopper
CreatePickup(408, Vector( -855.472, -631.404, 11.3756 ));  // donuts
CreatePickup(408, Vector( -1166.79, -620.55, 11.8279 ));  // cubaan
CreatePickup(408, Vector( -1031.45, -850.113, 13.5224 ));  // sunshine
CreatePickup(408, Vector( -665.544, -1484.63, 13.8016 ));  // boatyard
CreatePickup(408, Vector( -112.599, -975.639, 10.4634 ));  // hospitalvc
CreatePickup(408, Vector( -63.8908, -1485.23, 10.505 ));  // ammuvc
CreatePickup(408, Vector( 90.5438, -1454.35, 10.5655 ));  //  poleposition

//Nitro
//CreatePickup(408, Vector( 60.694, -1072.84, 10.4633 ));  // nitro1
//CreatePickup(408, Vector( 40.3707, -1055.39, 10.4633 ));  // nitro2

print("Pickups Has Been Loaded by "+Creator+"")

//MISC

//Markers
CreateMarker( 1, Vector(  -1012.07, -865.003, 13.0807 ), 5, RGB(10, 10, 10), 26 ); // Sunshine
CreateMarker( 1, Vector( -908.112, -340.912, 13.3802 ), 5, RGB(10, 10, 10), 24 ); // Bank

print("Pickups Bank Rob Has Been Loaded by "+BankRobCreator+"")

// bank rob cp + pickups
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.
 }

Sorry for my bad English

 Please any bug say here for help

I hope injoy in this systems

And keep creators

Good luck!

H.a.S.a.N

#1
hello everyone. how are you?
i hope all fine
some friends was report bugs for this scripts
hazem7z was reported
and some friends also gave me idea
Xann asked me today for add addpickuprob with db
also added account system by SHy

Changelogs;
1_account system added (System by SHy V0.1)
2_ /addrob // this for add pickups rob (only for store)

const Creator = "H.a.S.a.N";
const Creators = "H.a.S.a.N , Gito Baloch";
const BankRobCreator = "Gito Baloch";
const rpmsg = "[#FCFB92]";
const AccountSySCreator = "SHy";

class PlayerStats
{
IsAdmin = false;
Kills = 0;
Deaths = 0;
Cash = 0;
Level = 0;
Registered = false;
Logged = false;
Bank = 0;
AutoLogin = "on";
Robskills = 0;
BankRobs = 0;
Team = false;
 Partner = "";
 Requested = false;
 AtAmmu = false;
 BombBought = false;
 InsideLocker = false;
}

class RobStats
{
ID = 0;
Name = null;
Wanted = null;
}

function onServerStart()
{
}

function onServerStop()
{
}

function onScriptLoad()
{
stats <- array ( GetMaxPlayers(), null );
 acc <- ConnectSQL("Account.db");
 QuerySQL( acc, "CREATE TABLE IF NOT EXISTS Accounts( Nickname TEXT, Password TEXT, IP VARCHAR(32), UID VARCHAR(255), UID2 VARCHAR(255), Kills INTEGER, Deaths INTEGER, Cash INTEGER, Bank INTEGER, Level INTEGER, AutoLogin TEXT, Robskills INTEGER, BankRobs INTEGER )");
 print("Account system has been loaded By "+AccountSySCreator+".");
     print( "---- Rob System V0.1 ----: Loaded" );
    print( "---- Bank Rob System V0.1 ----: Loaded By  "+Creators+" " );
    print( "---- Bank Rob Script ----: Loaded By  "+BankRobCreator+" " );
randomrob <- [ 1000, 1600, 2000, 2100, 2600, 3000, 3100, 3600, 4000, 4100, 4600, 5000, 5100, 5600, 6000, 6100, 6600, 7000, 7100, 7600, 8100, 8600, 9100, 9600, 10100, 10600, 11000 25000, 15000, 55000, 25100, 350006, 55100, 13200 ];
Loade();
BankRobbed <- true;
BankGettingRobbed <- false;
BankRobTime <- 1800;
BankTime <- 0;
db <- ConnectSQL( "PickUpsRobs.db" );
Rob <- array( 1001, null );
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Robs ( ID NUMERIC, Name TEXT, PosX NUMERIC, PosY NUMERIC, PosZ NUMERIC )" );
LoadRobs();
}

function onScriptUnload()
{
DiscconectSQL( acc );
DiscconectSQL( db );
}
function PlayerInfo(player)
{
local q = QuerySQL( acc, "SELECT * FROM Accounts WHERE Nickname='"+player.Name+"'" );
if (q)
{
if ( GetSQLColumnData( q, 2 ) == player.IP && GetSQLColumnData( q, 3 ) == player.UniqueID && GetSQLColumnData( q, 4 ) == player.UniqueID2 && GetSQLColumnData( q, 10 ).tostring() == "on" )
{
Message("[#c00ff2]"+player.Name+" got automatically logged in!.");
stats[ player.ID ].Registered = true;
stats[ player.ID ].Logged = true;
stats[ player.ID ].Kills = GetSQLColumnData( q, 5 );
stats[ player.ID ].Deaths = GetSQLColumnData( q, 6 );
AddCash( player, GetSQLColumnData( q, 7 ) );
stats[ player.ID ].Bank = GetSQLColumnData( q, 8 );
stats[ player.ID ].Level = GetSQLColumnData( q, 9 );
stats[ player.ID ].Robskills = GetSQLColumnData( q, 11 );
stats[ player.ID ].BankRobs = GetSQLColumnData( q, 12 );
QuerySQL( acc, "UPDATE Accounts SET IP='"+player.IP+"', UID='"+player.UniqueID+"', UID2='"+player.UniqueID2+"' WHERE Nickname='"+player.Name+"'" );
}
else
{
MessagePlayer("[#000fff]The account ( "+player.Name+" ) is registered, please login into it.", player);
stats[ player.ID ].Registered = true;
}
}
else MessagePlayer("[#00ff00]Your account is not registered, type /register to have a control over your account!", player);
}
function RemoveCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local det = cash - amount;
stats[ player.ID ].Cash = det;
player.Cash = det;
}
function AddCash( player, amount )
{
local cash = stats[ player.ID ].Cash;
local add = cash + amount;
stats[ player.ID ].Cash = add;
player.Cash = add;
}
function UpdateInfo(player)
{
QuerySQL( acc, "UPDATE Accounts SET IP='"+player.IP+"', UID='"+player.UniqueID+"', UID2='"+player.UniqueID2+"', Kills = '"+stats[ player.ID ].Kills+"', Deaths='"+stats[ player.ID ].Deaths+"', Cash='"+stats[ player.ID ].Cash+"', Bank = '"+stats[ player.ID ].Bank+"' Robskills = '"+stats[ player.ID ].Robskills+"', BankRobs='"+stats[ player.ID ].BankRobs+"' WHERE Nickname= '" + player.Name + "'" );
print("Stats saved!");
}


// =========================================== P L A Y E R  E V E N T S ==============================================
function onPlayerJoin( player )
{
stats[ player.ID ] = PlayerStats();
PlayerRobInfo(player)
      player.RequestModuleList();
}

function onPlayerChat( player, text )
{
    print( player.Name + ": " + text );
    return 1;
}

function onPlayerPart( player, reason )
{
 if ( stats[ player.ID ].Logged ) UpdateInfo(player);
}

function onPlayerRequestClass( player, classID, team, skin )
{
return 1;
}

function onPlayerRequestSpawn( player )
{
if ( !stats[ player.ID ].Logged ) return MessagePlayer("[#ffffff]The account is registered, please do /login.", player);
else return 1;
}

H.a.S.a.N

#2
function onPlayerCommand( player, cmd, text )
{
    if (cmd == "heal")
    {
        local hp = player.Health;
        if( hp == 100) MessagePlayer("[#FF3636]Error - [#8181FF]Use this command when you have less than 100% hp !",player);
        else {
            player.Health = 100.0;
            MessagePlayer( "[#FFFF81]---> You have been healed !", player );
        }
    }
    else if ( cmd == "info" )
    {
        MessagePlayer( "[#ffffff]Server Name:[ " + GetServerName() + " ].", player );
        MessagePlayer( "[#ffffff]Script Rob( v0.1 ) , Created by "+Creator+"", player );
        MessagePlayer( "[#ffffff]Script Bank Rob Created by "+BankRobCreator+"", player );
        MessagePlayer( "[#ffffff]Players:( " + GetPlayers() + "/" + GetMaxPlayers() + " ).", player ); 
        MessagePlayer( "[#ffffff]Cars:( " + GetVehicleCount() + " ) ", player ); 
        MessagePlayer( "[#ffffff]Game speed:( " + GetGamespeed() + " )." , player );
        MessagePlayer( "[#ffffff]Pickups count:( " + GetPickupCount() + " )." , player );
    }
    else if ( cmd == "admin" || cmd == "passwordadmin" )
{
if (!text) MessagePlayer("[#ff0000]Error: [#ffffff]Correct syntax: /"+cmd+" <password>.", player);
else if ( text == "password" )
{
  MessagePlayer("[#00ff00]Congarts You have been logged as admin.", player);
  MessagePlayer("[#00ff00] Congarts player name ["+player.Name+"] has been logged as admin",player)
}
else MessagePlayer("[#ff0000]Error: invald password /"+cmd+" <password>.", player);
}

else if ( cmd == "cmds" || cmd == "commands" )
{
if (!text) MessagePlayer("[#ff0000]Error: [#ffffff]Correct syntax: /"+cmd+" <1/2>.", player);
else if ( text == "1" )
{
MessagePlayer("[#00ff00]====== G E N E R A L  C O M M A N D S ======", player);
MessagePlayer("[#ffffff]Available commands: (/) cmds, heal, info, stats, admin.",player);
}
else if ( text == "2" )
{
MessagePlayer("[#00ff00]====== B A N K  R O B  C O M M A N D S ======", player);
MessagePlayer("[#00ff00]Available commands: (/) teamup, team, bankrob, buybomb, usebomb, invite, reject.", player);
}
else MessagePlayer("[#ff0000]Error: use /"+cmd+" <1/2/>.", player);
}
else if ( cmd == "stats" )
{
if (!text)
{
MessagePlayer("[#00ff00]Your stats: Robskills: "+stats[ player.ID ].Robskills+", Cash: "+stats[ player.ID ].Cash+".", player);
}
else if (text)
{
local plr = FindPlayer(text);
if (!plr) MessagePlayer("[#ff0000]Error:[#ffffff] Player not found.", player);
else{
MessagePlayer("[#f0f0ff]"+plr.Name+" statistics: Robskills: "+stats[ plr.ID ].Robskills+", Cash: "+stats[ plr.ID ].Cash+".", player);
}
}
}
else if ( cmd == "reject")
{
 if( stats[player.ID].Partner == "" ) return MessagePlayer("You haven't recieved any team-up request yet.",player);
 else if ( stats[player.ID].Team == true ) return MessagePlayer("you are already it team",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;
}
    else if ( cmd == "bankrob" )
    {
    BankRobTimeLeft(player);
}
 
      else if ( cmd == "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);
    }
}
    else if ( cmd == "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);
    }
  }
}
    else if ( cmd == "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);
    }
}
    else if ( cmd == "teamchat" || cmd == "tc" )
    {
  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);
  }
}
    else if ( cmd == "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 = "";
  }
}
    else if ( cmd == "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 if( stats[player.ID].Cash >= 4000 ) MessagePlayer("[#ff0000]You can't buy this item, it costs $4000, you have $"+player.Cash,player);
  else {
  stats[player.ID].BombBought = true;
RemoveCash( player, 4000 );
UpdateRobInfo(player);
  local plr = FindPlayer(stats[player.ID].Partner);
  MessagePlayer(">> Bomb purchased successfully.",player);
  MessagePlayer(">> Your teammate: "+player.Name+" has bought the bomb.",plr);
  }
}
    else if ( cmd == "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 );
  }
  }
else  if( cmd == "addrob" )
{
if( !text ) MessagePlayer( "use /addrob <Name> ",player );
else if( !text ) MessagePlayer( "Exemple: /addrob Mansion",player );
else
{
local name = GetTok( text, " ", 1 );
if( !name ) MessagePlayer( "use /addrob <Nome>",player );
else if( IsNum(name) ) MessagePlayer( "syntax : Error - You want make name.",player );
else
{
local id = CreatePickup( 408, 1, 1, player.Pos.x, player.Pos.y, player.Pos.z, 255, true ).ID;
QuerySQL( db, "INSERT INTO Robs VALUES ( '" + CountRobs() + "', '" + name + "','" + player.Pos.x + "','" + player.Pos.y + "','" + player.Pos.z + "' )" );
Rob[ id ] = RobStats(), Rob[ id ].ID = CountRobs(), Rob[ id ].Name = name;
MessagePlayer( "[#FF0000]*** Local : added pickup rob? [successfully].", player );
}
}
}
  else if ( cmd == "setrob" )
{
if ( !stats[ player.ID ].IsAdmin ) MessagePlayer("[#FFDD33]Information:[#FFFFFF] You aren't authorized to use this command.", player );
  else
{
      if( !text ) MessagePlayer("[#FFFFFF]Error [#FF0000]: Use /"+cmd+" <plr> <integer>", player);
      local params = split( text, " " );
      if( params.len() < 1 ) MessagePlayer("[#FFFFFF]Error [#FF0000]:Wrong no. of parameters.", player);
      else if( !IsNum( params[1] ) ) return MessagePlayer("[#FFFFFF]Error [#FF0000]: Robskills must be an integer.", player);
      local plr = IsNum( params[0] ) ? FindPlayer( params[0].tointeger() ) : FindPlayer( params[0] );
      if( !plr ) return MessagePlayer( "[#FFFFFF]Error [#FF0000]: Wrong player.", player );
 else stats[plr.ID].Robskills = params[1].tointeger();
UpdateRobInfo(plr)
 MessagePlayer("[#FFDD33]Information:[#FFFFFF] "+player.Name+" Set Rob  :[ "+plr.Name+" ]  .", player );
}
}

  else if ( cmd == "setcash" )
{
if ( !stats[ player.ID ].IsAdmin ) MessagePlayer("[#FFDD33]Information:[#FFFFFF] You aren't authorized to use this command.", player );
  else
{
      if( !text ) MessagePlayer("[#FFFFFF]Error [#FF0000]: Use /"+cmd+" <plr> <cash>", player);
      local params = split( text, " " );
      if( params.len() < 1 ) MessagePlayer("[#FFFFFF]Error [#FF0000]:Wrong no. of parameters.", player);
      else if( !IsNum( params[1] ) ) return MessagePlayer("[#FFFFFF]Error [#FF0000]: Cash must be an integer.", player);
      local plr = IsNum( params[0] ) ? FindPlayer( params[0].tointeger() ) : FindPlayer( params[0] );
      if( !plr ) return MessagePlayer( "[#FFFFFF]Error [#FF0000]: Wrong player.", player );
 else stats[plr.ID].Cash = params[1].tointeger();
UpdateRobInfo(plr)
 MessagePlayer("[#FFDD33]Information:[#FFFFFF] "+player.Name+" Set Cash  :[ "+plr.Name+" ]  .", player );
}
}


else MessagePlayer("[#ff00ff]/"+cmd+" Unkown cmd[#ffffff] try /cmds.",player);

    return 1;
}

FUNCTIONS
function onPlayerGameKeysChange( player, oldKeys, newKeys )
{
    player.Score = stats[player.ID].Robskills;
    player.RequestModuleList();
}

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;
}
}

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();
}

//onTimeChange Function

function onTimeChange(oldHour, oldMin, newHour, newMin) {
  if(BankRobTime > 0) BankRobTime--;
}
function SendDataToClient( player, ... )
{
    if( vargv[0] )
    {
        local     byte = vargv[0],
                len = vargv.len();
               
        if( 1 > len ) devprint( "ToClent <" + byte + "> No params specified." );
        else
        {
            Stream.StartWrite();
            Stream.WriteByte( byte );

            for( local i = 1; i < len; i++ )
            {
                switch( typeof( vargv[i] ) )
                {
                    case "integer": Stream.WriteInt( vargv[i] ); break;
                    case "string": Stream.WriteString( vargv[i] ); break;
                    case "float": Stream.WriteFloat( vargv[i] ); break;
                }
            }
           
            if( player == null ) Stream.SendStream( null );
            else if( typeof( player ) == "instance" ) Stream.SendStream( player );
            else devprint( "ToClient <" + byte + "> Player is not online." );
        }
    }
    else devprint( "ToClient: Even the byte wasn't specified..." );
}

function LoadRobs()
{
local i = 0, id, name, price, wanted, posx, posy, posz;
local q = QuerySQL( db, "SELECT * FROM Robs" );
while ( GetSQLColumnData( q, 0 ) != null )
{
name = GetSQLColumnData( q, 1 );
posx = GetSQLColumnData( q, 2 );
posy = GetSQLColumnData( q, 3 );
posz = GetSQLColumnData( q, 4 );
id = CreatePickup( 408, 1, 1, posx, posy, posz, 255, true ).ID;
Rob[ id ] = RobStats();
Rob[ id ].ID = GetSQLColumnData( q, 0 );
Rob[ id ].Name = name;
GetSQLNextRow( q );
i++;
}
FreeSQLQuery( q );
print( "[Rob-System] Rob System v0.2 Has Been Loaded - (" + i + ")");
}

function CountRobs()
{
local c = 0;
for( local i = 0, pickup; i < GetPickupCount(); i++ )
{
pickup = FindPickup( i );
if ( pickup && pickup.Model == 408 ) c ++;
}
return c;
}

function Loade()
 {
    /* P I C K  U P  E V E N T */
 CreatePickup(508, Vector( 390.96, -506.26, 9.39 ));
CreatePickup(408, Vector( 207.214, -470.93, 11.0699 ));  // bunchoftools
CreatePickup(408, Vector( 467.072, -53.9059, 11.4837 ));  // malibu
CreatePickup(408, Vector( 418.765, 91.317, 11.2808 ));  // pizzavc
CreatePickup(408, Vector( 491.143, 701.207, 12.1033 ));  // hospitalvc
CreatePickup(408, Vector( 450.729, 782.371, 12.954 ));  // storevc
CreatePickup(408, Vector( 472.171, 1009.33, 19.1462 ));  // tarbrush1
CreatePickup(408, Vector( 471.983, 1014.02, 20.0473 ));  // tarbrush2
CreatePickup(408, Vector( 421.842, 1026.69, 25.2993 ));  // gash
CreatePickup(408, Vector( 364.444, 1052.46, 19.213 ));  // ammunationmall
CreatePickup(408, Vector( 363.719, 1074.71, 19.0613 ));  // tooledup
CreatePickup(408, Vector( 351.45, 1111.41, 25.3879 ));  // musicshop
CreatePickup(408, Vector( 469.438, 1206.76, 19.0103 ));  // jewelry
CreatePickup(408, Vector( 2.39992, 956.954, 11.1667 ));  // film
CreatePickup(408, Vector( -680.664, 1204.1, 11.1093 ));  // ammudowntown
CreatePickup(408, Vector( -822.855, 1138.59, 12.4111 ));  // hospitaldt
CreatePickup(408, Vector( -853.756, 850.456, 11.3846 ));  // jewelrydt
CreatePickup(408, Vector( -905.961, 799.732, 11.4661 ));  // pizzadt
CreatePickup(408, Vector( -830.144, 742.221, 11.2885 ));  // medicaldt
CreatePickup(408, Vector( -594.15, 643.695, 11.6765 ));  // bikers
CreatePickup(408, Vector( -846.475, -71.8574, 11.5403 ));  // medicallh
CreatePickup(408, Vector( -1079.9, -275.156, 12.0882 ));  // printworks
CreatePickup(408, Vector( -1038.02, 80.8385, 11.6263 ));  // pizzalh
CreatePickup(408, Vector( -997.021, 186.33, 12.434 ));  // kaufman
CreatePickup(408, Vector( -887.722, -474.079, 13.1115 ));  // hospitallh
CreatePickup(408, Vector( -881.679, -575.985, 15.0586 ));  // cherrypopper
CreatePickup(408, Vector( -855.472, -631.404, 11.3756 ));  // donuts
CreatePickup(408, Vector( -1166.79, -620.55, 11.8279 ));  // cubaan
CreatePickup(408, Vector( -1031.45, -850.113, 13.5224 ));  // sunshine
CreatePickup(408, Vector( -665.544, -1484.63, 13.8016 ));  // boatyard
CreatePickup(408, Vector( -112.599, -975.639, 10.4634 ));  // hospitalvc
CreatePickup(408, Vector( -63.8908, -1485.23, 10.505 ));  // ammuvc
CreatePickup(408, Vector( 90.5438, -1454.35, 10.5655 ));  //  poleposition
//Nitro
CreatePickup(408, Vector( 60.694, -1072.84, 10.4633 ));  // nitro1
CreatePickup(408, Vector( 40.3707, -1055.39, 10.4633 ));  // nitro2
print("Pickups Has Been Loaded by "+Creator+"")

    /* E N D  P I C K  U P  E V E N T */
//MISC

//Markers
CreateMarker( 1, Vector(  -1012.07, -865.003, 13.0807 ), 5, RGB(10, 10, 10), 26 ); // Sunshine
CreateMarker( 1, Vector( -908.112, -340.912, 13.3802 ), 5, RGB(10, 10, 10), 24 ); // Bank

print("Pickups Bank Rob Has Been Loaded by "+BankRobCreator+"")

    /* P I C K  U P S B A N K  R O B  E V E N T */
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.
    /* E N D  P I C K  U P S B A N K  R O B  E V E N T */
 }

H.a.S.a.N

#3
PICKUPS + CHECKPOINT SYSTEM
function onPickupClaimPicked( player, pickup )
{
return 1;
}

function onPickupPickedUp( player, pickup )
{
        if ( pickup.Model == 408 )
        {
            if(player.Vehicle) MessagePlayer("You want leave car for claim pickup",player)
      else{
  Message("[#FF0000]"+ player.Name +" has Robbed the "+ GetDistrictName( player.Pos.x, player.Pos.y ) +" Store: " + Rob[ pickup.ID ].Name + ".");
  local a = randomrob[rand()% randomrob.len()]
  stats[ player.ID ].Cash = stats[ player.ID ].Cash + a ;
  Announce( "~y~ You have Robbed :"+ a +"", player )
  player.Cash = stats[ player.ID ].Cash;
player.WantedLevel++;
  stats[ player.ID ].Robskills++;
UpdateInfo(player)
 pickup.RespawnTime = 90000;
}
}
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;
      }
    }
  }
}

function onPickupRespawn( pickup )
{
}

// ====================================== C H E C K P O I N T   E V E N T S ==========================================

    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) {
        MessagePlayer("you now in ammunation check commands bank rob /cmds 2",player)
        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;
    }
}

[LINK] this for full script ; https://drive.google.com/file/d/1l8f0W5P5rFaOI5Fj1gtSwMhl6nhbH-iH/view?usp=drive_link

[TIPS] if you saw other id for pickup in database that becouse have in script u can delete that and add your pickups

[Warn] First Rule Keep Creators

Good Luck and have a Nice Day!! :)  :D