This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Topics - gito baloch
Pages: [1]
1
« on: August 17, 2024, 01:45:16 pm »
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: https://github.com/sibghatcodez/-VCMP-ClanSystemTo 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. World SystemHello 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 https://github.com/sibghatcodez/-VCMP-Snippets/blob/main/World%20System.nutImportant 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
2
« on: July 18, 2021, 09:34:57 am »
NOGOTO SYSTEM BY GITOClassClass PlayerStats{ nogoto = false; } Databasefunction onScriptLoad() { nogoto <- ConnectSQL("Nogoto.db"); QuerySQL(nogoto, "create table if not exists nogoto ( Name Text ,nogoto TEXT) "); } Database Closefunction onScriptUnload() { DisconnectSQL(nogoto); } Functionsfunction Nogoto(player) { local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + escapeSQLString(player.Name) + "'"); if (q) { stats[ player.ID ].nogoto = GetSQLColumnData( q, 1 ); } else QuerySQL( nogoto, "INSERT INTO nogoto ( Name, nogoto ) VALUES ( '" + escapeSQLString(player.Name) + "', ' false ' )" ); }
function Nogotodb(player) { QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'"); }
PlayerJoinfunction onPlayerJoin(player){ Nogoto(player); }
PlayerPartfunction onPlayerPart(player); { Nogotodb(player); } PlayerCommandfunction onPlayerCommand(player, cmd, text){ else if(cmd == "nogoto") { if(!text) MessagePlayer("[#ff0000]Error: [#ffffff]/" + cmd + " <on/off>", player); else { if(text == "on" || text == "1" || text == "set" || text == "true") { local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + player.Name + "'"); if (stats[player.ID].nogoto == true) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already on!",player); else if( q && GetSQLColumnData(q, 1) == "true" ) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already on!",player); else { stats[player.ID].nogoto = true; MessagePlayer("[#ffa447]Nogoto has been turned on, Now no one will be able to teleport to you.",player); QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'"); } } if(text == "off" || text == "0" || text == "del" || text == "false") { if (stats[player.ID].nogoto == false) MessagePlayer("[#ff0000]Error: [#ffffff]Nogoto is already off!",player); else { stats[player.ID].nogoto = false; MessagePlayer("[#ffa447]Nogoto has been turned off, Everyone will be able to teleport to you.",player); QuerySQL( nogoto, "UPDATE nogoto SET nogoto='"+ stats[ player.ID ].nogoto +"' WHERE Name = '"+player.Name+"'"); } } } return 0; } } Goto LinePut this on goto command local q = QuerySQL(nogoto, "SELECT * FROM nogoto WHERE Name = '" + plr.Name + "'"); if( q && GetSQLColumnData(q, 1) == "true" ) MessagePlayer("[#ff0000]Error: [#ffffff]Target player has his nogoto enabled!",player); else if (stats[plr.ID].nogoto == true) MessagePlayer("[#ff0000]Error: [#ffffff]Target player has his nogoto enabled!",player);
3
« on: July 11, 2021, 07:41:46 am »
Ban System (DURATION)
Creating Database [noae] DataBase <- ConnectSQL("Databases/BanSys.db"); QuerySQL(DataBase, "create table if not exists Bans ( Name TEXT, UID TEXT, UID2 TEXT, Admin TEXT, Reason TEXT, Time INTEGER, IP REAL)");
[/noae]
onPlayer Join [noae]CheckBan( player );
[/noae]
OnPlayer Command [noae]else if (cmd == "ban") { if (!stats[player.ID].Registered) return MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player); else if (!stats[player.ID].Logged) return MessagePlayer("[#FF0000]You're Not Logged in.", player); else if ( stats[ player.ID ].Level < 3 ) return MessagePlayer("[#FF0000]You don't have Authorization to to use this command.", player); else if ( !text ) PrivMessage( player, format( "Error: Use /%s <player> Days Hours Reason", cmd ) ); else { local plr = GetPlayer( GetTok( text, " ", 1 ) ); if ( plr ) { local d = GetTok( text, " ", 2 ), h = GetTok( text, " ", 3 ); local reason = GetTok( text, " ", 4 NumTok( text, " " ) ); if (!IsNum(d)) return MessagePlayer("[#FF0000]Error: Days Must be in integers.",player); else if (!IsNum(h)) return MessagePlayer("[#FF0000]Error: Hours Must be in integers.",player); else if (!reason) return MessagePlayer("[#FF0000]ERROR: Reason is Missing.",player); else if ( reason && d && h && IsNum( d ) && IsNum( h ) ) Ban( plr, player.Name, reason, d.tointeger(), h.tointeger() ); } else MessagePlayer("Invalid Player.",player); } return 0; }
else if (cmd == "unban") { if(stats[player.ID].Level < 3) MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player); else if (!text) MessagePlayer("Correct syntax - /"+cmd+" Full player name",player); else { DelBan( player.Name, text ); Message("[#ffffff]"+player.Name + "[#25A5F9] has unbanned[#ffffff] ( " + text + " ) "); } return 0; }
[/noae]
Functions [noae] function Ban( player, admin, reason, d, h ) { local name = player.Name.tolower(), Time = time() + d * 86400 + h * 3600; QuerySQL( DataBase, "INSERT INTO Bans ( Name, UID, UID2, Admin, Reason, Time, IP ) VALUES ( '" + name + "', '" + player.UniqueID + "', '" + player.UniqueID2 + "', '" + admin + "', '" + reason + "', '" + Time.tointeger() + "', '" + player.IP + "')" ); Message( admin + " banned " + name + ", reason:[ " + reason + " ] time: [ " + d + " days, " + h + " hours ]." ); KickPlayer( player ); } function GetLastDay( t1, t2 ) { local time = t2 - t1, min = ( time / 60 ).tointeger(), week = 0, hour = 0, day = 0; while( min >= 60 ) { hour += 1; min -= 60; } while( hour >= 24 ) { day += 1; hour -= 24; } while( day >= 7 ) { week += 1; day -= 7; } return ( week == 0 ? day + " days " + hour + " hours " + min + " minutes" : week + " weeks " + day + " days" ); } function CheckBan( plr ) { local q = QuerySQL( DataBase, "SELECT * FROM Bans WHERE UID='" + plr.UniqueID + "'" ), q2, q3; if ( q ) { local time1 = GetSQLColumnData( q, 5 ).tointeger(); if ( time1 && time() >= time1 ) { QuerySQL( DataBase, "DELETE FROM Bans WHERE UID='" + plr.UniqueID + "'" ); FreeSQLQuery(q); return false; } local admin = GetSQLColumnData( q, 3 ), reason = GetSQLColumnData( q, 4 ), relname = GetSQLColumnData( q, 0 ); Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." ); KickPlayer( plr ); FreeSQLQuery( q ); return true; } else { q2 = QuerySQL( DataBase, "SELECT * FROM Bans WHERE IP='" + plr.IP + "'" ); if ( q2 ) { local time1 = GetSQLColumnData( q2, 5 ).tointeger(); if ( time1 && time() >= time1 ) { QuerySQL( DataBase, "DELETE FROM Bans WHERE IP='" + plr.IP + "'" ); FreeSQLQuery(q2); return false; } local admin = GetSQLColumnData( q2, 3 ), reason = GetSQLColumnData( q2, 4 ), relname = GetSQLColumnData( q2, 0 ); Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." ); KickPlayer( plr ); FreeSQLQuery( q2 ); return true; } else { q3 = QuerySQL( DataBase, "SELECT * FROM Bans WHERE LOWER(Name)='" + plr.Name.tolower() + "'" ); if ( q3 ) { local time1 = GetSQLColumnData( q3, 5 ).tointeger(); if ( time1 && time() >= time1 ) { QuerySQL( DataBase, "DELETE FROM Bans WHERE LOWER(Name)='" + plr.Name + "'" ); FreeSQLQuery(q3); return false; } local admin = GetSQLColumnData( q3, 3 ), reason = GetSQLColumnData( q3, 4 ), relname = GetSQLColumnData( q3, 0 ); Message( "Player-Banned [ " + plr.Name + " ], Admin:[ " + admin + " ], Reason:[ " + reason + " ], Time Left:[ " + GetLastDay( time(), time1 ) + " ]." ); KickPlayer( plr ); FreeSQLQuery( q3 ); return true; } } } try { FreeSQLQuery( q ); if ( q2 ) FreeSQLQuery( q2 ); if ( q3 ) FreeSQLQuery( q3 ); } catch(e) return false; }
function DelBan( admin, banned ) { QuerySQL( DataBase, "DELETE FROM Bans WHERE Name='" + banned.tolower() + "'" ); Message( "done." ); }
[/noae]
4
« on: July 11, 2021, 07:30:47 am »
----------///---LEVEL SYSTEM---\\\----------
Player Class
class PlayerClass { Level = 0; }
Creating Database
Admin <- ConnectSQL("Level.db"); QuerySQL(Admin, "create table if not exists Level ( Name Text ,Level NUMERIC DEFAULT 0) ");
Functions
function AdminInfo(player) { local q = QuerySQL(Admin, "SELECT * FROM Level WHERE Name = '" + escapeSQLString(player.Name) + "'"); if (q) { stats[ player.ID ].Level = GetSQLColumnData(q, 1); } else QuerySQL( Admin, "INSERT INTO Level ( Name, Level ) VALUES ( '" + escapeSQLString(player.Name) + "', ' 0 ' )" ); }
function SaveAdmin(player) { QuerySQL( Admin, "UPDATE Level SET Level='"+ stats[ player.ID ].Level +"' WHERE Name = '"+player.Name+"'"); }
OnPlayer Join
AdminInfo();
OnPlayer Part
SaveAdmin();
Set Level Command
else if ( ( cmd == "setlevel" ) || ( cmd == "setlvl" ) ) { if ( stats[ player.ID ].Level < 5 ) MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player); else if ( !text ) PrivMessage( player, format( "Error: Use /%s <player> <Level>", cmd ) ); else { local txt = split( text, " " ); if ( txt.len() >= 2 ) { local plr = FindPlayer( txt[ 0 ] ), lvl = txt[ 1 ]; if ( !plr ) PrivMessage( player, "Error: Unknown player." ); else if ( !IsNum( lvl ) ) ClientMessage( player, "Error: Level must be in numbers...",player, 255, 0, 0 ); else if ( ( lvl.tointeger() < 1 ) || ( lvl.tointeger() > 7 ) ) ClientMessage( "ERROR: Allowed Level amount are between 1 and 7.", player, 255, 0, 0 ); else if ( stats[ plr.ID ].Level == lvl.tointeger() ) PrivMessage( player, format( "Error: %s's Level is %d already.", plr.Name, lvl.tointeger() ) ); else { stats[ plr.ID ].Level = lvl.tointeger(); Message( "[#ffffff]"+player.Name+" [#25AAAA]changed the level of[#ffffff] "+plr.Name+"[#25AAAA] to [#ffffff]["+lvl.tointeger()+"]."); } } else PrivMessage( player, format( "Error: Usage /%s <player> <Level>", cmd ) ); } return 0; }
Example command
else if ( cmd=="assrocket") { if(stats[player.ID].Level < 2) return MessagePlayer("[#ff0000]Error: [#ffffff]You don't have permission to use this command.",player); else { if (!text) MessagePlayer("[#51FF06]Usage :[#FFFFFF] /assrocket <Name/ID>",player); else { local plr = FindPlayer(text); plr.Pos = player.Pos; Message("[#ffffff]"+player.Name+ "[#25AAAA] has bombed [#ffffff]" +plr.Name); CreateExplosion( 1, 1,plr.Pos.x -3 , plr.Pos.y -5, plr.Pos.z, -1, true ); CreateExplosion( 1, 2,plr.Pos.x -3, plr.Pos.y -5, plr.Pos.z, -1, true ); CreateExplosion( 1, 3,plr.Pos.x -3, plr.Pos.y -5, plr.Pos.z, -1, true ); CreateExplosion( 1, 4,plr.Pos.x -3 , plr.Pos.y -5, plr.Pos.z, -1, true ); } } return 0; }
5
« on: March 15, 2021, 05:41:35 pm »
Like n subscribe please guys!
Pages: [1]
|