Advertisement
Guest User

WrathOfGenesis

a guest
Apr 16th, 2008
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.05 KB | None | 0 0
  1. //==============================================================================
  2.  
  3. #include <a_samp>
  4.  
  5. //==============================================================================
  6.  
  7. // Red
  8.  
  9. #define COLOR_DARKRED 0x660000AA
  10. #define COLOR_LIGHTRED 0xFF99AADD
  11.  
  12. // Blue
  13.  
  14. #define COLOR_SWAT_BLUE 0x0000FFAA
  15. #define COLOR_NEUTRALBLUE 0xABCDEF01
  16. #define COLOR_LIGHTBLUE 0x33CCFFAA
  17. #define COLOR_BLUE 0x0000BBAA
  18. #define COLOR_VIOLET 0x9955DEEE
  19. #define COLOR_LIGHTCYAN 0xAAFFCC33
  20.  
  21. // Green
  22.  
  23. #define COLOR_LIGHTGREEN 0x24FF0AB9
  24. #define COLOR_SEAGREEN 0x00EEADDF
  25. #define COLOR_GREEN 0x33AA33AA
  26.  
  27. // Other
  28.  
  29. #define COLOR_PINK 0xFF66FFAA
  30. #define COLOR_PURPLE 0x800080AA
  31.  
  32. #define COLOR_NEUTRAL 0xABCDEF97
  33. #define COLOR_GLOBAL 0xD0D0FFAA
  34.  
  35. // Rainbow
  36.  
  37. #define COLOR_RED 0xFF0000AA
  38. #define COLOR_ORANGE 0xFF9900AA
  39. #define COLOR_YELLOW 0xFFFF00AA
  40. #define COLOR_GREEN 0x33AA33AA
  41. #define COLOR_BLUE 0x0000BBAA
  42. #define COLOR_VIOLET 0x9955DEEE
  43.  
  44. // Black - White
  45.  
  46. #define COLOR_WHITE 0xFFFFFF00
  47. #define COLOR_GREY 0xAFAFAFAA
  48. #define COLOR_BLACK 0x000000AA
  49.  
  50. //==============================================================================
  51.  
  52. stock GetName ( playerid )
  53. {
  54. new Name [ MAX_PLAYER_NAME ];
  55. GetPlayerName ( playerid , Name , sizeof ( Name ) );
  56. return Name ;
  57. }
  58.  
  59. //==============================================================================
  60.  
  61. stock SendClientMessageToAllExcept ( playerid , COLOR , string [ ] )
  62. {
  63. for ( new giveplayerid = 0 ; giveplayerid < MAX_PLAYERS ; giveplayerid ++ )
  64. {
  65. if ( IsPlayerConnected ( playerid ) )
  66. {
  67. if( giveplayerid != playerid )
  68. {
  69. SendClientMessage ( giveplayerid , COLOR , string );
  70. }
  71. }
  72. }
  73. }
  74.  
  75. //==============================================================================
  76.  
  77. new Muted [ MAX_PLAYERS ];
  78.  
  79. //==============================================================================
  80.  
  81. public OnPlayerConnect ( playerid )
  82. {
  83. Muted [ playerid ] = 0;
  84.  
  85. return 1;
  86. }
  87.  
  88. //==============================================================================
  89.  
  90. public OnPlayerDisconnect ( playerid )
  91. {
  92. Muted [ playerid ] = 0;
  93.  
  94. return 1;
  95. }
  96.  
  97. //==============================================================================
  98.  
  99. public OnPlayerText ( playerid , text [ ] )
  100. {
  101. if ( Muted [ playerid ] == 1 )
  102. {
  103. return 0;
  104. }
  105.  
  106. return 1;
  107. }
  108.  
  109. //==============================================================================
  110.  
  111. public OnPlayerCommandText ( playerid , cmdtext [ ] )
  112. {
  113. new string [ 256 ] , cmd [ 256 ] , idx ;
  114.  
  115. cmd = strtok ( cmdtext , idx );
  116.  
  117. if ( strcmp ( cmd , "/report" , true ) == 0 )
  118. {
  119. new tmp [ 256 ];
  120. tmp = strtok ( cmdtext , idx );
  121.  
  122. if ( ! strlen ( tmp ) )
  123. {
  124. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /report [playerid] [reason]" );
  125. return 1;
  126. }
  127.  
  128. new giveplayerid = strval ( tmp );
  129.  
  130. tmp = strtok ( cmdtext , idx );
  131.  
  132. if ( ! strlen ( tmp ) )
  133. {
  134. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /report [playerid] [reason]" );
  135. return 1;
  136. }
  137.  
  138. new message [ 256 ];
  139.  
  140. if ( giveplayerid < 10 )
  141. {
  142. strmid ( message , cmdtext , 10 , strlen ( cmdtext ) );
  143. }
  144. else
  145. {
  146. strmid ( message , cmdtext , 11 , strlen ( cmdtext ) );
  147. }
  148.  
  149. if ( IsPlayerConnected ( giveplayerid ) )
  150. {
  151. SendClientMessage(playerid,COLOR_GREEN,"Report sent to all online admins");
  152.  
  153. format(string, sizeof(string), "<report> %s (ID: %d) has accused %s (ID: %d) of %s!",GetName ( playerid ) , playerid , GetName ( giveplayerid ) , giveplayerid ,message);
  154. printf(string);
  155.  
  156. for ( new giveplayerid2 = 0; giveplayerid2 < MAX_PLAYERS; giveplayerid2 ++ )
  157. {
  158. if ( IsPlayerAdmin ( giveplayerid2 ) )
  159. {
  160. SendClientMessage ( giveplayerid2 , COLOR_RED , "_______________________________________________________________" );
  161. format ( string , sizeof ( string ) , "<report> %s (ID: %d) has accused %s (ID: %d)",GetName ( playerid ) , playerid , GetName ( giveplayerid ) , giveplayerid );
  162. SendClientMessage ( giveplayerid2 , COLOR_WHITE , string );
  163. format ( string , sizeof ( string ) , "of %s!" , message );
  164. SendClientMessage ( giveplayerid2 , COLOR_WHITE , string);
  165. SendClientMessage ( giveplayerid2 , COLOR_RED , "_______________________________________________________________" );
  166. }
  167. }
  168. }
  169. else
  170. {
  171. format(string, sizeof(string), "[ERROR] id %d is not an active player.",giveplayerid);
  172. SendClientMessage(playerid, COLOR_WHITE, string);
  173. }
  174. return 1;
  175. }
  176.  
  177. if ( strcmp ( cmd , "/givemoney" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  178. {
  179. new tmp [ 256 ];
  180.  
  181. tmp = strtok ( cmdtext , idx );
  182.  
  183. if( ! strlen ( tmp ) )
  184. {
  185. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: '/givemoney [playerid] [amount]'." );
  186. return 1;
  187. }
  188.  
  189. new giveplayerid = strval ( tmp );
  190.  
  191. tmp = strtok ( cmdtext , idx );
  192.  
  193. if( ! strlen ( tmp ) )
  194. {
  195. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: '/givemoney [playerid] [amount]'." );
  196. return 1;
  197. }
  198.  
  199. new moneys = strval ( tmp );
  200.  
  201. if ( IsPlayerConnected ( giveplayerid ) )
  202. {
  203. GivePlayerMoney ( giveplayerid , moneys );
  204. format ( string , sizeof ( string ) , "[ADMIN MONEY] You have recieved $%d from %s!" , moneys , GetName ( playerid ) );
  205. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  206. format ( string , sizeof ( string ) , "[ADMIN MONEY] %s ( playerid : %d ) has transfered $%d to %s ( playerid : %d )." , GetName(playerid) , playerid , moneys , GetName( giveplayerid ) , giveplayerid );
  207. SendClientMessageToAllExcept ( giveplayerid , COLOR_WHITE , string );
  208. printf ( string );
  209. }
  210. else
  211. {
  212. format( string , sizeof ( string ) , "[ERROR] id %d is not an active player.", giveplayerid );
  213. SendClientMessage ( playerid , COLOR_WHITE , string );
  214. }
  215. return 1;
  216. }
  217.  
  218. if ( strcmp ( cmd , "/goto" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  219. {
  220. new tmp [ 256 ];
  221.  
  222. tmp = strtok ( cmdtext , idx );
  223.  
  224. if( ! strlen ( tmp ) )
  225. {
  226. SendClientMessage(playerid, COLOR_ORANGE, "Usage: /goto [Player ID]");
  227. return 1;
  228. }
  229.  
  230. new giveplayerid = strval ( tmp );
  231.  
  232. if ( ! IsPlayerConnected ( giveplayerid ) )
  233. {
  234. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  235. SendClientMessage(playerid, COLOR_WHITE, string);
  236. return 1;
  237. }
  238.  
  239. new Float:X, Float:Y, Float:Z;
  240.  
  241. if ( ! IsPlayerInAnyVehicle ( playerid ) || GetPlayerInterior ( giveplayerid ) != 0 )
  242. {
  243. GetPlayerPos ( giveplayerid , X , Y ,Z );
  244. SetPlayerPos ( playerid , X , Y + 0.5 , Z+1 );
  245.  
  246. SetPlayerInterior ( playerid , GetPlayerInterior ( giveplayerid ) );
  247.  
  248. format ( string , sizeof ( string ) , "[GOTO] %s ( playerid: %d ) has teleported to you. ", GetName ( playerid ) , playerid );
  249. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  250. format ( string , sizeof ( string ) , "[GOTO] you have teleported to %s ( playerid: %d ). ", GetName ( giveplayerid ) , giveplayerid );
  251. SendClientMessage ( playerid , COLOR_WHITE , string );
  252.  
  253. return 1;
  254. }
  255. else
  256. {
  257. new VehicleID = GetPlayerVehicleID ( playerid );
  258.  
  259. GetPlayerPos ( giveplayerid , X , Y ,Z );
  260. SetVehiclePos ( VehicleID , X , Y + 0.5 , Z+1 );
  261. SetPlayerInterior ( playerid , GetPlayerInterior ( giveplayerid ) );
  262.  
  263. format ( string , sizeof ( string ) , "[GOTO] %s ( playerid: %d ) has teleported to you. ", GetName ( playerid ) , playerid );
  264. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  265. format ( string , sizeof ( string ) , "[GOTO] you have teleported to %s ( playerid: %d ). ", GetName ( giveplayerid ) , giveplayerid );
  266. SendClientMessage ( playerid , COLOR_WHITE , string );
  267.  
  268. return 1;
  269. }
  270. }
  271.  
  272. if ( strcmp ( cmd , "/get" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  273. {
  274. new tmp [ 256 ];
  275.  
  276. tmp = strtok ( cmdtext , idx );
  277.  
  278. if( ! strlen ( tmp ) )
  279. {
  280. SendClientMessage(playerid, COLOR_ORANGE, "Usage: /get [Player ID]");
  281. return 1;
  282. }
  283.  
  284. new giveplayerid = strval ( tmp );
  285.  
  286. if ( ! IsPlayerConnected ( giveplayerid ) )
  287. {
  288. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  289. SendClientMessage(playerid, COLOR_WHITE, string);
  290. return 1;
  291. }
  292.  
  293. new Float:X, Float:Y, Float:Z;
  294.  
  295. if ( ! IsPlayerInAnyVehicle ( giveplayerid ) )
  296. {
  297. GetPlayerPos ( playerid , X , Y ,Z );
  298. SetPlayerPos ( giveplayerid , X , Y + 0.5 , Z+1 );
  299.  
  300. SetPlayerInterior ( giveplayerid , GetPlayerInterior ( playerid ) );
  301.  
  302. format ( string , sizeof ( string ) , "[GET] you have been teleported to %s ( playerid: %d ).", GetName ( playerid ) , playerid );
  303. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  304. format ( string , sizeof ( string ) , "[GET] you have teleported %s to you" , GetName ( giveplayerid ) );
  305. SendClientMessage ( playerid , COLOR_WHITE , string );
  306.  
  307. return 1;
  308. }
  309. else
  310. {
  311. new VehicleID = GetPlayerVehicleID ( giveplayerid );
  312.  
  313. GetPlayerPos ( playerid , X , Y ,Z );
  314. SetVehiclePos ( VehicleID , X , Y + 0.5 , Z+1 );
  315. SetPlayerInterior ( giveplayerid , GetPlayerInterior ( playerid ) );
  316.  
  317. format ( string , sizeof ( string ) , "[GET] you have been teleported to %s ( playerid: %d ).", GetName ( playerid ) , playerid );
  318. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  319. format ( string , sizeof ( string ) , "[GET] you have teleported %s to you" , GetName ( giveplayerid ) );
  320. SendClientMessage ( playerid , COLOR_WHITE , string );
  321.  
  322. return 1;
  323. }
  324. }
  325.  
  326. if ( strcmp ( cmd , "/an" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  327. {
  328.  
  329. new tmp [ 256 ];
  330.  
  331. tmp = strtok ( cmdtext , idx );
  332.  
  333. if ( !strlen ( tmp ) )
  334. {
  335. SendClientMessage ( playerid , COLOR_WHITE , "[ERROR]: USAGE: '/an [time (seconds)] [Message]'" );
  336. return 1;
  337. }
  338.  
  339. new input = strval ( tmp );
  340.  
  341. new Message [ 256 ];
  342.  
  343. if ( input < 10 )
  344. {
  345. strmid ( Message , cmdtext , 5 , strlen ( cmdtext ) );
  346. }
  347.  
  348. if ( input >= 10 && input <= 60 )
  349. {
  350. strmid ( Message , cmdtext , 6 , strlen ( cmdtext ) );
  351. }
  352.  
  353. if ( input > 60 )
  354. {
  355. SendClientMessage ( playerid , COLOR_WHITE , "[ERROR]: Time cannot be over 60 seconds!" );
  356. return 1;
  357. }
  358.  
  359. new time = floatround ( input * 1000 );
  360.  
  361. if ( !strlen ( Message ) )
  362. {
  363. SendClientMessage ( playerid , COLOR_WHITE , "[ERROR]: USAGE: '/an [time (seconds)] [Message]'" );
  364. return 1;
  365. }
  366.  
  367. format ( string , sizeof ( string ) , "%s" , Message );
  368.  
  369. GameTextForAll ( string , time , 6 );
  370.  
  371. printf ( "[announce] %s ( playerid: %d ) : %s" , GetName ( playerid ) , playerid , Message );
  372.  
  373. return 1;
  374. }
  375.  
  376. if ( strcmp ( cmd , "/freeze" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  377. {
  378. new tmp [ 256 ];
  379.  
  380. tmp = strtok ( cmdtext , idx );
  381.  
  382. if ( !strlen ( tmp ) )
  383. {
  384. SendClientMessage ( playerid , COLOR_WHITE , "Usage: /freeze [Player ID]" );
  385. return 1;
  386. }
  387.  
  388. new giveplayerid = strval ( tmp );
  389.  
  390. if ( ! IsPlayerConnected ( giveplayerid ) )
  391. {
  392. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  393. SendClientMessage(playerid, COLOR_WHITE, string);
  394. return 1;
  395. }
  396.  
  397. TogglePlayerControllable ( giveplayerid , false );
  398.  
  399. format ( string , sizeof ( string ) , "%s (player: %d) has frozen %s ( playerid: %d ). ", GetName ( playerid ) , playerid, GetName ( giveplayerid ) , giveplayerid );
  400. SendClientMessageToAllExcept ( giveplayerid , COLOR_YELLOW , string );
  401. printf ( string );
  402. format ( string , sizeof ( string ) , "[WARNING] You have been frozen by %s ( playerid: %d ). ", GetName ( playerid ) , playerid );
  403. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  404.  
  405. return 1;
  406. }
  407.  
  408. if(strcmp(cmd, "/mute", true) == 0 && IsPlayerAdmin ( playerid ) )
  409. {
  410. new tmp [ 256 ];
  411.  
  412. tmp = strtok ( cmdtext , idx );
  413.  
  414. if ( !strlen ( tmp ) )
  415. {
  416. SendClientMessage ( playerid , COLOR_WHITE , "Usage: /mute [Player ID]" );
  417. return 1;
  418. }
  419.  
  420. new giveplayerid = strval(tmp);
  421.  
  422. if ( ! IsPlayerConnected ( giveplayerid ) )
  423. {
  424. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  425. SendClientMessage(playerid, COLOR_WHITE, string);
  426. return 1;
  427. }
  428.  
  429. Muted [ giveplayerid ] = 1;
  430.  
  431. format ( string , sizeof ( string ) , "%s (player: %d) has muted %s ( playerid: %d ). ", GetName ( playerid ) , playerid, GetName ( giveplayerid ) , giveplayerid );
  432. SendClientMessageToAllExcept ( giveplayerid , COLOR_YELLOW , string );
  433. printf ( string );
  434. format ( string , sizeof ( string ) , "[WARNING] You have been muted by %s ( playerid: %d ). ", GetName ( playerid ) , playerid );
  435. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  436.  
  437. return 1;
  438. }
  439.  
  440. if ( strcmp ( cmd , "/unfreeze" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  441. {
  442. new tmp [ 256 ];
  443.  
  444. tmp = strtok ( cmdtext , idx );
  445.  
  446. if ( !strlen ( tmp ) )
  447. {
  448. SendClientMessage ( playerid , COLOR_WHITE , "Usage: /unfreeze [Player ID]" );
  449. return 1;
  450. }
  451.  
  452. new giveplayerid = strval ( tmp );
  453.  
  454. if ( ! IsPlayerConnected ( giveplayerid ) )
  455. {
  456. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  457. SendClientMessage(playerid, COLOR_WHITE, string);
  458. return 1;
  459. }
  460.  
  461. TogglePlayerControllable ( giveplayerid , true );
  462.  
  463. format ( string , sizeof ( string ) , "%s (player: %d) has unfrozen %s ( playerid: %d ). ", GetName ( playerid ) , playerid, GetName ( giveplayerid ) , giveplayerid );
  464. SendClientMessageToAllExcept ( giveplayerid , COLOR_YELLOW , string );
  465. printf ( string );
  466. format ( string , sizeof ( string ) , "[UNFREEZE] You have been unfrozen by %s ( playerid: %d ). ", GetName ( playerid ) , playerid );
  467. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  468.  
  469. return 1;
  470. }
  471.  
  472. if(strcmp(cmd, "/unmute", true) == 0 && IsPlayerAdmin ( playerid ) )
  473. {
  474. new tmp [ 256 ];
  475.  
  476. tmp = strtok ( cmdtext , idx );
  477.  
  478. if ( !strlen ( tmp ) )
  479. {
  480. SendClientMessage ( playerid , COLOR_WHITE , "Usage: /unmute [Player ID]" );
  481. return 1;
  482. }
  483.  
  484. new giveplayerid = strval(tmp);
  485.  
  486. if ( ! IsPlayerConnected ( giveplayerid ) )
  487. {
  488. format(string, sizeof(string), "[ERROR] id %d is not an active player.", giveplayerid);
  489. SendClientMessage(playerid, COLOR_WHITE, string);
  490. return 1;
  491. }
  492.  
  493. Muted [ giveplayerid ] = 0;
  494.  
  495. format ( string , sizeof ( string ) , "%s (player: %d) has un-muted %s ( playerid: %d ). ", GetName ( playerid ) , playerid, GetName ( giveplayerid ) , giveplayerid );
  496. SendClientMessageToAllExcept ( giveplayerid , COLOR_YELLOW , string );
  497. printf ( string );
  498. format ( string , sizeof ( string ) , "[UNMUTE] You have been un-muted by %s ( playerid: %d ). ", GetName ( playerid ) , playerid );
  499. SendClientMessage ( giveplayerid , COLOR_WHITE , string );
  500.  
  501. return 1;
  502. }
  503.  
  504. if ( strcmp ( cmd , "/kick" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  505. {
  506. new tmp [ 256 ];
  507.  
  508. new message [ 256 ];
  509.  
  510. tmp = strtok ( cmdtext , idx );
  511.  
  512. if( ! strlen ( tmp ) )
  513. {
  514. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /kick [playerid]" );
  515. return 1;
  516. }
  517.  
  518. new giveplayerid = strval(tmp);
  519.  
  520. tmp = strtok(cmdtext, idx);
  521.  
  522. if(!strlen(tmp))
  523. {
  524. if (IsPlayerConnected(giveplayerid))
  525. {
  526. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  527. format(string, sizeof(string), "Admin %s (player: %d) has Kicked %s (player: %d) from the server.",GetName(playerid), playerid, GetName(giveplayerid), giveplayerid);
  528. SendClientMessageToAll(COLOR_WHITE, string);
  529. printf(string);
  530. SendClientMessageToAll(COLOR_WHITE,"No reason given.");
  531. printf(string);
  532. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  533. Kick(giveplayerid);
  534. return 1;
  535. }
  536. else
  537. {
  538. format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
  539. SendClientMessage(playerid, COLOR_WHITE, string);
  540. return 1;
  541. }
  542. }
  543.  
  544. if(giveplayerid < 10)
  545. {
  546. strmid(message, cmdtext, 7, strlen(cmdtext));
  547. }
  548. else
  549. {
  550. strmid(message, cmdtext, 8, strlen(cmdtext));
  551. }
  552.  
  553. if (IsPlayerConnected(giveplayerid))
  554. {
  555. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  556. format(string, sizeof(string), "Admin %s (player: %d) has Kicked %s (player: %d) from the server.",GetName(playerid), playerid, GetName(giveplayerid), giveplayerid);
  557. SendClientMessageToAll(COLOR_WHITE, string);
  558. printf(string);
  559. format(string, sizeof(string), "reason: %s.",message);
  560. SendClientMessageToAll(COLOR_WHITE, string);
  561. printf(string);
  562. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  563. Kick(giveplayerid);
  564. return 1;
  565. }
  566. else
  567. {
  568. format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
  569. SendClientMessage(playerid, COLOR_WHITE, string);
  570. return 1;
  571. }
  572. }
  573.  
  574. if ( strcmp ( cmd , "/admincommands" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  575. {
  576. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/freeze [id] /unfreeze [id]." );
  577. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/mute [id] /unmute [id]." );
  578. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/an [time] [message] : to announce a message." );
  579. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/disarm [id] : to disarm someone." );
  580. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/kick [id] [reason] : to kick a player." );
  581. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/goto [id] : to teleport to a player." );
  582. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/get [id] : to bring a player to you." );
  583. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/Ban [id] [reason] : to Ban a player." );
  584. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/name [id] [name] : to change a players name." );
  585. SendClientMessage ( playerid , COLOR_LIGHTBLUE , "/givemoney [id] : to give money ( your money stays the same )." );
  586. return 1;
  587. }
  588.  
  589. if ( strcmp ( cmd , "/ban" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  590. {
  591. new tmp [ 256 ];
  592.  
  593. new message [ 256 ];
  594.  
  595. tmp = strtok ( cmdtext , idx );
  596.  
  597. if( ! strlen ( tmp ) )
  598. {
  599. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /ban [playerid]" );
  600. return 1;
  601. }
  602.  
  603. new giveplayerid = strval(tmp);
  604.  
  605. tmp = strtok(cmdtext, idx);
  606.  
  607. if(!strlen(tmp))
  608. {
  609. if (IsPlayerConnected(giveplayerid))
  610. {
  611. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  612. format(string, sizeof(string), "Admin %s (player: %d) has banned %s (player: %d) from the server.",GetName(playerid), playerid, GetName(giveplayerid), giveplayerid);
  613. SendClientMessageToAll(COLOR_WHITE, string);
  614. printf(string);
  615. SendClientMessageToAll(COLOR_WHITE,"No reason given.");
  616. printf(string);
  617. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  618. Ban(giveplayerid);
  619. return 1;
  620. }
  621. else
  622. {
  623. format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
  624. SendClientMessage(playerid, COLOR_WHITE, string);
  625. return 1;
  626. }
  627. }
  628.  
  629. if(giveplayerid < 10)
  630. {
  631. strmid ( message , cmdtext , 6 , strlen ( cmdtext ) );
  632. }
  633. else
  634. {
  635. strmid ( message , cmdtext , 7 , strlen ( cmdtext ) );
  636. }
  637.  
  638. if (IsPlayerConnected(giveplayerid))
  639. {
  640. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  641. format(string, sizeof(string), "Admin %s (player: %d) has banned %s (player: %d) from the server.",GetName(playerid), playerid, GetName(giveplayerid), giveplayerid);
  642. SendClientMessageToAll(COLOR_WHITE, string);
  643. printf(string);
  644. format(string, sizeof(string), "reason: %s.",message);
  645. SendClientMessageToAll(COLOR_WHITE, string);
  646. printf(string);
  647. SendClientMessageToAll(COLOR_RED,"____________________________________________________________________________________");
  648. Ban(giveplayerid);
  649. return 1;
  650. }
  651. else
  652. {
  653. format(string, sizeof(string), "[ERROR] ID %d is not an active player.", giveplayerid);
  654. SendClientMessage(playerid, COLOR_WHITE, string);
  655. return 1;
  656. }
  657. }
  658.  
  659. if ( strcmp ( cmd , "/name" , true ) == 0 && IsPlayerAdmin ( playerid ) )
  660. {
  661. new tmp [ 256 ];
  662.  
  663. tmp = strtok ( cmdtext , idx );
  664.  
  665. if ( !strlen ( tmp ) )
  666. {
  667. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /name [playerid] [new name]");
  668. return 1;
  669. }
  670.  
  671. new giveplayerid = strval ( tmp );
  672.  
  673. tmp = strtok ( cmdtext , idx );
  674.  
  675. if ( !strlen ( tmp ) )
  676. {
  677. SendClientMessage ( playerid , COLOR_WHITE , "USAGE: /name [playerid] [new name]");
  678. return 1;
  679. }
  680.  
  681. if ( IsPlayerConnected ( giveplayerid ) )
  682. {
  683. format ( string , sizeof ( string ) , "%s (ID: %d) has changed my name to %s." , GetName ( playerid ) , playerid , tmp );
  684. printf ( string ) ;
  685. SendPlayerMessageToAll ( giveplayerid , string );
  686. SetPlayerName ( giveplayerid , tmp );
  687. return 1;
  688. }
  689. else
  690. {
  691. format ( string , sizeof ( string ) , "[ERROR] ID %d is not an active player." , giveplayerid );
  692. SendClientMessage ( playerid , COLOR_WHITE , string );
  693. return 1;
  694. }
  695. }
  696. return 0;
  697. }
  698.  
  699. //==============================================================================
  700.  
  701. strtok(const string[], &index)
  702. {
  703. new length = strlen(string);
  704. while ((index < length) && (string[index] <= ' '))
  705. {
  706. index++;
  707. }
  708.  
  709. new offset = index;
  710. new result[20];
  711. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  712. {
  713. result[index - offset] = string[index];
  714. index++;
  715. }
  716. result[index - offset] = EOS;
  717. return result;
  718. }
  719.  
  720. //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement