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
Sorry for my bad English
Please any bug say here for help
I hope injoy in this systems
And keep creators
Good luck!
And All my thanks for gito Baloch for his perfect bank rob script
Code Select
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!