View Single Post
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 03-13-2007 , 12:41   [26/7/07] Source Utils v1.6
Reply With Quote #1

SouceUtils:

This is my 1º plugin (c++), is small for now but i have some plans for the future.
SourceUtils work in all Source games win32/linux.
This is ONLY Utils.




############################################# ###############################
########################Source Utils Commands###############################
############################################# ###############################


su_Mysql

su_MySQL <ServerIP> <Port | 3306 = Default Port> <UserName> <Password | "" = No Password> <"DataBase | "" = No db Command"> <"Cmd"> [Var]

eg. su_mysql localhost 3306 root mypass "" "SELECT CURTIME()" time

NOTE: 'Var' is only for store a stat from one db using "SELECT" String


su_MySQLCreate

su_MySQLCreate <Connection Name> <Access Password> <ServerIP> <Port | 3306 = Default Port> <UserName> <Password | "" = No Password>

eg. su_mysqlcreate myconn myconnpass localhost 3306 root ""

NOTE: <Access Password> Is used for Edit|Delete|Use|Debug Yours Fast Connections


su_MySQLDelete

su_MySQLDelete <Connection Name> <Access Password>

eg. su_mysqldelete myconn myconnpass = Will Delete Your Connection
eg. su_mysqldelete myconn myfalseconnpass = "SU: Incorrect Access Password 'myfalseconnpass' For Connection 'myconn'!."
eg. su_mysqldelete myfalseconn myfalseconnpass = "SU: Connection 'myfalseconn' No Exists!. Use 'su_MySQLCreate"


su_MySQLEdit

su_MySQLEdit <Connection Name> <Actual Access Password> <New Access Password> <ServerIP> <Port | 3306 = Default Port> <UserName> <Password | "" = No Password>
Use 'NULL' To Stay The Old Param

eg. su_mysqledit myconn myconnpass mynewconnpass NULL NULL NULL NULL
eg. su_mysqledit myconn myconnpass NULL NULL NULL newuser userpass


su_MySQLInfo

su_MySQLInfo <Connection Name> <Access Password> [Var]

eg. su_mysqlinfo myconn myconnpass
eg. su_mysqlinfo myconn myconnpass su_temp_get

Code:
*************************************************
Info:
(null) = Empty "" Argument On Param
 
Source Utils Fast Mysql Connection Info:
Connection Name: myconn
Access Password: myconnpass
 
Source Utils Fast Mysql Connection Data:
Ip: localhost
Port: 3306
Username: root
Password: (null)

*************************************************
su_temp_get = "myconn myconnpass || localhost 3306 root (null)"


su_MySQLFast

su_MySQLFast <Connection Name> <Access Password> <"DataBase | "" = No db Command"> <"Cmd"> [Var]

eg. su_mysqlfast myconn myconnpass "" "DROP DATABASE IF EXISTS `su_test`;CREATE DATABASE `su_test`"


su_AddDownload


su_AddDownload <path/filename.***>

eg. su_AddDownload sound/sn4k3/mymp3.mp3


su_GetExists

su_GetExists <Action> <Name> <Var>
<Action = (file | directory | userid | cvar | pause | mysqlfastconn | externalsrc | cmdtarget | mute | profile | mapent)>

eg. su_GetExists file cfg/server.cfg su_temp_get = will return 1
eg. su_GetExists directory addons su_temp_get = probaly return 1
eg. su_GetExists userid 10 su_temp_get
eg. su_GetExists cvar mycvar su_temp_get = return 0 if cvar not exists
eg. su_GetExists pause something su_temp_get = return 0 if not paused
eg. su_GetExists mysqlfastconn my_conn_name su_temp_get = return 0 if mysqlfastconn not exists/created
eg. su_GetExists externalsrc my_externalsrc_alias_name su_temp_get = return 0 if the externalsrc not exists/created
eg. su_GetExists cmdtarget -tickrate su_temp_get = return 0 if not exists that parm in cmdtarget
eg. su_GetExists mute userid su_temp_get = return 0 if not muted
eg. su_GetExists profile profile_name su_temp_get = return 0 if profile name not exists/created
eg. su_GetExists mapent buy_zone su_temp_get = return 0 if not exits that entity in map

su_Precache

su_Precache <sound | model> <path/filename> [Var]

eg. su_Precache model models/zombies/newzombie.mdl
eg. su_Precache model materials/zombies/newzombie.vtf (not need)
eg. su_Precache sound mp3/mymp3.mp3/wav su_temp_get

NOTE: [Var] = Return With Precached index

su_GetVersion

su_GetVersion <Host> <Port (80)> <Var>

eg. su_GetVersion mattie.info 80 su_temp_get = Will Return A Version Of ES
eg. es_msg Eventscripts Version: server_var(su_temp_get)
eg. return in chat == Eventscripts Version: 1.3.0.006


Good for know if plugin/script is outdate.


NOTE: You Need Put One File In Host With Name 'version.txt' After Put Version In 1º
Line eg. 1.0.5.0 After Save File And Send To FTP


su_Rand

su_Rand <Minimum> <Maximum> <Var>

eg. su_Rand 1 100 su_temp_get = rand a number between 1 and 100


su_CVarForceSet

su_CVarForceSet <Var> <Value> <Silence Set>
<Silence Set> = Dont Advert Var Change In Chat

eg. su_CVarForceSet sv_cheats 1 0 = will change sv_cheats to 1 and advert change in chat
eg. su_CVarForceSet sv_cheats 1 1 = will change sv_cheats to 1 and no change advert in chat

NOTE: Change only advert in chat if cvar is REPLICATED


EndRound:

su_EndRound

eg. su_EndRound = Will force end a round


su_GetTime

su_GetTime <Time Format> <Cvar>

<Time Format>:
'%d' = day
'%m' = month
'%Y' = Year
'%H' = Hour
'%M' = Minute
'%S' = Secounds
'%Z' = GMT()

eg. su_GetTime "%d/%m/%Y || %H-%M-S" su_temp_get = will return with "Day/Month/Year || Hours/Minutes/Secounds"


su_replace

su_replace <Var> <"Text"> <"New Text">

eg. su_temp_get "this is a test with replace"
eg. su_replace "a test" "a new test" = will return with 'this is a new test with replace'


su_ChangeLevel

su_ChangeLevel <LevelName>

eg. su_ChangeLevel de_dust2


su_profile

su_profile <Action (create | remove | reset | get)> <Alias> [Var]

eg. su_profile create my_profile_name = create a profile alias (auto start counting)
eg. su_profile reset my_profile_name su_temp_get = will reset time but first get alias profile time
eg. su_profile get my_profile_name su_temp_get = will get alias profile time and continue counting
eg. su_profile remove my_profile_name = will remove alias profile


su_Load

su_Load <Action (externalsrc)> <Alias> <Folder>
(externalsrc) Folder = '|root' To run ROOT Apps

eg. su_load externalsrc wget_cmd wget su_systempw


NOTE: Default <Folder> = addons/sourceutils/externalsrc '(su_externalsrc_folder) cvar'
NOTE: You need have the System PW for Load ExternalSRC (addons/sourceutils/sourceutils_security.cfg)


su_Load_Print

su_Load_Print

eg. su_load_print

Code:
Source Utils Loaded Scripts:
__________________________________________________________
Alias
1-> wget_cmd  (addons/sourceutils/externalsrc/wget)
__________________________________________________________

su_UnLoad

su_UnLoad <Action (externalsrc)> <Alias>

eg. su_unload externalsrc wget_cmd


su_ExternalSrc

su_ExternalSrc <Action (addlink | editlink | use | info)> <Alias> [Command]

eg. su_ExternalSrc addlink wget_cmd wget.exe = will add wget.exe to alias name for use
eg. su_ExternalSrc editlink wget_cmd wget.exe = will add/edit wget.exe to alias name for use
eg. su_ExternalSrc use wget_cmd "www.mattie.info/cs" = Will download the http target link


NOTE: Full info about this in: 'addons/sourceutils/externalsrc/Readme.txt'
Dangerous


su_Compile

su_Compile <Path/To/Configure/Sh>

eg. su_Compile addons/sourceutils/externalsrc/qstat

This will compile ONLY Linux Srcs (MakeFile) And (configure)
In compile finish will create a file saying finish trying the compile (not say compile un/success)


su_Log

su_Log <Text>

eg. su_log "A log text exemple from source utils"

NOTE: Only Print The text if Log mod Is ON (log on)


su_Sound

su_Sound <Action (getduration | stopall)> [Sound] [Var]

eg. su_Sound getduration radio/go.wav su_temp_get = will get .wav file sound duration
eg. su_Sound stopall = will Stop all Played sounds

NOTE: <getduration> Only suport '.wav' Files !!


su_SConsole

su_SConsole get <Action (index | max | target | value | name)> <Parm Name> <Var>
su_SConsole set <Action (create | remove)> <Parm Name> <Value> <Access-Password> [Var]

eg. su_SConsole get index -tickrate su_temp_get = will return with parm index
eg. su_SConsole get max 0 su_temp_get = will return with Max parm Count
eg. su_SConsole get target 0 su_temp_get = will return with All parms in cmdtarget
eg. su_SConsole get value +map su_temp_get = will return with parm value eg. de_dust2
eg. su_SConsole get name <index eg. '5'> su_temp_get = will Get parm index name

Allowed Parms: (# ! $ | » >) 'su_avaliable_parms' cvar

eg. su_SConsole set create >my_parm hello mypassword su_temp_get = if have a cvar will return with the new parm index
eg. su_SConsole set remove >my_parm 0 mypassword


su_SQlite

su_SQlite <db> <Cmd>

eg. su_SQlite my_db "MY CMD"


su_GeoIP

su_GeoIP <Type (ip | http)> <By> <Ip/Http> <Var>
<By (0 = Country Code2 | 1 = Country Code3 | 2 = Country Name)>


eg. su_GeoIP ip 0 "208.167.248.24:27015" su_temp_get
"su_temp_get" = "US"

eg. su_GeoIP ip 1 "208.167.248.24:27015" su_temp_get
"su_temp_get" = "USA"

eg. su_GeoIP ip 3 "208.167.248.24:27015" su_temp_get
"su_temp_get" = "United States"

eg. su_GeoIP http 0 "www.mattie.info" su_temp_get
"su_temp_get" = "US"

eg. su_GeoIP http 3 "www.sourcemod.net" su_temp_get
"su_temp_get" = "United States"


NOTE: <Type (ip) ONLY || Ports ":" Are Auto Removed
NOTE: <type = http> use theard!! take a time to get result!


su_getnetinfo

su_getnetinfo <Action> <userid> <var>
<Action (ip | ping | choke | loss | packet | contime | timeout)>

eg. su_getnetinfo ip 10 su_temp_get
eg. su_getnetinfo ping 10 su_temp_get
eg. su_getnetinfo choke 10 su_temp_get
eg. su_getnetinfo loss 10 su_temp_get
eg. su_getnetinfo packet 10 su_temp_get
eg. su_getnetinfo contime 10 su_temp_get
eg. su_getnetinfo timeout 10 su_temp_get


NOTE: <Action (timeout)> return 0 or 1 (0/1)


su_mapfind

su_mapfind <name (* = all)>

eg. su_mapfind zm_
eg. su_mapfind de_
eg. su_mapfind *

NOTE: This only print founded results!


su_echo

su_Echo <Text To Print>

eg. su_echo Echo function writed in SourceUtils v1.6


NOTE: Not a Warpper From "echo" Command!


su_for

su_For <beginvalue> <endvalue> <command>

eg. su_for 0 100 "su_echo sending 100 commands to console"


su_File

su_file get <filename> <action (line | size)> [linenumber] <var>
su_file endwrite <filename> <text>
su_file event <filename> <remove comments (0 = no | 1 = yes)> [var]
su_file list <filetocreate.*> <search-path> [only file names (0 = fullpath to file)] [include others game folders (1 = yes)] [prefix-command] [remove .extension (1 = yes)]
su_file remove <file> [Full-Access-Password]

eg. su_file get mapcycle.txt line 10 su_temp_get = will get file line text!
eg. su_file get mapcycle.txt size 10 su_temp_get = will get file line text Size!
eg. su_file get mapcycle.txt size 0 su_temp_get = will get file size!
eg. su_File endwrite mapcycle.txt de_newmap = will add that map to mapclycle
eg. su_file event mapcycle.txt 1 su_temp_get = will debug all file lines, sizes, status
eg. su_file list mapcycle.txt maps/*.bsp 1 0 0 1 = will write to file all founded files with .bsp
eg. su_file list cfg/downloads.cfg sound/myscript/*.mp3 0 0 su_adddownload 0 = output (su_adddownload sound/myscript/sound.mp3)
eg. exec downloads = will add downloads in last created file!
eg. su_file remove myfile.txt su_filepw
eg. su_file remove su_myfile.txt


NOTE: [Full-Access-Password] Allow you remove any file!!! without this you only can remove files with su_ in name eg. su_myfile.cfg


su_FileCreate

su_FileCreate <Filename>

eg. su_FileCreate mynewfile.txt = will create a file named mynewfile.txt in cstrike folder!
eg. su_FileCreate cfg/mynewfile.txt = will create a file named mynewfile.txt in cstrike/cfg folder!

NOTE: You cant Replace a file!!!


su_dumpclassprops

su_dumpclassprops <print to (0 = Console | 1 = File)>
(File) OutPut: 'addons/sourceutils/dumps/su_dumpclassprops_mapname.txt'

eg. su_dumpclassprops 0 = will print all to console
eg. su_dumpclassprops 1 = will print all to file


su_dumpclassprops

su_dumpmapentitys <print to (0 = Console | 1 = File)>
(File) OutPut: 'addons/sourceutils/dumps/su_dumpmapentitys_mapname.txt'

eg. su_dumpmapentitys 0 = will print all to console
eg. su_dumpmapentitys 1 = will print all to file


su_dumpsclean

su_dumpsclean

eg. su_dumpsclean = will clean dumps folder


############################################# ###############################
##########################Source Utils Events###############################
############################################# ###############################

Event File: addons/sourceutils/sourceutils.res
Auto Loaded To EventScripts


Code:
"sourceutilsevents"
{
	"su_mysql"  // Used For Mysql (su_mysql | su_mysqlfast)
	{
		"su_mysql_userid"	"short"		// Set Your Query "SELECT" Userid. Retured By su_mysql* [Var]
		"su_mysql_status"	"short"   		// 0 = Connection Fail | 1 = Query Fail | 2 = Sucessfull MySQL Job | 3 = Sucessfull MySQL Job With Returned Data
		"su_mysql_data" 	"string"   		// Return Data Selected (SELECT *) (0 = No Select Command | OK = Finish Get All Data)
		"su_mysql_db"		"string"   	// db Used (0 = No db Used)
		"su_mysql_cmd"		"string"   	// Cmd Used
	}
	"su_thread" // Used For Global Threaded Functions
	{
	    	"su_thread_userid"      "short"		// Set Your Query Userid. Retured By Function [Var]
	    	"su_thread_function"    "string"   		// Function Used (geoip)
	   	"su_thread_data"        "string"    	// If A Sucessfull Query Return Data If Not Return The Error
      	"su_thread_status"      "short"     	// 0 = Fail | 1 = Sucessfull
	}
	"su_file"  // Used For su_file event <filename> [var]
	{
	    	"su_file_userid"      	"short"		// Set Your Query Userid. Retured By Function [Var]
	    	"su_file_line"    	"string"    	// Line Returned
	   	"su_file_size"        	"short"    		// If A Sucessfull Query Return Data If Not Return The Error
      	"su_file_line_size"     "short"     // 0 = Fail | 1 = Sucessfull
      	"su_file_status"     	"short"     // 0 = Not Finish | 1 = Finish Debug
	}
}


############################################# ###############################
##########################Source Utils CVars################################
############################################# ###############################

su_temp_get = a temp cvar to get the returns.
su_version = show current source utils version.
su_os = show operative system type server is using (Windows | Linux)
su_maxplayers = show maxplayers server have
su_currentmap = show the current map
su_gamemod = show current game mod
su_lastcompile = show last compile date
su_tickrate = show server tickrate
su_externalsrc_folder = show externalsrc folder source utils is using
su_avaliable_parms = show avaliable parms to use in text begin (su_sconsole set create)
su_servergamedll = show gameserverdll source utils is using
su_tools_folder = Show Source Utils Tools Path
su_dedicatedserver = Is Dedicated Server? (0 = No/ 1 = Yes)
su_nextmap = Nextmap
su_backmap = BackMap
su_freelib_version = Source Utils FreeLib Version
su_freelib_license = Source Utils FreeLib License (GPL)



############################################# ###############################
###########################Source Utils Docs################################
############################################# ###############################


MySQL Client Syntax
Sqlite3 Client Syntax




ToDo:

In Target:

- Parser [.ini/.xml/.cfg]
- FTP
- http functions

They can post edias

Special Thanks:

- chumly (Encorage-me to makeit [Objective MySQL])
- www.sourcemm.net (MetaMod Source Engine, Plugin Track)
- www.sourcemod.com (Thanks To all help From comunity, examples, Linux Problems Compile, Addons Stats Track and for the Plugin Annouce)
- www.sourceplugins.com (Thanks To all help From comunity and for the Plugin Annouce)
- www.hl2coding.com (Thanks for posted examples [Where i started learn c++ ])
- C0ld (thanks For crosstoll, Linux Compile tutorial |cygwin| And For MakeFile Template)
- Mattie (For www.sourceplugins.com Web Site And EventScripts For the Source Utils Usage)


Credits:

- sn4k3 (Developer)
- chumly MySQL "SELECT()" Rows Help, tester


Quote:
Changelog:

v1.6 [26/7/07]

- added SourceUtils FreeLib can run without SourceUtils bin files (only mysql functions)
- added 'su_thread' event for threaded functions like geoip http
- added 'su_file' event for debug/print a file
- added file open/endwrite/list/remove/event commands
- added su_echo command
- added su_getexists mapent (allow know if exists an entity in map eg. buy_zone)
- added su_for command
- added su_FileCreate command (allow you create your own files!)
- added su_dumpclassprops command
- added su_dumpmapentitys command
- added su_dumpsclean command
- added a new folder 'addons/sourceutils/dumps' for dumps

- added 'su_nextmap' cvar to know nextmap
- added 'su_backmap' cvar to know backmap

- updated GeoIp.dat
- updated sourceutils_security.cfg with Files Options

- Improved su_compile command!
- Improved su_cvarforceset command!

- fixed all userid problems (crashs, not found userid)
- fixed "su_getnetinfo timeout" no setvalue to 0
- fixed all "su_getexists" no setvalue to 0

v1.5 [2/6/07]

- added GeoIp Functions (http Theared only)
- added netinfo functions (allow get ip/ping/timeouts ...)
- added MapFind allow search maps on server
- added 'addons/sourceutils/tools' folder

- added 'su_tools_folder' cvar to know Source Utils Tools Path
- added 'su_dedicatedserver' cvar to know If Server Is Dedicated
- added 'su_freelib_version' cvar to know Source Utils FreeLib Version
- added 'su_freelib_license' cvar to know Source Utils FreeLib License (GPL)

- relesed SourceUtils FreeLib Source Code

- change all source utils bin/folder files
- change mysql userids increase type

- fixed bin files (linux)
- fixed mysql license (GPL)


v1.4 [14/5/07]

- added 'su_mysql_userid' to su_mysql event
- added 'addons/sourceutils/sourceutils_security.cfg' file
- added ExternalSRC security (root access, deny programs, master password)
- added 'su_load' [MasterPass] Parm
- changed su_mysql* [Var] = gets su_mysql_userid
- fixed linux binnary dont work

v1.3 [6/5/07]

- added su_getexists mysqlfastconn
- added su_getexists externalsrc
- added su_getexists cmdtarget
- added su_getexists mute
- added su_getexists profile
- added su_externalsrc (like system command)
- added su_profile (get a precision profile)
- added su_compile (allow compile (ONLY) linux makefiles)
- added su_log (can print mensages to current log file)
- added su_precache now suport get file index
- added su_load (allow load source utils extras)
- added su_unload (allow unload loaded scripts)
- added su_load_print (allow print loaded scripts)
- added su_sconsole get/set (allow get/set parms in server console cmd target)
- added su_sound (sound utils like get duration)
- added su_sqlite (allow make sqlite3 querys) (UNTESTED)
- added a Plugin load mensage (successfull load)

- added Source Utils Events! (addons/sourceutils/sourceutils.res)
- added event su_mysql
- added auto load for EventScripts Source Utils Events

- added 'su_tickrate' cvar to see server tickrate
- added 'su_externalsrc_folder' cvar to see ExternalSrc folder source utils is using
- added 'su_avaliable_parms' cvar know what parms can use in begin 'su_sconsole set create' (# ! $ | » >)
- added 'su_servergamedll' cvar to see what GameServerDll Source Utils is using
- added cvars callback (disallow source utils cvars change)

- added update metamod source library to v1.4

- fixed su_getexists userid can crash server if no player in server
- fixed MySQL Fast Connections dont use selected db

v1.2 [5/4/07]

- added MySQL compatible binnary querys!
- added MySQL Multi-Theard ( Now dont stop the server )
- added MySQL Suport "LOAD DATA INFILE"
- added MySQL Suport Multi Statments Separated by A ";"
- added MySQL Suport Multi Results
- added MySQL Fast Connections
- added MySQL Fast Create|Delete|Edit|Info Connections
- fixed Not need SQL.dll for work!

v1.1 [13/3/07]

- added 'su_temp_get' cvar to get things also they can use others cvars
- added 'su_currentmap' cvar to see current map
- added 'su_os' cvar to see Operating System (Windows | Linux)
- added 'su_maxplayers' cvar to see maxplayers/slots
- added 'su_gamemod' cvar to see Current Running DLL Game Mod
- added 'su_lastcompile' cvar to see last compile date of Source Utils


- add GetExists
- add AddDownload
- add Precache Model/Sound
- add Rand (Rand Numbers)
- add Version Check
- add Changelevel
- add CvarForceset
- add Force EndRound
- add GetTime
- add Replace (allow repace text)


- add Suport For MetaMod Source

- fixed 'su_version' cvar cant be Msg/Get Say Protected


v1.0 [23/1/07]

- first realse


Links:


Download SourceUtils MetaMod: Source Version (V1.6)
MetaMod:Source Home

Download SourceUtils Standart Alone Version (V1.6)
Standart Alone Version Home


Download SourceUtils FreeLib Source Code (V1.1)

NOTE:

if you need install soruceutils in other game than counter-strike source you need modificate (addons/sourceutils.vdf) !!!
eg. change 'cstrike' for 'dod'

OR

you can get you .vdf easy here: VDF Creator
In Plugin choose: SourceUtils
After choose you game server!

Last edited by sn4k3; 09-29-2008 at 06:01. Reason: Update Version
sn4k3 is offline
Send a message via MSN to sn4k3