Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Notice - This plugin is bugged... so if you want to use it you can.. tought i don't recommand it...
- This plugin was made by Rejack ( AmxxStudio ).
- This was never published because it's still bugged...
- */
- #include < amxmodx >
- #include < cstrike >
- new gDonate[ 33 ], bool:AllowDonate[ 33 ] = false, gReq[ 33 ];
- public plugin_init()
- {
- register_clcmd( "say /donate", "cmdDonateMenu" );
- register_clcmd( "_donate_", "DonateValue" );
- register_clcmd( "_req_", "RequestValue" );
- }
- public cmdDonateMenu( id )
- {
- new gMenu = menu_create( "Donate Menu", "subDonateMenu" );
- menu_additem( gMenu, "Make a Donation", "0" );
- menu_additem( gMenu, "Request a Donation^n", "1" );
- new szItem[ 128 ];
- formatex( szItem, charsmax( szItem ), "Allow Donation Request:\r O%s", AllowDonate[ id ] ? "n" : "ff" );
- menu_additem( gMenu, szItem, "2" );
- menu_display( id, gMenu );
- }
- public subDonateMenu( id, gMenu, gItem )
- {
- if ( gItem == MENU_EXIT )
- {
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- switch ( gItem )
- {
- case 0:
- {
- cmdDonate( id );
- }
- case 1:
- {
- cmdRequest( id );
- }
- case 2:
- {
- AllowDonate[ id ] = !AllowDonate[ id ];
- ColorChat( id, "Donation Request - %sabled", AllowDonate[ id ] ? "^4En" : "^3Dis" );
- cmdDonateMenu( id );
- }
- }
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- public cmdRequest( id )
- {
- new players[ 32 ], pnum;
- new szName[ 32 ], szTempId[ 3 ], gMenuItem[ 64 ], szAddItem[ 64 ];
- new gMenu = menu_create( "Donate to a Player Menu", "subRequest" );
- formatex( gMenuItem, 63, "\yYou will request a donation of:\r %d", gReq[ id ] );
- menu_additem( gMenu, gMenuItem, "0" );
- get_players( players, pnum, "c" );
- for( new i=0; i<pnum; i+=1 )
- {
- new tempid = players[ i ];
- num_to_str( tempid, szTempId, charsmax( szTempId ) );
- get_user_name( tempid, szName, charsmax( szName ) );
- new gMoney = cs_get_user_money( tempid );
- formatex( szAddItem, charsmax( szAddItem ), "\w%s \y[\d %i$ \y]", szName, gMoney );
- /*if ( id == tempid )
- return PLUGIN_HANDLED;*/
- menu_additem( gMenu, szAddItem, szTempId );
- }
- menu_setprop( gMenu, MPROP_EXITNAME, "Close Menu" );
- menu_setprop( gMenu, MPROP_PERPAGE, 6 );
- menu_display( id, gMenu );
- return PLUGIN_CONTINUE;
- }
- public subRequest( id, gMenu, gItem )
- {
- new szData[ 6 ], iName[ 64 ];
- new gAccess, gCallback;
- menu_item_getinfo( gMenu, gItem, gAccess, szData, charsmax( szData ), iName, charsmax( iName ), gCallback );
- if( gItem == MENU_EXIT )
- {
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- switch ( gItem )
- {
- case 0:
- {
- client_cmd( id, "messagemode _req_" );
- return PLUGIN_HANDLED;
- }
- }
- new tempid = str_to_num( szData );
- new szTempid[ 32 ], szName[ 32 ];
- get_user_name( id, szName, charsmax( szName ) );
- get_user_name( tempid, szTempid, charsmax( szTempid ) );
- //new gMoney = cs_get_user_money( id );
- new iMoney = cs_get_user_money( tempid )
- if ( AllowDonate[ tempid ] )
- {
- ColorChat( id, "This player does not^3 Allow Donation Requests^1!" );
- cmdRequest( id )
- return PLUGIN_HANDLED;
- }
- if ( gReq[ id ] > iMoney )
- {
- ColorChat( id, "The player you have chosen to request a donation from does ^3 Not^1 have this amount of^4 Money^1." );
- cmdRequest( id );
- return PLUGIN_HANDLED;
- }
- if ( !is_user_connected( tempid ) )
- {
- ColorChat( id, "The player you wish to request a donation from is^3 Not Connected^1." );
- return PLUGIN_HANDLED;
- }
- ReqDonate( tempid, id );
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- public ReqDonate( tempid, id )
- {
- new gTitle[ 128 ], szName[ 32 ];
- get_user_name( id, szName, 32 );
- formatex( gTitle, charsmax( gTitle ), "%s\w has requested you for a donation of:\r %d$^n\wDo you aceept?", szName, gReq[ id ] )
- new gMenu = menu_create( gTitle, "subReq" );
- menu_additem( gMenu, "Yes, I accept the donation request", "1" );
- menu_additem( gMenu, "No, I decline the donation request", "2" );
- menu_display( tempid, gMenu );
- }
- public subReq( client, gMenu, gItem )
- {
- if ( gItem == MENU_EXIT )
- {
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- new gData[ 6 ], iName[ 64 ];
- new gAccess, gCallback;
- menu_item_getinfo( gMenu, gItem, gAccess, gData, 5, iName, 63, gCallback );
- new szName[ 32 ], szName2[ 32 ], szKey[ 10 ], szClient[ 10 ];
- parse( gData, szKey, charsmax( szKey ), szClient, charsmax( szClient ) );
- new id = str_to_num( szClient );
- get_user_name( id, szName2, 31 );
- get_user_name( client, szName, 31 );
- new gMoney = cs_get_user_money( client );
- new iMoney = cs_get_user_money( id )
- switch( gItem )
- {
- case 1:
- {
- ColorChat( 0, "^4%s^1 has accepted the donation request from ^3%s^1 and transfered to him^4 %i$^1.", szName, szName2, gReq[ id ] );
- cs_set_user_money( client, gMoney - gReq[ id ] );
- cs_set_user_money( id, iMoney + gReq[ id ] );
- }
- case 2:
- {
- ColorChat( id, "^4%s^1 has declined your donation request!" );
- }
- }
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- public RequestValue( id )
- {
- new Arg[ 128 ];
- read_args( Arg, charsmax( Arg ) );
- remove_quotes( Arg );
- new g_Nums[ 1 ];
- g_Nums[ 0 ] = str_to_num( Arg );
- new gMoney = cs_get_user_money( id );
- if ( !is_str_num( Arg ) )
- return PLUGIN_HANDLED;
- if ( g_Nums[ 0 ] < 100 )
- {
- ColorChat( id, "The value of^3 money^1 must be greater than^4 100$" );
- client_cmd(id, "messagemode _req_");
- return PLUGIN_HANDLED;
- }
- if ( g_Nums[ 0 ] > 16000 )
- {
- ColorChat( id, "The value of^3 money^1 must be smaller than^4 16000$" );
- client_cmd(id, "messagemode _req_");
- return PLUGIN_HANDLED;
- }
- if ( g_Nums[ 0 ] > gMoney )
- {
- ColorChat( id, "You don't have this amount of money." );
- client_cmd(id, "messagemode _req_");
- return PLUGIN_HANDLED;
- }
- gReq[ id ] = g_Nums[ 0 ];
- cmdRequest( id );
- return PLUGIN_HANDLED;
- }
- public cmdDonate( id )
- {
- new players[ 32 ], pnum;
- new szName[ 32 ], szTempId[ 3 ], gMenuItem[ 64 ], szAddItem[ 64 ];
- new gMenu = menu_create( "Donate to a Player Menu", "subDonate" );
- formatex( gMenuItem, 63, "\yYou will donate:\r %d", gDonate[ id ] );
- menu_additem( gMenu, gMenuItem, "0" );
- get_players( players, pnum, "c" );
- for( new i=0; i<pnum; i+=1 )
- {
- new tempid = players[ i ];
- num_to_str( tempid, szTempId, charsmax( szTempId ) );
- get_user_name( tempid, szName, charsmax( szName ) );
- new gMoney = cs_get_user_money( tempid );
- formatex( szAddItem, charsmax( szAddItem ), "\w%s \y[\d %i$ \y]", szName, gMoney );
- if ( id == tempid )
- return PLUGIN_HANDLED;
- menu_additem( gMenu, szAddItem, szTempId );
- }
- menu_setprop( gMenu, MPROP_EXITNAME, "Close Menu" );
- menu_setprop( gMenu, MPROP_PERPAGE, 6 );
- menu_display( id, gMenu );
- return PLUGIN_CONTINUE;
- }
- public subDonate( id, gMenu, gItem )
- {
- new szData[ 6 ], iName[ 64 ];
- new gAccess, gCallback;
- menu_item_getinfo( gMenu, gItem, gAccess, szData, charsmax( szData ), iName, charsmax( iName ), gCallback );
- if( gItem == MENU_EXIT )
- {
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- switch ( gItem )
- {
- case 0:
- {
- client_cmd( id, "messagemode _donate_" );
- return PLUGIN_HANDLED;
- }
- }
- new tempid = str_to_num( szData );
- new szTempid[ 32 ], szName[ 32 ];
- get_user_name( id, szName, charsmax( szName ) );
- get_user_name( tempid, szTempid, charsmax( szTempid ) );
- new gMoney = cs_get_user_money( id );
- new iMoney = cs_get_user_money( tempid )
- if ( gDonate[ id ] > gMoney )
- {
- ColorChat( id, "You don't have this amount of^4 money^1 to^3 donate^1." );
- cmdDonate( id );
- return PLUGIN_HANDLED;
- }
- if ( gDonate[ id ] <= 0 )
- {
- ColorChat( id, "You must type in number for the value^3 money^1. ");
- cmdDonate( id );
- return PLUGIN_HANDLED;
- }
- if ( !is_user_connected( tempid ) )
- {
- ColorChat( id, "The player you wish to donate to is^3 Not Connected^1." );
- return PLUGIN_HANDLED;
- }
- cs_set_user_money( id, gMoney - gDonate[ id ] );
- cs_set_user_money( tempid, iMoney + gDonate[ id ] );
- ColorChat( 0, "^4%s^3 (^1%i^3)^1 just donated^3 %d$^1 to^4 %s^3 (^1%i^3)^1.", szName, gMoney, gDonate[ id ], szTempid, iMoney );
- gDonate[ id ] = 0;
- menu_destroy( gMenu );
- return PLUGIN_HANDLED;
- }
- public DonateValue( id )
- {
- new Arg[ 128 ];
- read_args( Arg, charsmax( Arg ) );
- remove_quotes( Arg );
- new g_Nums[ 1 ];
- g_Nums[ 0 ] = str_to_num( Arg );
- new gMoney = cs_get_user_money( id );
- if ( !is_str_num( Arg ) )
- return PLUGIN_HANDLED;
- if ( g_Nums[ 0 ] < 100 )
- {
- ColorChat( id, "The value of^3 money^1 must be greater than^4 100$" );
- client_cmd(id, "messagemode _donate_");
- return PLUGIN_HANDLED;
- }
- if ( g_Nums[ 0 ] > 16000 )
- {
- ColorChat( id, "The value of^3 money^1 must be smaller than^4 16000$" );
- client_cmd(id, "messagemode _donate_");
- return PLUGIN_HANDLED;
- }
- if ( g_Nums[ 0 ] > gMoney )
- {
- ColorChat( id, "You don't have this amount of money." );
- client_cmd(id, "messagemode _donate_");
- return PLUGIN_HANDLED;
- }
- gDonate[ id ] = g_Nums[ 0 ];
- cmdDonate( id );
- return PLUGIN_HANDLED;
- }
- stock ColorChat( const id, const string[], any:... )
- {
- new msg[ 191 ], players[ 32 ], count = 1;
- static len; len = formatex( msg, charsmax( msg ), "^3[^4 Rage ^3]^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( );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement