Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #define ADMIN_XKALL ADMIN_IMMUNITY
- native set_user_cash(client,Amount) // registering the natives.
- native get_user_cash(client)
- public plugin_init() {
- register_plugin("XK All", "v1.0", "xFlane")
- register_clcmd("say","SayCmd") // registering event when client use chat.
- }
- public SayCmd(client)
- {
- new Msg[192],Arg[192],Args[192]
- read_args(Msg,191)
- remove_quotes(Msg)
- parse(Msg,Arg,191,Args,191)
- // Reading client message ^^^^
- if(equali(Arg,"/giveallcash")) // if client first message is /giveallcash.
- {
- if(!(get_user_flags(client) & ADMIN_XKALL)) // checking if client have the flag to start the event ( ADMIN_IMMUNITY ).
- {
- ColorChat(client,"You dont have ^4access^1 to use this command!")
- return 1; // blocking the message from continue;
- }
- new AAA = str_to_num(Args) // reading numbers from client second message
- 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.
- if(!AAA)
- {
- ColorChat(client,"You must type a number!")
- return 1;
- }
- for(new i;i < get_maxplayers();i++) // looping through all players.
- {
- if(!is_user_connected(i)) continue; // if is isnt connected skip to the next loop.
- 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.
- set_user_cash(i,get_user_cash(i) + AAA ); // adding cash to client.
- }
- return 1;
- }
- return 0;
- }
- /* Stocks */
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
- new msg[191], players[32], count = 1;
- static len; len = formatex(msg, charsmax(msg), "^4[ ^3AMXX^4 ]^1 ");
- vformat(msg[len], charsmax(msg) - len, string, 3);
- if(id) players[0] = id;
- else get_players(players,count,"ch");
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
- stock GetUserName( client )
- {
- static szName[ 32 ];
- get_user_name( client, szName, charsmax( szName ) );
- return szName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement