Raised This Month: $ Target: $400
 0% 

Pay For It Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Silent Sniper
Member
Join Date: May 2006
Location: UK
Old 05-12-2006 , 10:46   Pay For It Help
Reply With Quote #1

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <vault> #include <engine> #define KeysPayForItMenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8) // Keys: 123456789 new bool:ammo[33] new bool:noflash[33] new g_nMsgScreenFade new bool:norecoil[33] new bool:speed[33] public plugin_init() {     register_plugin("PayForIt","1.0","Fire")         register_cvar("sv_payforit","1")     register_cvar("silentwalk_cost", "500")     register_cvar("noclip_cost", "500")     register_cvar("looklikeenemy_cost", "500")     register_cvar("ammo_cost", "500")     register_cvar("invisibility_cost", "500")     register_cvar("noflash_cost", "500")     register_cvar("norecoil_cost", "500")     register_cvar("speed_cost", "500")         register_clcmd( "payforit_menu","ShowPayForItMenu")     register_clcmd( "say /pfm","ShowPayForItMenu")     register_clcmd( "admin_say /pfm","ShowPayForItMenu")         register_event("CurWeapon","check_ammo","be","1=1")     register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")     register_event("CurWeapon","change_weapon","be","1=1")     register_event("ResetHUD","RoundStart","b")     register_menucmd(register_menuid("PayForItMenu"), KeysPayForItMenu, "PressedPayForItMenu")         set_task(0.1,"fast",0,"",0,"b")     g_nMsgScreenFade = get_user_msgid("ScreenFade")     } public ShowPayForItMenu(id) {     show_menu(id, KeysPayForItMenu, "Menu: ^n1:  SilentWalk ^n2:  NoClip^n3:  Look Like Enemy ^n4:  Ammo ^n5:  Invisibility  ^n6:  NoFlash ^n7:  NoRecoil ^n8:  Speed ^n9:  Exit^n", -1, "PayForItMenu") // Display menu } public PressedPayForItMenu(id, key) {     /* Menu:     * Menu:     * 1:  SilentWalk     * 2:  NoClip     * 3:  Look Like Enemy     * 4:  Ammo     * 5:  Invisibility       * 6:  NoFlash     * 7:  NoRecoil     * 8:  Speed     * 9:  Exit     */         switch (key) {         case 0: { // 1             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new silentwalkcost = get_cvar_num("silentwalk_cost")                         if(money < silentwalkcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", silentwalkcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - silentwalkcost)             set_user_footsteps(id, 1)             client_print(id, print_chat, "[PFI] Now No one Can Hear You Walking!")          }         case 1: { // 2             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noclipcost = get_cvar_num("noclip_cost")                         if(money < noclipcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noclipcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noclipcost)             set_user_noclip(id, 1)             client_print(id, print_chat, "[PFI] You Now Have NoClip!")          }         case 2: { // 3             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new looklikeenemycost = get_cvar_num("looklikeenemy_cost")                         if(money < looklikeenemycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", looklikeenemycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - looklikeenemycost)                         if (get_user_team(id)==1)                 cs_set_user_model(id, "urban")                         if (get_user_team(id)==2)                 cs_set_user_model(id, "guerilla")                         client_print(id, print_chat, "[PFI] Now You Look Like The Enemy!")           }         case 3: { // 4             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new ammocost = get_cvar_num("ammo_cost")                         if(money < ammocost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", ammocost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - ammocost)             ammo[id]=true             client_print(id, print_chat, "[PFI] Now You Have Unlimted Ammo!")           }         case 4: { // 5             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new invisibilitycost = get_cvar_num("invisibility_cost")                         if(money < invisibilitycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", invisibilitycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - invisibilitycost)             set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd,30)                         client_print(id, print_chat, "[PFI] Now No one Can See You!")           }         case 5: { // 6             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noflashcost = get_cvar_num("noflash_cost")                         if(money < noflashcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noflashcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noflashcost)             noflash[id]=true             client_print(id, print_chat, "[PFI] Now You Cant Be Flashed!")          }         case 6: { // 7             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new norecoilcost = get_cvar_num("norecoil_cost")                         if(money < norecoilcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", norecoilcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - norecoilcost)             norecoil[id]=true             client_print(id, print_chat, "[PFI] Now You Have No Recoil!")           }         case 7: { // 8             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new speedcost = get_cvar_num("speed_cost")                         if(money < speedcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", speedcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - speedcost)             speed[id]=true             client_cmd(id,"cl_forwardspeed 999")             client_cmd(id,"cl_sidespeed 999")             client_cmd(id,"cl_backspeed 999")             client_print(id, print_chat, "[PFI] Now You Are Much Faster!")          }         case 8: { // 9             client_print(id, print_chat, "[PFI] You Have Exited The PayForIt Menu!")            }     }     return PLUGIN_CONTINUE } public check_ammo(id) {     new clip,wammo,weapon = get_user_weapon(id,clip,wammo)         if(weapon == CSW_HEGRENADE     || weapon == CSW_SMOKEGRENADE     || weapon == CSW_FLASHBANG     || weapon == CSW_C4) return PLUGIN_CONTINUE         if(!(clip) && (ammo[id] == true))     {         new weap[32]         get_weaponname(weapon,weap,31)                 give_item(id,weap)                 engclient_cmd(id,weap)         engclient_cmd(id,weap)         engclient_cmd(id,weap)     }         return PLUGIN_CONTINUE } public FlashedEvent(id) {     if(!noflash[id])     {         return PLUGIN_CONTINUE     }     message_begin( MSG_ONE,g_nMsgScreenFade,{0,0,0},id )     write_short( read_data( 1 ) )   // Duration     write_short( read_data( 2 ) )   // Hold time     write_short( read_data( 3 ) )   // Fade type     write_byte (0)          // Red     write_byte (0)          // Green     write_byte (0)          // Blue     write_byte (0)          // Alpha     message_end()     return PLUGIN_HANDLED } public change_weapon(id) {     if (norecoil[id])         {         entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})     } } public fast() {     for(new i=0;i<=32;i++)     {         if(is_user_connected(i))         {             if(speed[i])             {                 server_cmd("sv_maxspeed 1000")                 set_user_maxspeed(i,1000.0)             }         }     }     return PLUGIN_HANDLED } public RoundStart(id) {     ammo[id]=false     noflash[id]=false     norecoil[id]=false     speed[id]=false     client_cmd(id,"cl_forwardspeed 400")     client_cmd(id,"cl_sidespeed 400")     client_cmd(id,"cl_backspeed 400")     set_user_footsteps (id, 0)     set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderNormal,255)     cs_reset_user_model(id) }

What i need here is...

Could some one please make it so that only a admin can use this...

and could you add stuff fun to it please BTW could you put little help marks on it (//) so that i know what it does because im new at this and trying to learn

Thanks Alot[/small]
__________________
Silent Sniper
Silent Sniper is offline
Send a message via AIM to Silent Sniper
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-12-2006 , 11:30  
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <vault> #include <engine> #define KeysPayForItMenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<Cool // Keys: 123456789 new bool:ammo[33]   //bool can either by true(1) or false(0) new bool:noflash[33]    //[33] means it has 33 slots ranging from 0 to 32             //Player id's range from 1 to 32 so slot 0 wont be used new bool:norecoil[33]   //In this example let's say id is 6 new bool:speed[33]  // ammo[id] = true   this means set slot 6 to true (1) new g_nMsgScreenFade // normal integer varaiable with no slots public plugin_init() {     // (Plugin name, Version, Author)     register_plugin("PayForIt","1.0","Fire")         // Make a cvar and make it's value 1     register_cvar("sv_payforit","1")     register_cvar("silentwalk_cost", "500")     register_cvar("noclip_cost", "500")     register_cvar("looklikeenemy_cost", "500")     register_cvar("ammo_cost", "500")     register_cvar("invisibility_cost", "500")     register_cvar("noflash_cost", "500")     register_cvar("norecoil_cost", "500")     register_cvar("speed_cost", "500")         register_clcmd( "payforit_menu","ShowPayForItMenu", ADMIN_MENU) /* clcmds are client commands which can be used*/     register_clcmd( "say /pfm","ShowPayForItMenu", ADMIN_MENU)  /* by players*/     register_clcmd( "admin_say /pfm","ShowPayForItMenu", ADMIN_MENU)    /*(command you type, function it calls, access needed)*/         //calls check_ammo when CurWeapon event is triggered. 1=1 means the weapon must be active (current weapon)     register_event("CurWeapon","check_ammo","be","1=1")         register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")         //no idea why this is registed twice as it can be done in 1 function     register_event("CurWeapon","change_weapon","be","1=1")         // calls RoundStart function when a player's hud resets (when they spawn)     register_event("ResetHUD","RoundStart","b")         register_menucmd(register_menuid("PayForItMenu"), KeysPayForItMenu, "PressedPayForItMenu")         // repeat the "fast" function every 0.1 seconds     set_task(0.1,"fast",0,"",0,"b")         g_nMsgScreenFade = get_user_msgid("ScreenFade")     } public ShowPayForItMenu(id, level, cid) {     // if they dont have access... (1 is total amount of arguments, command included)     if (!cmd_access(id, level, cid, 1))         // stop the function and dont continue to engine (the chat message wont appear)         // code below will not be executed (menu will not show up)         return PLUGIN_HANDLED         // Show the menu     show_menu(id, KeysPayForItMenu, "Menu: ^n1:  SilentWalk ^n2:  NoClip^n3:  Look Like Enemy ^n4:  Ammo ^n5:  Invisibility  ^n6:  NoFlash ^n7:  NoRecoil ^n8:  Speed ^n9:  Exit^n", -1, "PayForItMenu") // Display menu         return PLUGIN_HANDLED } public PressedPayForItMenu(id, key) {     /* Menu:     * Menu:     * 1:  SilentWalk     * 2:  NoClip     * 3:  Look Like Enemy     * 4:  Ammo     * 5:  Invisibility       * 6:  NoFlash     * 7:  NoRecoil     * 8:  Speed     * 9:  Exit     */         // switch is a faster way of doing alot of if's     // for example:     // if (key == 0)     // if (key == 1)     // etc     switch (key)     {         // if the key code pressed is 0 (it's actually 1)         // when seen while playing                 // this is the same as:         // if (key == 0)         case 0:         { // 1              // if the cvar sv_payforit is 0...             if(get_cvar_num("sv_payforit") == 0)             {                 // Show a chat message to the person who pressed the key on the menu                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         // get his money and put it in a new variable called 'money'             new money = cs_get_user_money(id)             new silentwalkcost = get_cvar_num("silentwalk_cost")                         // if he has less money than needed             if(money < silentwalkcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", silentwalkcost)                 // stop the function and continue to engine (code below won't be executed)                 return PLUGIN_CONTINUE             }                         // he had enough money, now take some away for the cost             cs_set_user_money(id, money - silentwalkcost)             // 1 means no foot steps, 0 means footsteps             set_user_footsteps(id, 1)             client_print(id, print_chat, "[PFI] Now No one Can Hear You Walking!")             }         // if key == 1         case 1:         { // 2             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noclipcost = get_cvar_num("noclip_cost")                         if(money < noclipcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noclipcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noclipcost)             set_user_noclip(id, 1)             client_print(id, print_chat, "[PFI] You Now Have NoClip!")             }         // if key == 2         case 2:         { // 3             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new looklikeenemycost = get_cvar_num("looklikeenemy_cost")                         if(money < looklikeenemycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", looklikeenemycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - looklikeenemycost)                         // if his team is TERRORIST...             if (get_user_team(id)==1)                 // give him ct model                 cs_set_user_model(id, "urban")                         // if his team is CT...             if (get_user_team(id)==2)                 // give him terrorist model                 cs_set_user_model(id, "guerilla")                         client_print(id, print_chat, "[PFI] Now You Look Like The Enemy!")             }         // if key == 3         case 3:         { // 4             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new ammocost = get_cvar_num("ammo_cost")                         if(money < ammocost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", ammocost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - ammocost)             // if id were 6 then slot 6 of ammo[33] would be true             // this is so we can check if he has unlimited ammo later on             ammo[id]=true             client_print(id, print_chat, "[PFI] Now You Have Unlimted Ammo!")             }         // if key == 4         case 4:         { // 5             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new invisibilitycost = get_cvar_num("invisibility_cost")                         if(money < invisibilitycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", invisibilitycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - invisibilitycost)             // Makes him appear transparent, 30 is how much transparent he will be             // 0 would be totally invisible             set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd,30)                         client_print(id, print_chat, "[PFI] Now No one Can See You!")             }         // if key == 5         case 5:         { // 6             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noflashcost = get_cvar_num("noflash_cost")                         if(money < noflashcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noflashcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noflashcost)             noflash[id]=true             client_print(id, print_chat, "[PFI] Now You Cant Be Flashed!")             }         // if key == 6         case 6:         { // 7             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new norecoilcost = get_cvar_num("norecoil_cost")                         if(money < norecoilcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", norecoilcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - norecoilcost)             norecoil[id]=true             client_print(id, print_chat, "[PFI] Now You Have No Recoil!")             }         // if key == 7         case 7:         { // 8             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new speedcost = get_cvar_num("speed_cost")                         if(money < speedcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", speedcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - speedcost)             speed[id]=true             // makes the player execute a command             // this is so he can run fast             client_cmd(id,"cl_forwardspeed 999")             client_cmd(id,"cl_sidespeed 999")             client_cmd(id,"cl_backspeed 999")             client_print(id, print_chat, "[PFI] Now You Are Much Faster!")             }         // if key == 8         case 8:         { // 9             client_print(id, print_chat, "[PFI] You Have Exited The PayForIt Menu!")             }     }     return PLUGIN_CONTINUE } public check_ammo(id) {     new clip,wammo     // the function get_user_weapon returns a weapon id     // and it is put into the new variable 'weapon'     new weapon = get_user_weapon(id,clip,wammo)         // || means OR     // if the weapon is a hegrenade OR smokegrenade OR flashbang OR C4     // stop running the function and continue to engine     if(weapon == CSW_HEGRENADE     || weapon == CSW_SMOKEGRENADE     || weapon == CSW_FLASHBANG     || weapon == CSW_C4) return PLUGIN_CONTINUE         // && means AND     // if clip is empty AND he has unlimited ammo...     if(!(clip) && (ammo[id] == true))     {         new weap[32]         get_weaponname(weapon,weap,31)                 // give him the weapon he already had         // it will have full ammo         give_item(id,weap)                 // emulate the client doing a command         // in this case it switches to the gun         engclient_cmd(id,weap)         engclient_cmd(id,weap)         engclient_cmd(id,weap)     }         return PLUGIN_CONTINUE } public FlashedEvent(id) {     if(!noflash[id])     {         return PLUGIN_CONTINUE     }     message_begin( MSG_ONE,g_nMsgScreenFade,{0,0,0},id )     write_short( read_data( 1 ) )    // Duration     write_short( read_data( 2 ) )    // Hold time     write_short( read_data( 3 ) )    // Fade type     write_byte (0)            // Red     write_byte (0)            // Green     write_byte (0)            // Blue     write_byte (0)            // Alpha     message_end()     return PLUGIN_HANDLED } public change_weapon(id) {     // if he has no recoil...     if (norecoil[id])     {         entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})     } } public fast() {     // loops through all players     // 32 is the max number of players in     // the half-life engine     for(new i=0;i<=32;i++)     {         // if hes connected...         if(is_user_connected(i))         {             // if he has the speed boost             if(speed[i])             {                 // the server needs sv_maxspeed high to allow                 // higher speeds                 server_cmd("sv_maxspeed 1000")                 set_user_maxspeed(i,1000.0)             }         }     }     return PLUGIN_HANDLED } public RoundStart(id) // someone re-spawned...lets get rid of all their powers {     ammo[id]=false     noflash[id]=false     norecoil[id]=false     speed[id]=false     client_cmd(id,"cl_forwardspeed 400")     client_cmd(id,"cl_sidespeed 400")     client_cmd(id,"cl_backspeed 400")     set_user_footsteps (id, 0)     set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderNormal,255)     cs_reset_user_model(id) }
__________________
FatalisDK is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-12-2006 , 13:28  
Reply With Quote #3

Like I've said numerous times before, at least tell him what he did wrong.

I'll be splitting your posts into the Trash forum from now on when you don't do so.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-12-2006 , 14:57  
Reply With Quote #4

Edited... Thought it was request forum.
__________________
FatalisDK is offline
Silent Sniper
Member
Join Date: May 2006
Location: UK
Old 05-12-2006 , 19:02  
Reply With Quote #5

thnx guys
__________________
Silent Sniper
Silent Sniper is offline
Send a message via AIM to Silent Sniper
Silent Sniper
Member
Join Date: May 2006
Location: UK
Old 05-12-2006 , 20:02  
Reply With Quote #6

Sorry i never asked this before but could you by any chance make the menu stay on when i buy something

Just so that i dont have to keep pulling the menu up to buy one thing

Could i also have 0 as exit please on the menu

dont worry about the //comments i think i have enough comments on that thanks in advance/again for your help
__________________
Silent Sniper
Silent Sniper is offline
Send a message via AIM to Silent Sniper
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-12-2006 , 20:07  
Reply With Quote #7

Use this and it will keep showing until you exit the menu.
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <vault> #include <engine> #define KeysPayForItMenu (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<Cool // Keys: 123456789 new bool:ammo[33]   //bool can either by true(1) or false(0) new bool:noflash[33]    //[33] means it has 33 slots ranging from 0 to 32             //Player id's range from 1 to 32 so slot 0 wont be used new bool:norecoil[33]   //In this example let's say id is 6 new bool:speed[33]  // ammo[id] = true   this means set slot 6 to true (1) new g_nMsgScreenFade // normal integer varaiable with no slots public plugin_init() {     // (Plugin name, Version, Author)     register_plugin("PayForIt","1.0","Fire")         // Make a cvar and make it's value 1     register_cvar("sv_payforit","1")     register_cvar("silentwalk_cost", "500")     register_cvar("noclip_cost", "500")     register_cvar("looklikeenemy_cost", "500")     register_cvar("ammo_cost", "500")     register_cvar("invisibility_cost", "500")     register_cvar("noflash_cost", "500")     register_cvar("norecoil_cost", "500")     register_cvar("speed_cost", "500")         register_clcmd( "payforit_menu","ShowPayForItMenu", ADMIN_MENU) /* clcmds are client commands which can be used*/     register_clcmd( "say /pfm","ShowPayForItMenu", ADMIN_MENU)  /* by players*/     register_clcmd( "admin_say /pfm","ShowPayForItMenu", ADMIN_MENU)    /*(command you type, function it calls, access needed)*/         //calls check_ammo when CurWeapon event is triggered. 1=1 means the weapon must be active (current weapon)     register_event("CurWeapon","check_ammo","be","1=1")         register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")         //no idea why this is registed twice as it can be done in 1 function     register_event("CurWeapon","change_weapon","be","1=1")         // calls RoundStart function when a player's hud resets (when they spawn)     register_event("ResetHUD","RoundStart","b")         register_menucmd(register_menuid("PayForItMenu"), KeysPayForItMenu, "PressedPayForItMenu")         // repeat the "fast" function every 0.1 seconds     set_task(0.1,"fast",0,"",0,"b")         g_nMsgScreenFade = get_user_msgid("ScreenFade")     } public ShowPayForItMenu(id, level, cid) {     // if they dont have access... (1 is total amount of arguments, command included)     if (!cmd_access(id, level, cid, 1))         // stop the function and dont continue to engine (the chat message wont appear)         // code below will not be executed (menu will not show up)         return PLUGIN_HANDLED         ShowMyMenu(id)     return PLUGIN_HANDLED } public ShowMyMenu(id) {     // Show the menu     show_menu(id, KeysPayForItMenu, "Menu: ^n1:  SilentWalk ^n2:  NoClip^n3:  Look Like Enemy ^n4:  Ammo ^n5:  Invisibility  ^n6:  NoFlash ^n7:  NoRecoil ^n8:  Speed ^n9:  Exit^n", -1, "PayForItMenu") // Display menu     return PLUGIN_HANDLED; } public PressedPayForItMenu(id, key) {     /* Menu:     * Menu:     * 1:  SilentWalk     * 2:  NoClip     * 3:  Look Like Enemy     * 4:  Ammo     * 5:  Invisibility       * 6:  NoFlash     * 7:  NoRecoil     * 8:  Speed     * 9:  Exit     */         // switch is a faster way of doing alot of if's     // for example:     // if (key == 0)     // if (key == 1)     // etc     switch (key)     {         // if the key code pressed is 0 (it's actually 1)         // when seen while playing                 // this is the same as:         // if (key == 0)         case 0:         { // 1              // if the cvar sv_payforit is 0...             if(get_cvar_num("sv_payforit") == 0)             {                 // Show a chat message to the person who pressed the key on the menu                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         // get his money and put it in a new variable called 'money'             new money = cs_get_user_money(id)             new silentwalkcost = get_cvar_num("silentwalk_cost")                         // if he has less money than needed             if(money < silentwalkcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", silentwalkcost)                 // stop the function and continue to engine (code below won't be executed)                 return PLUGIN_CONTINUE             }                         // he had enough money, now take some away for the cost             cs_set_user_money(id, money - silentwalkcost)             // 1 means no foot steps, 0 means footsteps             set_user_footsteps(id, 1)             client_print(id, print_chat, "[PFI] Now No one Can Hear You Walking!")             }         // if key == 1         case 1:         { // 2             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noclipcost = get_cvar_num("noclip_cost")                         if(money < noclipcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noclipcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noclipcost)             set_user_noclip(id, 1)             client_print(id, print_chat, "[PFI] You Now Have NoClip!")             }         // if key == 2         case 2:         { // 3             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new looklikeenemycost = get_cvar_num("looklikeenemy_cost")                         if(money < looklikeenemycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", looklikeenemycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - looklikeenemycost)                         // if his team is TERRORIST...             if (get_user_team(id)==1)                 // give him ct model                 cs_set_user_model(id, "urban")                         // if his team is CT...             if (get_user_team(id)==2)                 // give him terrorist model                 cs_set_user_model(id, "guerilla")                         client_print(id, print_chat, "[PFI] Now You Look Like The Enemy!")             }         // if key == 3         case 3:         { // 4             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new ammocost = get_cvar_num("ammo_cost")                         if(money < ammocost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", ammocost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - ammocost)             // if id were 6 then slot 6 of ammo[33] would be true             // this is so we can check if he has unlimited ammo later on             ammo[id]=true             client_print(id, print_chat, "[PFI] Now You Have Unlimted Ammo!")             }         // if key == 4         case 4:         { // 5             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new invisibilitycost = get_cvar_num("invisibility_cost")                         if(money < invisibilitycost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", invisibilitycost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - invisibilitycost)             // Makes him appear transparent, 30 is how much transparent he will be             // 0 would be totally invisible             set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd,30)                         client_print(id, print_chat, "[PFI] Now No one Can See You!")             }         // if key == 5         case 5:         { // 6             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new noflashcost = get_cvar_num("noflash_cost")                         if(money < noflashcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", noflashcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - noflashcost)             noflash[id]=true             client_print(id, print_chat, "[PFI] Now You Cant Be Flashed!")             }         // if key == 6         case 6:         { // 7             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new norecoilcost = get_cvar_num("norecoil_cost")                         if(money < norecoilcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", norecoilcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - norecoilcost)             norecoil[id]=true             client_print(id, print_chat, "[PFI] Now You Have No Recoil!")             }         // if key == 7         case 7:         { // 8             if(get_cvar_num("sv_payforit") == 0)             {                 client_print(id, print_chat, "[PFI] This Plugin Is Disabled.")                 return PLUGIN_HANDLED                 }                         new money = cs_get_user_money(id)             new speedcost = get_cvar_num("speed_cost")                         if(money < speedcost)             {                 client_print(id, print_chat, "[PFI] You Don't Have Enough Money ($%i Needed).", speedcost)                 return PLUGIN_CONTINUE             }                         cs_set_user_money(id, money - speedcost)             speed[id]=true             // makes the player execute a command             // this is so he can run fast             client_cmd(id,"cl_forwardspeed 999")             client_cmd(id,"cl_sidespeed 999")             client_cmd(id,"cl_backspeed 999")             client_print(id, print_chat, "[PFI] Now You Are Much Faster!")             }         // if key == 8         case 8:         { // 9             client_print(id, print_chat, "[PFI] You Have Exited The PayForIt Menu!")             }     }     if(key != 8)         ShowMyMenu(id)     return PLUGIN_CONTINUE } public check_ammo(id) {     new clip,wammo     // the function get_user_weapon returns a weapon id     // and it is put into the new variable 'weapon'     new weapon = get_user_weapon(id,clip,wammo)         // || means OR     // if the weapon is a hegrenade OR smokegrenade OR flashbang OR C4     // stop running the function and continue to engine     if(weapon == CSW_HEGRENADE     || weapon == CSW_SMOKEGRENADE     || weapon == CSW_FLASHBANG     || weapon == CSW_C4) return PLUGIN_CONTINUE         // && means AND     // if clip is empty AND he has unlimited ammo...     if(!(clip) && (ammo[id] == true))     {         new weap[32]         get_weaponname(weapon,weap,31)                 // give him the weapon he already had         // it will have full ammo         give_item(id,weap)                 // emulate the client doing a command         // in this case it switches to the gun         engclient_cmd(id,weap)         engclient_cmd(id,weap)         engclient_cmd(id,weap)     }         return PLUGIN_CONTINUE } public FlashedEvent(id) {     if(!noflash[id])     {         return PLUGIN_CONTINUE     }     message_begin( MSG_ONE,g_nMsgScreenFade,{0,0,0},id )     write_short( read_data( 1 ) )    // Duration     write_short( read_data( 2 ) )    // Hold time     write_short( read_data( 3 ) )    // Fade type     write_byte (0)            // Red     write_byte (0)            // Green     write_byte (0)            // Blue     write_byte (0)            // Alpha     message_end()     return PLUGIN_HANDLED } public change_weapon(id) {     // if he has no recoil...     if (norecoil[id])     {         entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0})     } } public fast() {     // loops through all players     // 32 is the max number of players in     // the half-life engine     for(new i=0;i<=32;i++)     {         // if hes connected...         if(is_user_connected(i))         {             // if he has the speed boost             if(speed[i])             {                 // the server needs sv_maxspeed high to allow                 // higher speeds                 server_cmd("sv_maxspeed 1000")                 set_user_maxspeed(i,1000.0)             }         }     }     return PLUGIN_HANDLED } public RoundStart(id) // someone re-spawned...lets get rid of all their powers {     ammo[id]=false     noflash[id]=false     norecoil[id]=false     speed[id]=false     client_cmd(id,"cl_forwardspeed 400")     client_cmd(id,"cl_sidespeed 400")     client_cmd(id,"cl_backspeed 400")     set_user_footsteps (id, 0)     set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderNormal,255)     cs_reset_user_model(id) }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Silent Sniper
Member
Join Date: May 2006
Location: UK
Old 05-12-2006 , 20:09  
Reply With Quote #8

Thanks
__________________
Silent Sniper
Silent Sniper is offline
Send a message via AIM to Silent Sniper
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 05-12-2006 , 20:12  
Reply With Quote #9

Change this (1<<Cool to this (1<<8 )
Stupid smilies.
__________________
FatalisDK is offline
Silent Sniper
Member
Join Date: May 2006
Location: UK
Old 05-12-2006 , 20:13  
Reply With Quote #10

Welcome to the AMX Mod X 1.70-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "Cool" on line 49
Error: Array must be indexed (variable "-unknown-") on line 49
Error: Undefined symbol "Cool" on line 74
Error: Array must be indexed (variable "-unknown-") on line 74

4 Errors.
Could not locate output file C:\Program Files\Valve\Steam\SteamApps\**************\co unter-strike\cstrike\addons\amxmodx\scripting\amx_p ayforit.amx (compile failed).
__________________
Silent Sniper
Silent Sniper is offline
Send a message via AIM to Silent Sniper
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode