Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #pragma tabsize 0
- #define PLUGIN "Special Menu"
- #define VERSION "1.0"
- #define AUTHOR "eVo"
- new Director[256],
- bool:ParolaSetata[33] = false,
- Cumparat[33],
- Data[200],
- Secunde[33] = 0,
- BuySlot [33],
- BuyThunderBolt[33],
- Buythanatos9[33],
- BuyGoldDeagle[33],
- Slot,
- Thunderbolt,
- thanatos9,
- GoldDeagle,
- Timp;
- new Tag[] = "!g[BB.InDungi.Ro] ";
- native fcs_get_user_credits ( id );
- native fcs_set_user_credits ( id, credits );
- native give_thunderbolt(id)
- native give_zp_extra_thanatos9(id)
- native give_GoldDeagle(id)
- native bb_is_build_phase()
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd ( "say /special", "SpecialMenu" );
- register_clcmd ( "say_team /special", "SpecialMenu")
- register_clcmd ( "Introdu_Parola", "cmdPassword" );
- Slot = register_cvar ( "cvar_pret_slot", "25000" );
- Thunderbolt = register_cvar ( "cvar_pret_thunderbolt", "50000" );
- thanatos9 = register_cvar ( "cvar_pret_thanatos9", "50000" );
- GoldDeagle = register_cvar ( "cvar_pret_GoldDeagle", "50000" );
- Timp = register_cvar ( "cvar_timp_parola", "15" );
- }
- public client_putinserver ( id )
- {
- Secunde [id] = 0;
- ParolaSetata [id] = false;
- }
- public client_disconnect ( id ) ParolaSetata [id] = false;
- public SpecialMenu(id)
- {
- new Menu = menu_create ( "[BB.InDungi.Ro] Special Menu", "SpecialGiver" );
- new Credite = fcs_get_user_credits ( id );
- formatex ( BuySlot, charsmax ( BuySlot ), "Cumpara SLOT \r[%d Euro]", get_pcvar_num ( Slot ) )
- formatex ( BuyThunderBolt, charsmax ( BuyThunderBolt ), "ThunderBolt \rCSO \r[%d Euro]", get_pcvar_num ( Thunderbolt ) )
- formatex ( Buythanatos9, charsmax ( Buythanatos9 ), "thanatos9 \rCSO \r[%d Euro]", get_pcvar_num ( thanatos9 ) )
- formatex ( BuyGoldDeagle, charsmax ( BuyGoldDeagle ), "Gold \rDeagle\r[%d Euro]", get_pcvar_num ( GoldDeagle ) )
- if ( Credite < get_pcvar_num ( Slot ) || get_user_flags ( id ) & read_flags ( "b" ) )
- menu_additem ( Menu, "\dCumpara SLOT \r[Indisponibil]");
- else
- menu_additem ( Menu, BuySlot, "1");
- if ( Credite < get_pcvar_num ( Thunderbolt ) || get_user_team(id) == 1 || bb_is_build_phase() )
- menu_additem ( Menu, "\dThunderBolt \rCSO");
- else
- menu_additem ( Menu, BuyThunderBolt, "2");
- if ( Credite < get_pcvar_num ( thanatos9) || get_user_team(id) == 1 || bb_is_build_phase() )
- menu_additem ( Menu, "\dThanatos9 \rCSO \rKnife");
- else
- menu_additem ( Menu, Buythanatos9, "3");
- if ( Credite < get_pcvar_num ( GoldDeagle ) || get_user_team(id) == 1 || bb_is_build_phase() )
- menu_additem ( Menu, "\dGold \rDeagle\");
- else
- menu_additem ( Menu, BuyGoldDeagle, "4");
- menu_setprop ( Menu, MPROP_EXIT, MEXIT_ALL );
- menu_display ( id, Menu, 0 );
- return PLUGIN_HANDLED;
- }
- public SpecialGiver ( id, Menu, item )
- {
- if ( !is_user_connected ( id ) ) return PLUGIN_HANDLED;
- if ( item == MENU_EXIT )
- {
- menu_destroy ( Menu );
- return PLUGIN_HANDLED;
- }
- new iData [6], iName [64];
- new access, callback;
- menu_item_getinfo ( Menu, item, access, iData,5, iName, 63, callback );
- new Key = str_to_num ( iData );
- new Credite = fcs_get_user_credits ( id );
- switch( Key )
- {
- case 1:
- {
- if ( get_user_flags ( id ) & read_flags ( "b" ) )
- {
- ChatColor ( id, "%s!team Ai deja !gSLOT!team!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED
- }
- if ( Credite < get_pcvar_num ( Slot ) )
- {
- ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- else
- {
- client_cmd ( id, "messagemode Introdu_Parola" );
- Secunde [id] = get_pcvar_num ( Timp );
- Cumparat [id] = 1;
- Cautare ( id );
- ParolaSetata [id] = true;
- }
- return PLUGIN_HANDLED;
- }
- case 2:
- {
- if ( Credite < get_pcvar_num ( Thunderbolt ) )
- {
- ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if( get_user_team(id) == 1 )
- {
- ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if ( bb_is_build_phase() )
- {
- ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- else
- {
- give_thunderbolt(id);
- fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( Thunderbolt ))
- ChatColor ( id, "%s!team Succes! Ai cumparat !gThunderBolt Sniper!team!", Tag );
- return 1;
- }
- }
- case 3:
- {
- if ( Credite < get_pcvar_num ( thanatos9 ) )
- {
- ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if( get_user_team(id) == 1 )
- {
- ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if ( bb_is_build_phase() )
- {
- ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- else
- {
- give_zp_extra_thanatos9(id);
- fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( thanatos9 ))
- ChatColor ( id, "%s!team Succes! Ai cumparat !gM4a1 Magnum!team!", Tag );
- return 1;
- }
- }
- case 4:
- {
- if ( Credite < get_pcvar_num ( GoldDeagle ) )
- {
- ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if( get_user_team(id) == 1 )
- {
- ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- if ( bb_is_build_phase() )
- {
- ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
- SpecialMenu ( id );
- return PLUGIN_HANDLED;
- }
- else
- {
- give_GoldDeagle(id);
- fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( GoldDeagle ))
- ChatColor ( id, "%s!team Succes! Ai cumparat !gGoldDeagle wow!team!", Tag );
- return 1;
- }
- }
- }
- return PLUGIN_HANDLED;
- }
- public Cautare ( id )
- {
- if ( !is_user_connected ( id ) )
- Secunde [id] = 0;
- if ( Secunde [id] > 1 )
- {
- Secunde [id] --;
- set_hudmessage ( 0, 255, 0, 0.05, 0.25, 0, 6.0, 1.0 )
- show_hudmessage ( id, "Ai la dispozite %i secunde sa introduci parola !", Secunde [id] );
- set_task ( 1.0, "Cautare", id );
- }
- else if ( Secunde [id] <= 1 )
- {
- ParolaSetata [id] = false;
- ChatColor ( id, "%s!team A expirat timpul! Inregistrarea a esuat! Nu ti-au fost retrasi Euro!", Tag );
- Secunde [id] = 0;
- }
- }
- public cmdPassword ( id )
- {
- new Password [32]; read_argv ( 1, Password, charsmax ( Password ) );
- static Name [32]; get_user_name ( id, Name, charsmax ( Name ) );
- get_configsdir ( Director, charsmax ( Director ) );
- formatex ( Director, charsmax ( Director ), "%s/users.ini", Director );
- if ( Cumparat [id] == 1 )
- {
- formatex ( Data, charsmax ( Data ), "^"%s^" ^"%s^" ^"b^" ^"a^" ; Acces Cumparat Din Special Menu", Name, Password );
- }
- if ( ParolaSetata [id] )
- {
- if ( Password [0] )
- {
- ParolaSetata [id] = false;
- remove_task ( id );
- CautareUser ( id );
- write_file ( Director, Data );
- set_user_info ( id, "_eVo", Password );
- set_task ( 2.0, "ReloadAdmins" );
- if ( Cumparat [id] == 1 )
- {
- fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( Slot ))
- ChatColor ( id, "%s!team Ai cumparat !gSLOT!team cu succes! Nume:!g%s!team, Parola:!g%s!team ! ", Tag, Name, Password );
- }
- }
- else
- {
- ChatColor ( id, "%s!team Parola introdusa este invalida! Te rugam incearca din nou!", Tag );
- client_cmd ( id, "messagemode register" );
- return PLUGIN_HANDLED;
- }
- }
- else
- {
- ChatColor ( id, "%s!team A expirat timpul deja! Te rugam sa incerci din nou!", Tag );
- return PLUGIN_HANDLED;
- }
- return PLUGIN_HANDLED;
- }
- public ReloadAdmins ( ) server_cmd ( "amx_reloadadmins" );
- public CautareUser ( id )
- {
- new FileName [64]; get_configsdir ( FileName, charsmax ( FileName ) );
- add ( FileName, charsmax ( FileName ), "/users.ini" );
- new File, Line;
- new Name [32]; get_user_name ( id, Name, charsmax ( Name ) );
- ReadFile:
- File = fopen ( FileName , "rt" );
- Line = -1;
- if ( File )
- {
- new Format [256], i, Key [32];
- while ( !feof ( File ) )
- {
- Line ++;
- fgets ( File, Format, charsmax ( Format ) );
- trim ( Format );
- i = Format [0];
- if ( i && i != '#' && i != ';' && !( i == '/' && Format [1] == '/' ) )
- {
- parse ( Format, Key, charsmax ( Key ) );
- if ( equal ( Key, Name ) )
- {
- fclose ( File );
- File = 0;
- write_file ( FileName, "", Line );
- goto ReadFile;
- }
- }
- }
- fclose ( File );
- File = 0;
- }
- }
- //********************STOCK-URI********************
- stock ChatColor(const id, const input[], any:...)
- {
- new count = 1, players[32]
- static msg[191]
- vformat(msg, 190, input, 3)
- replace_all(msg, 190, "!g", "^4")
- replace_all(msg, 190, "!y", "^1")
- replace_all(msg, 190, "!team", "^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