Advertisement
IdoGame

xkall

May 25th, 2015
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #define ADMIN_XKALL ADMIN_IMMUNITY
  4. native set_user_cash(client,Amount) // registering the natives.
  5. native get_user_cash(client)
  6. public plugin_init() {
  7. register_plugin("XK All", "v1.0", "xFlane")
  8. register_clcmd("say","SayCmd") // registering event when client use chat.
  9. }
  10. public SayCmd(client)
  11. {
  12. new Msg[192],Arg[192],Args[192]
  13. read_args(Msg,191)
  14. remove_quotes(Msg)
  15. parse(Msg,Arg,191,Args,191)
  16. // Reading client message ^^^^
  17. if(equali(Arg,"/giveallcash")) // if client first message is /giveallcash.
  18. {
  19. if(!(get_user_flags(client) & ADMIN_XKALL)) // checking if client have the flag to start the event ( ADMIN_IMMUNITY ).
  20. {
  21. ColorChat(client,"You dont have ^4access^1 to use this command!")
  22. return 1; // blocking the message from continue;
  23. }
  24. new AAA = str_to_num(Args) // reading numbers from client second message
  25. ColorChat(0,"^3Admin : ^4%s^1 gived ^3%i^1 ^4cash^1 to all ^3players^1!",GetUserName(client),AAA) // printing to chat which client gived the cash,amount.
  26. if(!AAA)
  27. {
  28. ColorChat(client,"You must type a number!")
  29. return 1;
  30. }
  31. for(new i;i < get_maxplayers();i++) // looping through all players.
  32. {
  33. if(!is_user_connected(i)) continue; // if is isnt connected skip to the next loop.
  34.  
  35. ColorChat(i,"^3You^4 gained^1 %i ^3cash^1 from the ^4admin^1!",AAA) // printing to client how much cash he gained from the owner.
  36. set_user_cash(i,get_user_cash(i) + AAA ); // adding cash to client.
  37. }
  38. return 1;
  39. }
  40. return 0;
  41. }
  42. /* Stocks */
  43. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
  44. new msg[191], players[32], count = 1;
  45. static len; len = formatex(msg, charsmax(msg), "^4[ ^3AMXX^4 ]^1 ");
  46. vformat(msg[len], charsmax(msg) - len, string, 3);
  47.  
  48. if(id) players[0] = id;
  49. else get_players(players,count,"ch");
  50.  
  51. for (new i = 0; i < count; i++)
  52. {
  53. if(is_user_connected(players[i]))
  54. {
  55. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
  56. write_byte(players[i]);
  57. write_string(msg);
  58. message_end();
  59. }
  60. }
  61. }
  62. stock GetUserName( client )
  63. {
  64. static szName[ 32 ];
  65. get_user_name( client, szName, charsmax( szName ) );
  66. return szName;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement