weapon_locker() { wait 2; weapon_locker = getEnt( "weapon_locker", "targetname" ); weapon_locker setHintString( "press & hold &&1 to store current weapon" ); weapon_locker setCursorHint( "HINT_NOICON" ); while( 1 ) { weapon_locker waittill( "trigger", user ); if( is_player_valid( user )) { user.old_gun = user getcurrentweapon(); user.gun_ammo = user GetAmmoCount( user.old_gun ); user.gun_ammo_clip = user GetWeaponAmmoClip(user.old_gun);
// this line is for non valid weapons, such as perk bottles, knuckle crack and the syringe when reviving, this should only need to be changed if adding extra perks etc. if (!( user.old_gun == "none" || user.old_gun == "syrette" || user.old_gun == "zombie_melee" || user.old_gun == "zombie_perk_bottle_revive" || user.old_gun == "zombie_perk_bottle_doubletap" || user.old_gun == "zombie_perk_bottle_jugg" || user.old_gun == "zombie_perk_bottle_sleight" || user.old_gun == "zombie_perk_bottle_staminup" || user.old_gun == "zombie_perk_bottle_phd" || user.old_gun == "zombie_perk_bottle_mulekick" || user.old_gun == "zombie_perk_bottle_deadshot" || user.old_gun == "zombie_perk_bottle_cherry" || user.old_gun == "zombie_perk_bottle_vulture" || user.old_gun == "zombie_knuckle_crack" || user.old_gun == "stielhandgranate" || user.old_gun == "zombie_cymbal_monkey" || user.old_gun == "zombie_bowie_flourish" )) { primaryWeapons = user GetWeaponsListPrimaries(); if( ( isDefined( primaryWeapons ) && primaryWeapons.size == 1 || isDefined( primaryWeapons ) && primaryWeapons.size == 2 && user hasPerk ( "specialty_extraammo" ) ) && user.has_stored_weapon == 1 ) { if ( isDefined( level.harry_perks_fix ) && level.harry_perks_fix ) harrybo21_give_gun( user.old_gun ); else user giveweapon( user.stored_weapon );
user SetWeaponAmmoStock(user.stored_weapon,user.stored_gun_ammo); user SetWeaponAmmoClip(user.stored_weapon,user.stored_ammo_clip); user switchtoweapon( user.stored_weapon ); user.has_stored_weapon = 0; user SetStat(3009,0); } else // the following line is for weapons that you do not want storeable, i added some from my own map and advise customizing for weapons in your own map. zombie colt should be changed to your starting weapon if ( user.old_gun == "colt" || user.old_gun == "zombie_colt" || user.old_gun == "zombie_colt_upgraded" || user.old_gun == "tesla_gun" || user.old_gun == "tesla_gun_upgraded" || user.old_gun == "thundergun" || user.old_gun == "thundergun_upgraded" || user.old_gun == "ray_gun" || user.old_gun == "ray_gun_upgraded" || user.old_gun == "scavenger" || user.old_gun == "scavenger_upgraded" || user.old_gun == "vorkuta_knife" || user.old_gun == "vorkuta_knife_upgraded" ) { user iPrintLnBold("^7cannot store this weapon"); wait 2; } else { primaryWeapons = user GetWeaponsListPrimaries(); if(!( isDefined( primaryWeapons ) && primaryWeapons.size == 1 || isDefined( primaryWeapons ) && primaryWeapons.size == 2 && user hasPerk ( "specialty_extraammo" ) )) { if ( isDefined( level.harry_perks_fix ) && level.harry_perks_fix ) harrybo21_take_gun( user.old_gun ); else user takeWeapon( user.old_gun );
}
if(user.has_stored_weapon == 1) { if ( isDefined( level.harry_perks_fix ) && level.harry_perks_fix ) harrybo21_give_gun( user.old_gun ); else user giveweapon( user.stored_weapon );
If you want scripts / features made for you, then contact me by PM or email / skype etc it will cost you tho so if you have no intention of reciprocating don't even waste my time
Thank you both for your work here. Good stuff all around.
Reaper, I have a pretty decently detailed modern style fridge prefab made up, can post screens of it. If you like it, You'd be more than welcome to add along side yours in dl.
There are a lot of references to gun but if I change it to name on initial line I'll have to change it on all references related to that line but not sure which neeed changed and which need left as gun.
I know at least on the == " " instances but not sure if its needed elsewhere.
Edit: these are my assumptions on what is happening in function still learning so good chance I'm wrong entirely.
Thank you harry, +1 That got me past it and into the map. Will now continue testing of functions in game and report back anything i find although given your abilities I doubt I'll have many if any at all.
Double Post Merge: May 13, 2016, 06:02:02 pmWell I was too hasty and should have expected at least something to come up.
Instantly crashes with use of locker with any gun.
Error reads as follows: Attempted to overrun string in call to va()
Sorry for double post but I've obtained some info that might be of use.
The above error i mentioned is commonly attributed to servers and map rotations with too many maps which causes an overrun in the string because it has too many characters in the string causing it to hit the limit of char's that can be used in a string.
Now considering I'm hitting this on solo without a server mind you i'm not so sure that it's anything to do with server settings.
I also only get it once i hit the locker.
Somewhere it's hitting that character limit on a string once we trigger the storage function.
I make a lot of backups of my mod especially any time i go to add a new feature and this is with only me using harry's perks and his locker fix code provided by him here.
I understand some of what's happening but harry you might know better than i would about what might be causing the string character limit here to be hit.
Taking a look at the script you provided I wonder if it has to do with the way the non storable guns are set up but this is purely my speculation.
Anybody have any ideas on this? I'd be more than happy to learn about the inner workings of the engine and what could be causing this overrun.
Edit: I've also read that a long dvar string can cause this as well which seems more likely, at this juncture, than the server related cause of this error.
Edit 2: Tested setting
Code Snippet
Plaintext
level.harry_perks_fix = true;
To false>compiled mod>pulled gun out of locker>closed game>set fix to true>compiled mod> Was able to place gun in locker but it also kept it in inventory and on attempt to trade gun, whether same gun is in inventory or not, it throws the overrun error again.