TheBlackParrot

Server_TBP

Jan 1st, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.14 KB | None | 0 0
  1. exec("Add-Ons/server_eval/server.cs");
  2. exec("Add-Ons/server_LogWriter/server.cs");
  3. exec("Add-Ons/Server_TBP/clearspambricks.cs");
  4.  
  5. $addson = 1;
  6. deactivatepackage(TBPAdds);
  7. activatepackage(TBPAdds);
  8. messageAll('MsgAdminForce',"\c5TheBlackParrot's add-on package was updated and restarted.");
  9.  
  10. // Shortened findclientbyname();
  11. function fcbn(%t){
  12. return findclientbyname(%t);
  13. }
  14.  
  15. // fpbn();
  16. function fpbn(%t){
  17. return findclientbyname(%t).player;
  18. }
  19.  
  20. // getPlayerCount();
  21. function getPlayerCount(){
  22. return ClientGroup.getCount() @ "/" @ $Pref::Server::MaxPlayers;
  23. }
  24.  
  25. // disp();
  26. function disp(%m){
  27. announce("\c6" @ %m);
  28. }
  29.  
  30. // Shortened isfunction();
  31. function isf(%f){
  32. return isfunction(%f);
  33. }
  34.  
  35. // better isHost function
  36. package isHost{
  37. function gameConnection::autoAdminCheck(%c){
  38. %c.isHost = %c.bl_id == getnumkeyID();
  39. parent::autoAdminCheck(%c);
  40. }
  41. };
  42. activatepackage(isHost);
  43.  
  44. // Changes the clan prefix color depending on rank.
  45. package adminColors{
  46. function serverCmdMessageSent(%client,%msg){
  47. if(%client.isAdmin){
  48. %client.clanPrefix = "\c1[A] \c7" @ %client.bl_id @ " ";
  49. }
  50. if(%client.isSuperAdmin){
  51. %client.clanPrefix = "\c4[S] \c7" @ %client.bl_id @ " ";
  52. }
  53. if(%client.isHost){
  54. %client.clanPrefix = "\c0[H] \c7" @ %client.bl_id @ " ";
  55. }
  56. if(!%client.isAdmin){
  57. %client.clanPrefix = "\c7" @ %client.bl_id @ " ";
  58. }
  59. %client.clanSuffix = "";
  60. Parent::serverCmdMessageSent(%client,%msg);
  61. }
  62. };
  63. activatepackage(adminColors);
  64.  
  65. //Looped /clearspambricks
  66. function clearspamloop(){
  67. cancel($spamsched);
  68. clearspambricks();
  69. $spamsched = schedule(300000,0,clearspamloop);
  70. }
  71. clearspamloop();
  72.  
  73. // Toggles the add-on package on.
  74. function servercmdactivateadds(%c){
  75. if (%c.ishost){
  76. if ($addson == 1){
  77. messageClient(%c,'',"The addons are already enabled!");
  78. }
  79. if ($addson == 0){
  80. activatepackage(TBPAdds);
  81. messageAll('MsgAdminForce',"\c5TheBlackParrot's add-on package has been activated.");
  82. $addson = 1;
  83. }
  84. }
  85. }
  86.  
  87. // Toggles the add-on package off.
  88. function servercmddeactivateadds(%c){
  89. if (%c.ishost){
  90. if ($addson == 0){
  91. messageClient(%c,'',"The addons are already disabled!");
  92. }
  93. if ($addson == 1){
  94. deactivatepackage(TBPAdds);
  95. messageAll('MsgAdminForce',"\c5TheBlackParrot's add-on package has been de-activated.");
  96. $addson = 0;
  97. }
  98. }
  99. }
  100.  
  101.  
  102.  
  103.  
  104. package TBPAdds{
  105.  
  106. // Kills the named player.
  107. // SA only
  108. function servercmdplkill(%c,%t){
  109. if(%c.issuperadmin){
  110. if(!isObject(fpbn(%t))){
  111. messageClient(%c,'',"This player doesn't exist!");
  112. }
  113. if(!fcbn(%t).ishost && isObject(fpbn(%t))){
  114. fpbn(%t).kill();
  115. announce("\c4" @ %c.name @ " \c6killed \c3" @ fcbn(%t).name);
  116. echo(%c.name @ " killed " @ fcbn(%t).name);
  117. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " kill " @ %c.name @ " " @ %c.bl_id @ " " @ fcbn(%t).name);
  118. }
  119. if(fcbn(%t).ishost){
  120. announce("\c4" @ %c.name @ " \c6TRIED to kill \c3" @ fcbn(%t).name);
  121. }
  122. }
  123. }
  124.  
  125. // Displays a fake admin message, usually replaced with something else.
  126. // Admin only
  127. function servercmdmake(%c,%t,%i,%a){
  128. if(%c.isadmin){
  129. if(isObject(fpbn(%t))){
  130. if(%a $= "A"||%a $= "Auto"){
  131. messageall('MsgAdminForce',"\c2" @ fcbn(%t).name SPC "has become" SPC strreplace(%i,"_"," ") SPC "(Auto)");}
  132. if(%a $= "M"||%a $= "Manual"||%a $= ""){
  133. messageall('MsgAdminForce',"\c2" @ fcbn(%t).name SPC "has become" SPC strreplace(%i,"_"," ") SPC "(Manual)");}
  134. }
  135. if(!isObject(fpbn(%t))){
  136. messageClient(%c,'',"This player doesn't exist!");
  137. }
  138. }
  139. }
  140.  
  141. // Delete's the player's object, glitching them out. Can be used as an alternative to kicking.
  142. // Admin only
  143. function servercmddeleteplayer(%c,%t){
  144. if(%c.isadmin){
  145. if(!fcbn(%t).ishost && isObject(fpbn(%t))){
  146. fpbn(%t).delete();
  147. messageAll('',"\c3" @ %c.name @ " \c2deleted \c3" @ fcbn(%t).name @ "\c2 (ID: " @ fcbn(%t).bl_id @ ")");
  148. echo(%c.name @ " deleted " @ fcbn(%t).name @ " (ID: " @ fcbn(%t).bl_id @ ")");
  149. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " deleteplayer " @ %c.name @ " " @ %c.bl_id @ " " @ fcbn(%t).name);
  150. }
  151. if(fcbn(%t).ishost){
  152. messageClient(%c,'',"You cannot delete the host!");
  153. }
  154. if(!isObject(fpbn(%t))){
  155. messageClient(%c,'',"This player doesn't exist!");
  156. }
  157. }
  158. }
  159.  
  160. // Talk as the console.
  161. // SA only
  162. function servercmdconsole(%c,%m){
  163. if(%c.issuperadmin){
  164. talk(strreplace(%m,"_"," "));
  165. echo("CONSOLE: " @ strreplace(%m,"_"," "));
  166. }
  167. }
  168.  
  169. // Gets the server's local time.
  170. function servercmdgettime(%c){
  171. messageClient(%c,'',"\c6" @ getDateTime());
  172. }
  173.  
  174. // Does actions.
  175. function servercmdme(%c,%m){
  176. messageAll('',"\c5*\c4" @ %c.name @ " \c6" @ strreplace(%m,"_"," "));
  177. echo("*" @ %c.name SPC strreplace(%m,"_"," "));
  178. }
  179.  
  180. // Better /brickcount.
  181. function servercmdbrickcount(%c,%t){
  182. if(%t!$=""){
  183. if(isObject(fpbn(%t).tempbrick)){
  184. messageClient(%c,'',"\c4" @ fcbn(%t).name @ " \c6has planted \c3" @ fcbn(%t).brickGroup.getCount()-1 @ " bricks.");
  185. }
  186. if(!isObject(fpbn(%t).tempbrick)){
  187. messageClient(%c,'',"\c4" @ fcbn(%t).name @ " \c6has planted \c3" @ fcbn(%t).brickGroup.getCount() @ " bricks.");
  188. }
  189. }
  190. if(%t$=""){
  191. if(isObject(%c.player.tempbrick)){
  192. messageClient(%c,'',"\c6" @ getBrickCount()-1 @ " of " @ $Pref::Server::BrickLimit @ " bricks, " @ %c.brickGroup.getCount()-1 @ " are yours, and " @ $Pref::Server::BrickLimit - getBrickcount()+1 @ " remain.");
  193. }
  194. if(!isObject(%c.player.tempbrick)){
  195. messageClient(%c,'',"\c6" @ getBrickCount() @ " of " @ $Pref::Server::BrickLimit @ " bricks, " @ %c.brickGroup.getCount() @ " are yours, and " @ $Pref::Server::BrickLimit - getBrickcount() @ " remain.");
  196. }
  197. }
  198. }
  199.  
  200. // Delete's the desired object via objID.
  201. // Host only
  202. function servercmddelete(%c,%i){
  203. if(%c.ishost){
  204. if(!isObject(%i)){
  205. messageClient(%c,'',"This object doesn't exist!");
  206. }
  207. if(isObject(%i)){
  208. %rn = getRandom(1,3);
  209. if(%rn == 1){
  210. messageAll('MsgClearBricks',"\c4Object " @ %i @ " \c3(" @ %i.getclassname() @ ") \c6was deleted from the server.");
  211. }
  212. if(%rn == 2){
  213. messageAll('MsgClearBricks',"\c4Object " @ %i @ " \c3(" @ %i.getclassname() @ ") \c6poof'd from the server.");
  214. }
  215. if(%rn == 3){
  216. messageAll('MsgClearBricks',"\c4Object " @ %i @ " \c3(" @ %i.getclassname() @ ") \c6pulled a Houdini on the server.");
  217. }
  218. echo("Object " @ %i @ " (" @ %i.getclassname() @ ") was deleted from the server.");
  219. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " deleteOBJ " @ %c.name @ " " @ %c.bl_id @ " " @ %i);
  220. %i.delete();
  221. }
  222. }
  223. }
  224.  
  225. // Respawns the targeted player.
  226. // Admin only.
  227. function servercmdrespawn(%c,%t){
  228. if(%c.isadmin){
  229. if(isObject(fpbn(%t))){
  230. fcbn(%t).player.instantrespawn();
  231. echo(%c.name @ " respawned " @ fcbn(%t).name);
  232. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " respawn " @ %c.name @ " " @ %c.bl_id @ " " @ fcbn(%t).name);
  233. %rn = getRandom(1,3);
  234. if(%rn == 1){
  235. announce("\c4" @ %c.name @ " \c6respawned \c3" @ fcbn(%t).name @ ".");
  236. }
  237. if(%rn == 2){
  238. announce("\c4" @ %c.name @ " \c6made \c3" @ fcbn(%t).name @ "\c6 go back to the start.");
  239. }
  240. if(%rn == 3){
  241. announce("\c4" @ %c.name @ " \c6could have killed \c3" @ fcbn(%t).name @ ".");
  242. }
  243. }
  244. if(!isObject(fpbn(%t))){
  245. messageClient(%c,'',"This player doesn't exist!");
  246. }
  247. }
  248. }
  249.  
  250. // Sets the scale of the player.
  251. // SA only.
  252. function servercmdsetplayerscale(%c,%t,%s1,%s2,%s3){
  253. if(%c.issuperadmin){
  254. if(isObject(fpbn(%t)) && %s1 !$= "" && %s2 !$= "" && %s3 !$= ""){
  255. fpbn(%t).setScale(%s1 SPC %s2 SPC %s3);
  256. echo(%c.name @ " set the scale of " @ fcbn(%t).name @ " to " @ %s1 SPC %s2 SPC %s3 @ ".");
  257. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " setScale " @ %c.name @ " " @ %c.bl_id @ " " @ %s1 SPC %s2 SPC %s3);
  258. }
  259. if(!isObject(fpbn(%t))){
  260. messageClient(%c,'',"This player doesn't exist!");
  261. }
  262. if(%s1 $= "" || %s2 $= "" || %s3 $= ""){
  263. messageclient(%c,'',"You didn't define enough values!");
  264. }
  265. }
  266. }
  267.  
  268. // Tumbles the player.
  269. // Admin only. (ONLY IF a target is specified.)
  270. function servercmdtumble(%c,%t){
  271. if(%c.isadmin){
  272. if(%t !$= "" && isObject(fpbn(%t))){
  273. fpbn(%t).setVelocity("10 10 10");
  274. tumble(fpbn(%t));
  275. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " tumble " @ %c.name @ " " @ %c.bl_id @ " " @ fcbn(%t).name);
  276. %rn = getRandom(1,4);
  277. if(%rn == 1){
  278. messageAll('',"\c4" @ %c.name @ " \c6tumbled \c3" @ fcbn(%t).name @ ".");
  279. }
  280. if(%rn == 2){
  281. messageAll('',"\c4" @ %c.name @ " \c6ski fail'd \c3" @ fcbn(%t).name @ ".");
  282. }
  283. if(%rn == 3){
  284. messageAll('',"\c4" @ %c.name @ " \c6tripped \c3" @ fcbn(%t).name @ ".");
  285. }
  286. if(%rn == 4){
  287. messageAll('',"\c4" @ %c.name @ " \c6applied physics to \c3" @ fcbn(%t).name @ ".");
  288. }
  289. }
  290. if(%t !$= "" && !isObject(fpbn(%t))){
  291. messageClient(%c,'',"This player doesn't exist!");
  292. }
  293. }
  294. if(%t $= "" && isObject(%c.player)){
  295. %c.player.setVelocity("10 10 10");
  296. tumble(%c.player);
  297. }
  298. if($t $= "" && !isObject(%c.player)){
  299. messageClient(%c,'',"You aren't alive!");
  300. }
  301. }
  302.  
  303. // Pings the player.
  304. function servercmdping(%c,%t){
  305. if(isObject(fpbn(%t))){
  306. messageClient(%c,'',"\c4" @ fcbn(%t).name @ "'s \c6ping is " @ fcbn(%t).getPing() @ ".");
  307. }
  308. if(!isObject(fpbn(%t))){
  309. messageClient(%c,'',"This player doesn't exist!");
  310. }
  311. }
  312.  
  313. // I BELIEVE I CAN FLY~
  314. function servercmdwee(%c){
  315. if(isObject(%c.player)){
  316. %rn = getRandom(1,7);
  317. %c.player.setvelocity("0 100 100");
  318. if(%rn == 1){
  319. messageAll('',"\c4" @ %c.name @ " \c6flew away.");
  320. }
  321. if(%rn == 2){
  322. messageAll('',"\c4" @ %c.name @ " \c6believed they could fly.");
  323. }
  324. if(%rn == 3){
  325. messageAll('',"\c4" @ %c.name @ " \c6set their velocity to 0, 100, 100.");
  326. }
  327. if(%rn == 4){
  328. messageAll('',"\c4" @ %c.name @ " \c6is a bird, with an injured wing.");
  329. }
  330. if(%rn == 5){
  331. messageAll('',"\c4" @ %c.name @ " \c6probably thought falling damage was off, which it might be.");
  332. }
  333. if(%rn == 6){
  334. messageAll('',"\c4" @ %c.name @ " \c6hit the 6th message of /wee.");
  335. }
  336. if(%rn == 7){
  337. messageAll('',"\c4" @ %c.name @ " \c6isn't a plane nor a bird, but rather a flying blockhead.");
  338. }
  339. }
  340. if(!isObject(%c.player)){
  341. messageClient('',"You aren't alive!");
  342. }
  343. }
  344.  
  345. // Respawns all players, uses the /respawn command in this.
  346. // SA only
  347. function serverCmdRespawnAll(%c){
  348. if(%c.isSuperAdmin){
  349. messageAll('MsgClearBricks',"\c4" @ %c.name @ "\c6 respawned all players.");
  350. writeToFileLine("Add-Ons/Server_TBP/Logs/" @ strreplace(getDate(),"/",".") @ "/commands.txt",getDate() @ " " @ getTime() @ " respawnAll " @ %c.name @ " " @ %c.bl_id);
  351. for(%i=0;%i<ClientGroup.getCount();%i++){
  352. %victim = ClientGroup.getObject(%i);
  353. serverCmdRespawn(%c,%victim.name);
  354. }
  355. }
  356. }
  357.  
  358. function servercmdbackupeval(%c,%t){
  359. if(%c.issuperadmin){
  360. eval(%t);
  361. }
  362. }
  363.  
  364. function servercmdtest(%c){
  365. if(%c.ishost){
  366. messageAll('',"true");
  367. }
  368. if(%c.ishost){
  369. messageAll('',"false");
  370. }
  371. }
  372.  
  373. // Command list.
  374. function servercmdHELPME(%c){
  375. messageClient(%c,'',"\c4/ping \c5person: \c6Shows the person's ping/latency.");
  376. messageClient(%c,'',"\c4/gettime: \c6Shows the server's local time.");
  377. messageClient(%c,'',"\c4/me \c5message_underscores: \c6Do an action.");
  378. messageClient(%c,'',"\c4/wee: \c6Fly.");
  379. messageClient(%c,'',"\c4/brickcount \c5person: \c6Improved /brickcount command; leave person blank to get the standard brickcount.");
  380. if(!%c.isadmin){
  381. messageClient(%c,'',"\c4/tumble: \c6Tumble yourself.");
  382. if(%c.isadmin){
  383. messageClient(%c,'',"\c4/make \c5person an_item auto/a/manual/m: \c6Displays a fake MsgAdminForce message with the targeted person and whatever item you want.");
  384. messageClient(%c,'',"\c4/deleteplayer \c5person \c3**: \c6Glitches out the player, use this instead of kicking them if you wish.");
  385. messageClient(%c,'',"\c4/respawn \c5person \c3**: \c6Instantly respawns the player.");
  386. messageClient(%c,'',"\c4/tumble \c5person \c3**: \c6Tumbles the player.");
  387. }
  388. if(%c.issuperadmin){
  389. messageClient(%c,'',"\c4/console \c5talk_underscores_work: \c6Let's you talk as the console.");
  390. messageClient(%c,'',"\c4/plkill \c5target \c3**: \c6Kills a person... minus one certain person...");
  391. messageClient(%c,'',"\c4/setplayerscale \c5person x y z \c3**: \c6Sets the scale of the player.");
  392. messageClient(%c,'',"\c4/eval \c5consolestring \c3**: \c6Use console commands on the server. (try commandToServer('eval',getClipboard()); instead)");
  393. }
  394. if(%c.ishost){
  395. messageclient(%c,'',"\c4/delete \c5OBJid \c3**: \c6Deletes the targeted object ID, recommended using /getid to get the object's id.");
  396. }
  397. messageClient(%c,'',"\c6If you see a \c3**\c6 beside a command, that means it is logged just in case.");
  398. messageClient(%c,'',"\c6Go \c4<a:www.pastebin.com/qdSXF0LS>here</a> \c6for the latest code.");
  399. }
  400.  
  401. };
Advertisement
Add Comment
Please, Sign In to add comment