| closedWhy don't I get nades? |
| Started by Tank on 12-29-2008, 02:18 PM |
Threads: 59
Joined: Jan 2007
Am I doing something wrong here?nn
new amm_grenades[8] // contains the amount grenadesnn// Saving current player's ammount of grenadesn amm_grenades[id] = dod_get_user_ammo(id, DODW_HANDGRENADE) + dod_get_user_ammo(id, DODW_STICKGRENADE)nn//=========================================================n// Nade menun//=========================================================npublic display_menu_nade(id)n{n new szMenuBody[512]n // new mkeys = 0b0000000011n new mkeys = 3n new Len = format(szMenuBody,511,NADE_MENU)n n Len += format( szMenuBody[Len], 511, "^n
1. wAxis Stickgrenade")n Len += format( szMenuBody[Len], 511, "^n
2. wAllied Handgrenade")n //Len += format( szMenuBody[Len], 511, "^n
3. wBritish Millsgrenade")n n show_menu(id,mkeys,szMenuBody,25)n}nn//=========================================================n// Choices Nade menu, this is also where the menu stopsn//=========================================================npublic control_choice_nade(id,key)n{n if(!is_user_alive(id))n return PLUGIN_CONTINUEn n switch (key)n {n case 0: give_grenade(id, "weapon_stickgrenade")n case 1: give_grenade(id, "weapon_handgrenade")n }n return PLUGIN_HANDLEDn}nn//=========================================================n// Giving to player old amount of grenadesn//=========================================================npublic give_grenade(id, type[])n{n for(new i=0; i<amm_grenades[id]; i++)n give_item(id, type)n}Threads: 75
Joined: Nov 2007
Try this maybe (not tested!):rnrn
//=========================================================rn// Choices Nade menu, this is also where the menu stopsrn//=========================================================rnpublic control_choice_nade(id,key)rn{ rn if(!is_user_alive(id)) rn return PLUGIN_HANDLED rn switch (key) rn { rn case 0: give_grenade1(id) rn case 1: give_grenade2(id) rn } rn return PLUGIN_CONTINUErn}rn//=========================================================rn// Give nadern//=========================================================rnrnpublic give_grenade1(id)rn{ rn if(is_user_alive(id)) rn give_item(id,"weapon_stickgrenade") rn} rnpublic give_grenade2(id)rn{ rn if(is_user_alive(id)) rn give_item(id,"weapon_handgrenade") rn} Threads: 59
Joined: Jan 2007
Im giving the player a custom weapon loadout, so I save the amount of nades they have before stripping everything and after the stripping I want to return them to them in the nade class they choose.rnrnThe only problem is that I don't get a single nade. Your way would work would that would just always give them a nade. I figure once my players find out I can change my name to 24/7 nade fest.
Threads: 11
Joined: Dec 2007
Tank, i tried your plugin (that i corrected) and it worked fine on my server.rnGrenades where given without any problems.rnrnEDIT : Replace your return PLUGIN_HANDLED by a PLUGIN_CONTINUE in your control_choice_nade function.
Threads: 59
Joined: Jan 2007
EDIT:nnIm sorry, I always play Allies and I forgot to check for Axis. Funny thing, it seems to work perfectly for Axis, I get both my nades, however Allies don't get any.
Threads: 11
Joined: Dec 2007
While testing Tank's Plugin, i found some errors in the dod_get_user_ammo() function. (Only on linux server)rnrnThis plugin works now very well.rn- Axis grenades are in the DODW_HANDGRENADE (instead of DODW_STICKGRENADE)rn- Allies grenades are in DODW_BAR (and all heavy weapons) instead of DODW_HANDGRENADErnrnSee here : https://www.dodplugins.net/forums/showthread.php?p=11535
Threads: 59
Joined: Jan 2007
I have to say, this plugin works as a blast now thanks to h0 noMan, awesome stuff :D Tres Bien.rnrnAll which is left is to find a way to store options chosen in the menu and this plugin is ready to be used :D

