FinchDon

  • Sr. Member
  • Posts: 252
Random Numbers
« on September 28th, 2015, 04:18 PM »
Hello I just make a Snippet It is Easy But it will be liked by Newbies Because they don't know much about random

First Put this on ScriptLoad

Code: [Select]
tf <- [ "true", "false"];
password <- [ "mypass", "pass", "~", "password", "server", "editor", "@"];
weather <- [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ];
servername <- [ "VCCNR", "HP", "FBK's", "VU", "DM", "FF"];
maxplayers <- [ 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 67, 77, 70, 100, 90, 80 ];
timerate <- [ 1000, 2000, 5000, 10000, 0, 1, 100000, 50000];
gm <- [ "v1.0", "VCCNR v1.2", "LW C++++ 1.2", "DM v2.0"];

Now Some Functions
Code: [Select]
function GetLevel( player )
{
   local lvl1 =  GetSQLColumnData( QuerySQL( sqliteDB, "SELECT Level FROM Accounts WHERE Name='" + player.Name+"'" ), 0 );
   if ( lvl1 ) return lvl1;
   else return 0;
}

Commands

Code: [Select]
if ( cmd == "commands")
{
PrivMessage( player, "Admin Commands");
PrivMessage( player, "timerate, friendlyfire, stuntbike, maxplayers, servername, setweather, stuntbike, serverpass, gamemode" );
}
else if (cmd == "timerate")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetTimeRate(timerate[rand()% timerate.len()]);
Message( " " + player.Name + " set Time Rate : " + timerate[rand()% timerate.len()] + ".");
}
}
if ( cmd == "friendlyfire")
{
local ff = rand() % 2;
if ( GetLevel( player ) < 2 ) PrivMessage(player,"No!")
else if ( ff == 1 )
{
SetFriendlyFire(true)
Message(player.Name+" has set friendly fire true!");
}
else if ( ff == 2 )
{
SetFriendlyFire(false)
Message(player.Name+" has set friendly fire false!");
}
}
if ( cmd == "stuntbike")
{
local ff = rand() % 2;
if ( GetLevel( player ) < 2 ) PrivMessage(player,"No!")
else if ( ff == 1 )
{
SetStuntBike(true)
Message(player.Name+" has set Stunt Bike true!");
}
else if ( ff == 2 )
{
SetStuntBike(false)
Message(player.Name+" has set Stunt Bike false!");
}
}
else if (cmd == "setweather")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetWeather(weather[rand()% weather.len()]);
Message( " " + player.Name + " set Weather : " + weather[rand()% weather.len()] + ".");
}
}
else if (cmd == "maxplayers")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetMaxPlayers(maxplayers[rand()% maxplayers.len()]);
Message( " " + player.Name + " set Max Players : " + maxplayers[rand()% maxplayers.len()] + ".");
}
}
else if (cmd == "serverpass")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetPassword(password[rand()% password.len()]);
Message( " " + player.Name + " set Server Pass : " + password[rand()% password.len()] + ".");
}
}
else if (cmd == "servername")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetServerName(servername[rand()% servername.len()]);
Message( " " + player.Name + " set Server Name : " + servername[rand()% servername.len()] + ".");
}
}
else if (cmd == "gamemode")
{
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
SetGameModeName(gm[rand()% gm.len()]);
Message( " " + player.Name + " set Server Game Mode: " + gm[rand()% gm.len()] + ".");
}
}

Creator:FinchDon
Helper: Beztone Help in FriendlyFire

Here you go..
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

DizzasTeR

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,153

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809
Re: Random Numbers
« Reply #2, on September 28th, 2015, 05:04 PM »
I will request to @Stormeus to remove this topic before newbies explode their scripts by using @FinchDon's broken codes

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

KAKAN

  • Wiki Contributor
  • Posts: 3,343
Re: Random Numbers
« Reply #3, on September 28th, 2015, 05:15 PM »
What if a player uses FAS?
What shall he use? An array or an broken query?
This script can lag your server, random server name gens? lol, why will anyone need it? Server having a random name or having a unique name is better?
You can contact me using Discord, at Developers.CPP( check off-board to find the invite link )
Github: https://github.com/theKAKAN

Thijn

  • VC:MP Beta Tester
  • Posts: 1,688
Re: Random Numbers
« Reply #4, on September 28th, 2015, 05:44 PM »
Locked. Useless and the topic starter is banned so wont be fixed.