View Single Post
Plugin Info:     Modification:          Category:          Approver:   v3x (159)
Des12
Senior Member
Join Date: Jan 2005
Old 03-03-2006 , 20:18   Random Number/Player + Command
Reply With Quote #1

Plugin:
Random Number/Player + Command

Games/Mods:
Tested and working on The Specialists, but also should work for any half-life based game.

Extra Modules Required:
None

Purpose:
This plugin was created so that admins could generate random numbers with messages and commands attached. It just fills a gap in certain situations in which you randomly need to choose someone without bias suspected. (Such as who to kick for your friend to get in, but be moral and ignore your friend! Just to amx_randomplayer public "Random player to be kicked for friend to get in:" "amx_kick")

Commands:
amx_randomnumber <public, private, player, admins> <min> <max> [statement] [command]
The first part of the command is who the random number will print to:
Public means everyone.
Private means only yourself.
Player means it will print to you and a player.
Admins meants it will print to all admins.

Min is the minimum number for the random number.
Max is the maximum number for the random number.

Statement is what the plugin will display, such as "This is how much karma I have:"
Command is what the server will execute, such as "say"

amx_randomplayer <public, private, player, admins> [statement] [command]
The first part of the command is who the random number will print to:
Public means everyone.
Private means only yourself.
Player means it will print to you and a player.
Admins meants it will print to all admins.

Statement is what the plugin will display, such as "Here is the leetest player in the server:"
Command is what the server will execute, such as "amx_heal"

See examples of usage below.

Other:
1) When an admin enteres a random command, it says
[Random] ADMIN (name) initialized the Random Generator!
(or just "[Random] An admin initialized the Random Generator!" if you have amx show activity on a low level)

2) Including a command in the random requires a different admin level then having no command (since they could restart/shut down server). Defaults are:
With Command: Admin Rcon
Without Command: Admin Ban

3) Two cvars are included in the .cfg file:
If you want the admin who entered the command to be excluded from amx_randomplayer:
"random_selfimmune" "1"

If you want all the admins to be excluded from amx_randomplayer:
"random_adminsimmune" "1"

amx_randomnumber Examples

amx_randomnumber public 1 10 "The user choosen is:"
[Random] Public: The user chosen is: 3
(This prints to everyone since it is public)

amx_randomnumber private 5 6 "My IQ iz"
[Random] Private: My IQ iz 5
(This prints to only you since it is private)

amx_randomnumber dest 1 2 "You live = 1, You die = 2. Number:"
[Random] User-to-User: You live = 1, You die = 2. Number: 2
(This prints to Dest and you since you specified dest)

amx_randomnumber admins 1 10 "Lets make the server say" "say"
[Random] Admins: Lets make the server say 3
Dest's Server: 3
(This prints to all admins and makes the server say the random number)


amx_randomplayer Examples

amx_randomplayer public "I have chosen to be nice to:" "amx_heal"
[Random] Public: I have chosen to be nice to: Dest Romano
Dest's Server: Healed player Dest Romano

amx_randomplayer admins "This player is DOOMED:" "amx_slay"
[Random] This player is DOOMED: Dest Romano
Dest's Server: Slayed player Dest Romano

Credits:
Dest 'Des12' Romano - Coding the plugin
Attached Files
File Type: sma Get Plugin or Get Source (random.sma - 1798 views - 6.2 KB)
File Type: zip random.zip (12.9 KB, 365 views)
File Type: zip random.zip (12.1 KB, 283 views)
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline