Frogger3140

Untitled

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