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

Topics - gamingpro

#1
Script Showroom / Temp ban system (gamingpro)
Jul 17, 2023, 12:42 AM
Hey guys 8) , i maded this tempban system, i love to share all things i maded it to others, for help  :) ,
Now this is the code:



Add that line in onScriptLoad function

TempBans <- ConnectSQL("TempBans.db");
QuerySQL(TempBans, "CREATE TABLE IF NOT EXISTS TempBans(Name TEXT, UID TEXT, UID2 TEXT, IP FLOAT, Admin TEXT, Reason TEXT, Time INTEGER, NowTime INTEGER)");


Add this line in onPlayerJoin function

CheckTempBan( player );


Add this line in onPlayerCommand Function

if( cmd == "tempban" )
{
if(!text) MessagePlayer("Error - use /"+cmd+" <Player/ID> [Days:Hours:Minutes] <Reason>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1));local expire = GetTok(text, " ",2);local reason = GetTok(text, " ",3 NumTok(text, " "));local ban_expire = split(expire, ":");
if(!plr) MessagePlayer("Unknow player!",player);
else if(!expire) MessagePlayer("Error - Please write expire time format DAYS:HOURS:MINUTES and should numbers!",player);
else if(NumTok(expire, ":") != 3) MessagePlayer("Error - Invalid format, The format must be DAYS:HOURS:MINUTES!",player);
else if(IsNum(ban_expire[0]) && IsNum(ban_expire[1]) && IsNum(ban_expire[2]))
{
if(!reason) reason = "None";
local calc = (time()+ban_expire[0].tointeger()*24*60*60 + ban_expire[1].tointeger()*60*60 + ban_expire[2].tointeger()*60);
QuerySQL(TempBans, "INSERT INTO TempBans(Name, UID, UID2, IP, Admin, Reason, Time, NowTime) VALUES('"+plr.Name.tolower()+"', '"+plr.UniqueID+"', '"+plr.UniqueID2+"', '"+plr.IP.tofloat()+"', '"+player.Name+"', '"+reason+"', '"+calc+"', '"+time()+"')");
Message("[#FF0000]Admin:[ "+player.Name+" ] banned:[ "+plr.Name+" ] Reason:[ "+reason+" ] Time:[ "+GetRemainingTime(calc,time())+" ]");
plr.Kick();
}
else MessagePlayer("Error - Format must be integer!",player);
}
}
else if( cmd == "untempban" )
{
if(!text) MessagePlayer("Error - Syntax; /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE Name='"+text.tolower()+"'");
if(!q) MessagePlayer("Error - "+text+" is not tempbanned!.",player);
else {
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+text.tolower()+"'");
MessagePlayer("[#00FF00][SUCCESS]: [#FFFFFF]"+text+" has been untempbanned!.",player);
}
}
}



Functions

function CheckTempBan(plr)
{
local q = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
if(q){
local admin = GetSQLColumnData(q,4), reason = GetSQLColumnData(q,5),t = GetSQLColumnData(q,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(q);
}
}
else {
local uid = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE UID='"+plr.UniqueID+"'");
if(uid){
local admin = GetSQLColumnData(uid,4), reason = GetSQLColumnData(uid,5),t = GetSQLColumnData(uid,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(uid);
}
}
else {
local uid2 = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE UID2='"+plr.UniqueID2+"'");
if(uid2){
local admin = GetSQLColumnData(uid2,4), reason = GetSQLColumnData(uid2,5),t = GetSQLColumnData(uid2,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(uid2);
}
}
else {
local ip = QuerySQL(TempBans, "SELECT * FROM TempBans WHERE IP='"+plr.IP.tofloat()+"'");
if(ip){
local admin = GetSQLColumnData(ip,4), reason = GetSQLColumnData(ip,5),t = GetSQLColumnData(ip,6);
if(time() >= t){
QuerySQL(TempBans, "DELETE FROM TempBans WHERE Name='"+plr.Name.tolower()+"'");
}
else {
Message("[#FF0000]"+plr.Name+" Banned from the server Reason:[ "+reason+" ] Admin:[ "+admin+" ], Time Left:[ "+GetRemainingTime(t.tointeger(),time().tointeger())+" ]");
plr.Kick();
FreeSQLQuery(ip);
}
}
}
}
}
}
function GetRemainingTime(basict, oldt)
{
    local time = basict-oldt, min = ( time / 60 ).tointeger();
    local year = 0, month = 0, week = 0, day = 0, hour = 0;
    local total_time = "";
    while(min >= 60){hour++;min-=60;}
    while(hour >= 24){day++;hour-=24;}
    while(day >= 7){week++;day-=7;}
    while(week >= 5){month++;week-=5;}
    while(month >= 12){year++;month-=12;}
    if(year > 0){if(total_time != "")total_time += year+" year(s), ";else total_time = year+" year(s) ";}
    if(month > 0){if(total_time != "") total_time += month+" month(s), ";else total_time = month+" month(s) ";}
    if(week > 0){if(total_time != "")total_time += week+" week(s), ";else total_time = week+" week(s) ";}
    if(day > 0){if(total_time != "")total_time += day+" day(s), ";else total_time = day+" day(s) ";}
    if(hour > 0){if(total_time != "")total_time += hour+" hour(s), ";else total_time = hour+" hour(s) ";}
    if(min > 0){if(total_time != "")total_time += min+" minute(s)"; else total_time = min+" minute(s) ";}
    if(year == 0 && month == 0 && week == 0 && day == 0 && hour == 0 && min == 0) total_time = "Some seconds and will unban";
    return total_time;
}
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();
}
function GetPlayer( target )
{
 local target1 = target.tostring();

 if ( IsNum( target ) )
 {
  target = target.tointeger();

  if ( FindPlayer( target) ) return FindPlayer( target );
  else return null;
 }
 else if ( FindPlayer( target ) ) return FindPlayer( target );
 else return null;
}
#2
Hello guys to day i maded this ban system And Have baninfo cmd for Yours Guys and i hopy for yours install it in your script and in near day(s) i'll mading Gang system :), ok let me made it for yours


Add That in onScriptLoad() Function
[noae]
Bans <- ConnectSQL("Bans.db");
QuerySQL(Bans, "CREATE TABLE IF NOT EXISTS Bans(player TEXT, Admin TEXT, Reason TEXT, UID TEXT, UID2 TEXT, IP FLOAT)");
print("Basic ban system has been loaded successfully by gamingpro...");
[/noae]
But that line add it in onScriptUnload Function
[noae]
DisconnectSQL( Bans );
[/noae]
Add that in onPlayerJoin function to check player banned or not!
[noae]
CheckBan( player ); // Check if player banned or Not.
[/noae]
Add that in onPlayerCommand Function
[noae]
if(cmd == "ban"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Player> <Reason>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1)),
Reason = GetTok(text, " ",2 NumTok(text, " "));
if(!plr) MessagePlayer("[#FF0000]Error: [#FFFFFF]Unknow Player...",player);
else {
if(!Reason) Reason = "No_Reason"; // here if the admin not giving reason return to No_Reason.
Ban( plr, player.Name, Reason );
}
}
else if(cmd == "unban"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct syntax /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+text.tolower()+"'");
if(!q) MessagePlayer("[#FF0000]"+text+" is Not banned yet...",player);
else {
QuerySQL(Bans, "DELETE FROM Bans WHERE player='"+text.tolower()+"'");
ClientMessage("Adminstrator:[ "+player.Name+" ] Unbanned:[ "+text+" ]",player,0,255,0);
}
}
}
else if(cmd == "baninfo"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct syntax /"+cmd+" <Full-Nick>",player);
else {
local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+text.tolower()+"'");
if(!q) MessagePlayer("[#FF0000]"+text+" is Not banned yet...",player);
else {
MessagePlayer("[#00FF00][BAN INFO]: [#FFFFFF]"+text+" Banned Reason:[ "+GetSQLColumnData(q,2)+" ], Admin:[ "+GetSQLColumnData(q,1)+" ]",player);
FreeSQLQuery(q);
}
}
}
}
[/noae]



Functions

[noae]
function Ban( banned, admin, reason ){
               local nick = banned.Name.tolower();
QuerySQL(Bans, "INSERT INTO Bans(player, Admin, Reason, UID, UID2, IP) VALUES('"+nick+"', '"+admin+"', '"+reason+"', '"+banned.UniqueID+"', '"+banned.UniqueID2+"', '"+banned.IP+"')");
Message("[#db0000]Adminstrator:[#FFFFFF][ "+admin+" ] [#db0000]Banned:[#FFFFFF][ "+banned.Name+" ] [#db0000]For Reason: [#FFFFFF]"+reason);
banned.Kick(); // kicking player.
}

function CheckBan( plr ){
   local q = QuerySQL(Bans, "SELECT * FROM Bans WHERE player='"+plr.Name.tolower()+"'");
if(q){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(q,2)+" ] Admin:[ "+GetSQLColumnData(q,1)+" ].");
plr.Kick();
}
else {
local q2 = QuerySQL(Bans, "SELECT * FROM Bans WHERE UID='"+plr.UniqueID+"'");
if(q2){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(q2,2)+" ], Admin:[ "+GetSQLColumnData(q2,1)+" ].");
plr.Kick();
}
else {
local uid2 = QuerySQL(Bans, "SELECT * FROM Bans WHERE UID2='"+plr.UniqueID2+"'");
if(uid2){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(uid2,2)+" ], Admin:[ "+GetSQLColumnData(uid2,1)+" ].");
plr.Kick();
}
else {
local ip = QuerySQL(Bans, "SELECT * FROM Bans WHERE IP='"+plr.IP+"'");
if(ip){
Message("[#FF0000]"+plr.Name+" Banned Reason:[ "+GetSQLColumnData(ip,2)+" ], Admin:[ "+GetSQLColumnData(ip,1)+" ].");
plr.Kick();
}
}
}
}
                   try
                   {
                     FreeSQLQuery(q);
                   if(q2) FreeSQLQuery(q2);
                   if(uid2) FreeSQLQuery(uid2);
                   if(ip) FreeSQLQuery(ip);
}
                  catch(e)
                    return false;
}


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();
}
function GetPlayer( target )
{
 local target1 = target.tostring();

 if ( IsNum( target ) )
 {
  target = target.tointeger();

  if ( FindPlayer( target) ) return FindPlayer( target );
  else return null;
 }
 else if ( FindPlayer( target ) ) return FindPlayer( target );
 else return null;
}
[/noae]
#3
Script Showroom / Report system
Mar 28, 2023, 10:50 PM
function onScriptLoad()
[noae]
rp <- ConnectSQL("Reports.db");
QuerySQL(rp, "CREATE TABLE IF NOT EXISTS Report( plr TEXT, player TEXT, Reason TEXT)");
print("report system has been loaded successfully by gamingpro...");
[/noae]
function onScriptUnload()
[noae]
DisconnectSQL( rp );
[/noae]
function onPlayerCommand( player, command, text )
[noae]
local cmd;
cmd = command.tolower();
if(cmd == "report"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Player> <Reason>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1));
local reason = GetTok(text, " ",2 NumTok(text, " "));
if(!plr) MessagePlayer("[#FF0000]Error: [#FFFFFF]Unknow player...",player);
else if(plr.Name == player.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You can't report your self!.",player);
else {
if(!reason) reason = "No_Reason";
QuerySQL(rp, "INSERT INTO Report(plr,player,Reason) VALUES('"+plr.Name+"', '"+player.Name+"', '"+reason

+"')");
MessagePlayer("[#00FF00][REPORT]: [#FFFFFF]Thank you for your report admins now have notifed!.",player);
Message("[#00FF00][REPORT]: [#FFFFFF]"+player.Name+" Has reported:[ "+plr.Name+" ] For Reason: "+reason);
}
}
}
else if(cmd == "reportlist"){
local q = QuerySQL(rp, "SELECT * FROM Report"), i = 1;
if(!q) MessagePlayer("[#FFFFFF]No players currently have report!.",player);
else {
while( GetSQLColumnData(q,0) != null ){
MessagePlayer("[#00FF00][REPORT]: [#FFFFFF]Reporter:[ "+GetSQLColumnData(q,1)+" ], Suspected:[ "+GetSQLColumnData(q,0)+" ], Reason: "+GetSQLColumnData(q,2),player);
GetSQLNextRow(q);
i++;
}
}
}
[/noae]
if You have this functions don't add it again
[noae]
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();
}
function GetPlayer( target )
{
 local target1 = target.tostring();

 if ( IsNum( target ) )
 {
  target = target.tointeger();

  if ( FindPlayer( target) ) return FindPlayer( target );
  else return null;
 }
 else if ( FindPlayer( target ) ) return FindPlayer( target );
 else return null;
}
[/noae]
#4
function onScriptLoad()
[noae]
SpawnLoc <- ConnectSQL("Spawnloc.db");
QuerySQL(SpawnLoc, "CREATE TABLE IF NOT EXISTS Spawnloc(player TEXT, PX FLOAT, PY FLOAT, PZ FLOAT)");
print("Spawnloc system has been loaded successfully by gamingpro...");
[/noae]
function onPlayerSpawn( player )
[noae]
local q = QuerySQL(SpawnLoc, "SELECT * FROM Spawnloc WHERE player='"+player.Name+"'");
if(q){
local PX = GetSQLColumnData(q,1),
PY = GetSQLColumnData(q,2),
PZ = GetSQLColumnData(q,3);
MessagePlayer("[#00FF00][SPAWN LOC]: [#FFFFFF]You've spawned with your spawn location.",player);
player.Pos = Vector( PX.tofloat(), PY.tofloat(), PZ.tofloat() );
}
[/noae]
function onPlayerCommand( player, command, text )
[noae]
local cmd;
cmd = command.tolower();
if(cmd == "spawnloc"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <on/off>",player);
else {
if(text == "off"){
local q = QuerySQL(SpawnLoc, "SELECT * FROM Spawnloc WHERE player='"+player.Name+"'");
if(!q) MessagePlayer("[#FF0000]Error: [#FFFFFF]Your spawn location is already disabled.",player);
else {
QuerySQL(SpawnLoc, "DELETE FROM Spawnloc WHERE player='"+player.Name+"'");
MessagePlayer("[#00FF00][SPAWN LOC]: [#FFFFFF]You've successfully disabled your spawn location",player);
}
}
else if(text == "on"){
local q = QuerySQL(SpawnLoc, "SELECT * FROM Spawnloc WHERE player='"+player.Name+"'");
if(q) MessagePlayer("[#FF0000]Error: [#FFFFFF]Your spawn location is already enabled.",player);
else {
QuerySQL(SpawnLoc, "INSERT INTO Spawnloc(player, PX, PY, PZ) VALUES('"+player.Name+"', '"+player.Pos.x.tofloat()+"', '"+player.Pos.y.tofloat()+"', '"+player.Pos.z.tofloat()+"')");
MessagePlayer("[#00FF00][SPAWN LOC]: [#FFFFFF]Your spawn location has been enabled on!.",player);
}
}
else MessagePlayer("[#FF0000]Error: [#FFFFFF]Use /"+cmd+" <on/off>",player);
}
}
[/noae]
#5
Script Showroom / Spectating player system
Mar 28, 2023, 05:44 PM
class Spectating
{
isspectating = false;
}
function onScriptLoad(){
spec <- array(GetMaxPlayers(), null);
print("Spectating system has been loaded successfully by gamingpro.");
}
function onPlayerJoin( player ){
spec[player.ID] = Spectating();
}
function onPlayerCommand( player, command, text ){
local cmd;
cmd = command.tolower();
if(cmd == "spec"){
if(player.IsSpawned) ::MessagePlayer("[#FF0000]Error: [#FFFFFF]You must be not spawned before use this command.",player);
else {
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <player>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1));
if(!plr) ::MessagePlayer("[#FF0000]Error: [#FFFFFF]Unknow player...",player);
else if(plr.Name == player.Name) ::MessagePlayer("[#FF0000]Error: [#FFFFFF]You can't spectating your self!",player);
else if(!plr.IsSpawned) MessagePlayer("[#FF0000]Error: [#FFFFFF]This player isn't spawned yet...",player);
else if(spec[player.ID].isspectating) MessagePlayer("[#FF0000]Error: [#FFFFFF]You're already in spectate, if u want to leave spec use /exitspec",player);
else {
ClientMessage("You're spectating:[ "+plr.Name+" ] Now.",player,0,255,0);
player.SpectateTarget = plr;
spec[player.ID].isspectating = true;
}
}
}
}
else if(cmd == "exitspec"){
if(!spec[player.ID].isspectating) MessagePlayer("[#FF0000]You're not spectating yet...",player);
else {
MessagePlayer("[#00FF00]You've left the spectating.",player);
player.SpectateTarget = false;
}
}
}

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();
}
function GetPlayer( target )
{
 local target1 = target.tostring();

 if ( IsNum( target ) )
 {
  target = target.tointeger();

  if ( FindPlayer( target) ) return FindPlayer( target );
  else return null;
 }
 else if ( FindPlayer( target ) ) return FindPlayer( target );
 else return null;
}
#6
Script Showroom / Property script
Mar 27, 2023, 12:08 PM
Hi Guys i uploaded Property script, i hope for yours download this script maded by me no helper or Developer in this script



Add That line in onScriptLoad Function.
[noae]
props <- ConnectSQL("props.db");
QuerySQL(props, "CREATE TABLE IF NOT EXISTS prop(ID INTEGER, Price INTEGER, Name TEXT, Owner TEXT, Share TEXT, PX FLOAT, PY FLOAT, PZ FLOAT)");
print("Property System Loaded Succesfully By Gamingpro...");
print("Welcome To Property System....");
print("Maded By:[ gamingpro ]");
LoadProps();
[/noae]
Add this line in onPlayerJoin Function
[noae]
if(player.Name == "Vice-Government" || player.Name == "None"){
Message("[#FF0000]Auto-Kicked:[ "+player.Name+" ] Reason:[ Unauthorized Name. ]");
player.Kick();
}
[/noae]
Add that in onPlayerCommand Function
[noae]
if(cmd == "createprop"){
if(player.Name !="gamingpro") MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Have Access To Use This Command!",player); // Here You Can To Change This Name To Your Name!
else {
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Price> <Prop Name>",player);
else {
local price = GetTok(text, " ",1);
local pname=  GetTok(text, " ",2 NumTok(text, " "));
if(!IsNum(price)) MessagePlayer("[#FF0000]Error: [#FFFFFF]Price Must Be Integer.",player);
else if(!pname) MessagePlayer("[#FF0000]Error: [#FFFFFF]Please Write The Name of This Prop!.",player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE Name='"+escapeSQLString(pname)+"'");
if(q) MessagePlayer("[#FF0000]Error: [#FFFFFF]Name Already Exist",player);
else {
local proID = GetSQLColumnData(QuerySQL(props, "SELECT COUNT( * ) FROM prop"),0)+1;
QuerySQL(props, "INSERT INTO prop(ID, Price, Name, Owner, Share, PX, PY, PZ) VALUES('"+proID+"','"+price+"','"+pname+"','Vice-Government','None','"+player.Pos.x.tofloat()+"', '"+player.Pos.y.tofloat()+"','"+player.Pos.z.tofloat()+"')");
CreatePickup( 407, Vector(player.Pos.x.tofloat(), player.Pos.y.tofloat(), player.Pos.z.tofloat() ));
MessagePlayer("[#00ff00]pm >> Successfully Created Prop Name:[ "+pname+" ], ID:[ "+proID+" ], Saved in Database!",player);
}
}
}
}
}
else if(cmd == "buyprop"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Prop ID>",player);
else {
if(!IsNum(text)) MessagePlayer("[#FF0000]Error: [#FFFFFF]ID Must Be Integer.",player);
else if(text.tointeger() < 1 || text.tointeger() > GetPickupCount() ) MessagePlayer("[#FF0000]Error: [#FFFFFF]Invalid Prop ID, Total Props ID Are "+GetPickupCount(),player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+text+"'");
local owner = GetSQLColumnData(q,3);
local price = GetSQLColumnData(q,1);
if(owner != "Vice-Government") MessagePlayer("[#FF0000]Error: [#FFFFFF]This Property is Already Sold!",player);
else if(price > player.Cash) MessagePlayer("[#FF0000]Error: [#FFFFFF]Not Enought Money!",player);
else {
QuerySQL(props, "UPDATE prop SET Owner='"+player.Name+"' WHERE ID='"+text+"'");
MessagePlayer("[#00ff00]You've Bought This Property ID:[ "+text+" ]",player);
Announce("You Have Bought New Prop",player,3);
player.Cash -= price; // Here Add Your remove Cash Function!
}
}
}
}
else if(cmd == "sellprop"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Prop ID>",player);
else {
if(!IsNum(text)) MessagePlayer("[#FF0000]Error: [#FFFFFF]ID Must Be Integer.",player);
else if(text.tointeger() < 1 || text.tointeger() > GetPickupCount()) MessagePlayer("[#FF0000]Error: [#FFFFFF]Invalid Property ID, Total Props ID Are " + GetPickupCount(),player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+text+"'");
local owner = GetSQLColumnData(q,3);
local price = GetSQLColumnData(q,1);
if(owner != player.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Own This Property!",player);
else {
QuerySQL(props, "UPDATE prop SET Owner='Vice-Government', Share='None' WHERE ID='"+text+"'");
MessagePlayer("[#00ff00]pm >> You've Sold This Property ID: " + text,player);
player.Cash += price; // Here Add Your Remove Cash Function!.
Announce("Prop Sold",player,3);
}
}
}
}
else if(cmd == "myprops"){
local q = QuerySQL(props, "SELECT * FROM prop WHERE Owner='"+player.Name+"'"), i = 1;
if(!q) MessagePlayer("[#FFFFFF]You Don't Own Any Property",player);
else {
while( GetSQLColumnData(q,3) == player.Name ){
local id = GetSQLColumnData(q,0);
local name = GetSQLColumnData(q,2);
MessagePlayer("[#00ff00]ID:[ "+id+" ], Name:[ "+name+" ]",player);
GetSQLNextRow(q); i++;
}
}
}
else if(cmd == "mysharedprop" || cmd == "mysharedprops"){
local q = QuerySQL(props, "SELECT * FROM prop WHERE Share='"+player.Name+"'"), i = 1;
if(!q) MessagePlayer("[#FFFFFF]You Don't Own Any Shared Property",player);
else {
while( GetSQLColumnData(q,4) == player.Name ){
local id = GetSQLColumnData(q,0);
local name = GetSQLColumnData(q,2);
local owner = GetSQLColumnData(q,3);
MessagePlayer("[#00ff00]ID:[ "+id+" ], Name:[ "+Name+" ], Owner:[ "+owner+" ]",player);
GetSQLNextRow(q); i++;
}
}
}
else if(cmd == "propsforsale" || cmd == "propforsale" || cmd == "propertyforsalte"){
local q = QuerySQL(props, "SELECT * FROM prop WHERE Owner='Vice-Government'"), i = 1;
if(!q) MessagePlayer("[#FFFFFF]No Any Property For Sale",player);
else {
while( GetSQLColumnData(q,3) == "Vice-Government"){
local id = GetSQLColumnData(q,0);
local price = GetSQLColumnData(q,1);
local name = GetSQLColumnData(q,2);
MessagePlayer("[#00ff00]ID:[ "+id+" ], Price:[ "+price+" ], Name:[ "+name+" ]",player);
GetSQLNextRow(q); i++;
}
}
}
else if(cmd == "shareprop"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Player> <Prop ID>",player);
else {
local plr = GetPlayer(GetTok(text, " ",1));
local id = GetTok(text, " ",2);
if(!plr) MessagePlayer("[#FF0000]Error: [#FFFFFF]Unknow Player!",player);
else if(plr.Name==player.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You Can't Share This prop With Your Self!",player);
else if(!id) MessagePlayer("[#FF0000]Error: [#FFFFFF]Write Property ID You Want To Share it With Him",player);
else if(!IsNum(id)) MessagePlayer("[#FF0000]Error: [#FFFFFF]ID Must Be Integer.",player);
else if(id.tointeger() < 1 || id.tointeger() > GetPickupCount()) MessagePlayer("[#FF0000]Error: [#FFFFFF]Invalid Property ID, Total Props ID Are " + GetPickupCount(),player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+id+"'");
local share = GetSQLColumnData(q,4);
local owner = GetSQLColumnData(q,3);
if(owner != player.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Own This Property",player);
else if(share == plr.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You're Already Shared This Property With Him!.",player);
else {
QuerySQL(props, "UPDATE prop SET Share='"+plr.Name+"' WHERE ID='"+id+"'");
MessagePlayer("[#00ff00]pm >> You've Shared This Property ID:[ "+id+" ] With " + plr.Name,player);
MessagePlayer("[#00ff00]"+player.Name+" Has Shared Property ID:[ "+id+" ] With You",plr);
}
}
}
}
else if(cmd == "unshareprop"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Prop ID>",player);
else {
if(!IsNum(text)) MessagePlayer("[#FF0000]Error: [#FFFFFF]ID Must Be Integer.",player);
else if(text.tointeger() < 1 || text.tointeger() > GetPickupCount()) MessagePlayer("[#FF0000]Error: [#FFFFFF]Invalid Property ID, Total Props ID Are " + GetPickupCount(),player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+text+"'");
local owner = GetSQLColumnData(q,3);
local share = GetSQLColumnData(q,4);
if(owner != player.Name) MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Own This property!.",player);
else if(share == "None") MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Shared This Property With Any Player!.",player);
else {
QuerySQL(props, "UPDATE prop SET Share='None' WHERE ID='"+text+"'");
MessagePlayer("[#00ff00]pm >> You've Successfully Un-shared Property ID:[ "+text+" ]",player);
}
}
}
}
else if(cmd == "gotoprop"){
if(!text) MessagePlayer("[#FF0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Prop ID>",player);
else {
if(!IsNum(text)) MessagePlayer("[#FF0000]Error: [#FFFFFF]ID Must Be Integer.",player);
else if(text.tointeger() < 1 || text.tointeger() > GetPickupCount()) MessagePlayer("[#FF0000]Error: [#FFFFFF]Invalid Property ID, Total Props ID Are " + GetPickupCount(),player);
else {
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+text+"'");
local owner = GetSQLColumnData(q,3);
local share = GetSQLColumnData(q,4);
if(owner != player.Name && share == player.Name || share != player.Name && owner == player.Name){
local PX = GetSQLColumnData(q,5);
local PY = GetSQLColumnData(q,6);
local PZ = GetSQLColumnData(q,7);
player.Pos = Vector( PX.tofloat(), PY.tofloat(), PZ.tofloat() );
MessagePlayer("[#00ff00]Teleported To Property ID:[ "+text+" ]",player);
}
else {MessagePlayer("[#FF0000]Error: [#FFFFFF]You Don't Own This Property",player);}
}
}
}
else if(cmd == "cmds" || cmd == "commands"){
MessagePlayer("[#00ff00]pm >> Property System Commands is: buyprop, sellprop, shareprop, unshareprop, myprops, mysharedprops, createprop ( For Admins ), gotoprop, propsforsale",player);
}
[/noae]
Add that line in onPickupPickedUp Function
[noae]
if(pickup.Model == 407){
local id = pickup.ID+1;
local q = QuerySQL(props, "SELECT * FROM prop WHERE ID='"+id+"'");
if(GetSQLColumnData(q,0) != null){
local owner = GetSQLColumnData(q,3),
price = GetSQLColumnData(q,1),
name = GetSQLColumnData(q,2),
share = GetSQLColumnData(q,4);
MessagePlayer("[#00ff00]ID:[ "+id+" ] Owner:[ "+owner+" ] Price:[ "+price+" ] Name:[ "+name+" ] Share:[ "+share+" ]",player);
pickup.RespawnTime = 3000;
}
}
else return;
[/noae]




Functions
[noae]
function LoadProps(){
local q = QuerySQL(props, "SELECT * FROM prop"), i = 0;
while( GetSQLColumnData(q,0) ){
local PX = GetSQLColumnData(q,5),
PY = GetSQLColumnData(q,6),
PZ = GetSQLColumnData(q,7);
CreatePickup( 407, Vector(PX.tofloat(), PY.tofloat(), PZ.tofloat() ));
GetSQLNextRow(q); i++;
}
print("Props Loaded: "+i+"");
}

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();
}
function GetPlayer( target )
{
 local target1 = target.tostring();

 if ( IsNum( target ) )
 {
  target = target.tointeger();

  if ( FindPlayer( target) ) return FindPlayer( target );
  else return null;
 }
 else if ( FindPlayer( target ) ) return FindPlayer( target );
 else return null;
}
[/noae]
#7
Script Showroom / Ban System
Jan 28, 2023, 11:35 PM
function onPlayerCommand( player, cmd, text){
if(cmd == "ban"){
if(!text) return MessagePlayer("[#ff0000]Error: [#FFFFFF]Correct Syntax /"+cmd+" <Player> <Reason>",player);
else {
local params = split(text, " "), plr = FindPlayer(params[0]), reason = text.slice(params[0].len() + 1);
if(!plr) MessagePlayer("[#ff0000]Error: [#ffffff]Unknow Player...",player);
else if(plr.Name==player.Name) MessagePlayer("[#ff0000]Error: [#FFFFFF]You Cannot Ban Your Self!",player);
else {
Message("[#ff0000]Admin:[ "+player.Name+" ] banned:[ "+plr.Name+" ] Reason:[ "+reason+" ]");
plr.Ban();
}
}
}
}