Raised This Month: $51 Target: $400
 12% 

help with CSPUM.


Post New Thread Reply   
 
Thread Tools Display Modes
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-06-2016 , 10:29   Re: help with CSPUM.
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
You don't need to use/have the count to set it to 0. Once this is done, the weapon will disappear, but like I said it may reappear at new round. Take a look at my plugin to check what I did.

set_pdata_int( ent , m_iCount , 0 , XoCArmoury )

Also not sure but the player is touching the ent so it may get picked up before it is set to 0 so this may be a bad idea. Just kill the entity. Maybe set to 0 then return PLUGIN_HANDLED?
Ok i will do it .. but after a while, now i'm preparing to go back in my country so i will be busy some days .. so will took a while until i will try again but i will firstrly check your armoury manager, it may give me a new look about armoury_entity
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-06-2016 , 11:01   Re: help with CSPUM.
Reply With Quote #12

I don't really understand what you want to do but i can give you an example how to block dropping and picking up and how to remove dropped weapons

Here is a cropped code from my dstrike and patcher plugins
I believe the removing dropped weapons function was written by Arks

PHP Code:

// Block Picking up weapons ( including armor ) & Block Dropping weapons
//==================================================================================================
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
//Weapon Block
    
register_clcmd("drop""command_weapon_drop")
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeaponBox_Pre"0)
    
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeaponBox_Pre"0)
    
    .
}

// Block Drop command
public command_weapon_drop(id)
{
    if (
g_HasWeaponBlock[id])
        return 
PLUGIN_HANDLED_MAIN;
    
    return 
PLUGIN_CONTINUE;
}

// Block Picking up
public fw_TouchWeaponBox_Pre(WeaponBoxOther)
{
    
// Block Pick up 
    
if(is_user_alive(Other) && g_HasWeaponBlock[Other])
    {
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

// Delete Droped Weapons after 10 seconds
//==================================================================================================
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeaponBox_Pre"0)
}



// Remove Dropped Weapons after 10 seconds
public fw_TouchWeaponBox_Pre(WeaponBoxOther)
{
    if (!
Other || Other MAX_PLAYERS )
    {    
            
set_pevWeaponBoxpev_nextthinkget_gametime() + 10.0);
    }
    return 
HAM_IGNORED;

__________________

Last edited by Depresie; 12-06-2016 at 11:07.
Depresie is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-06-2016 , 12:15   Re: help with CSPUM.
Reply With Quote #13

they are good but is not an answer to my questions, example :
PHP Code:
set_pevWeaponBoxpev_nextthinkget_gametime() + 10.0); 
Not all the weapons are WeaponBox, weapons wich you can already find on the floor ( like weapons from fy_snow, iceworld, buzzkill, etc .. ) are not weaponsbox, they are armoury_entity and set_pev cannot delete them, however , let me test your code before i'm talking.

Edit: Yes is not working, i have problems removing/blocking drop armoury_entity, as you see in the code you've posted, even Arkshine separe them because he know he can't remove them using set_pev nextthink. .... however i will look in bugsy code is ok man

Also you call 2 times plugin_init but i know they are two separate plugins so it is ok
__________________
Project: Among Us

Last edited by Craxor; 12-06-2016 at 12:17.
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-06-2016 , 12:48   Re: help with CSPUM.
Reply With Quote #14

Quote:
Not all the weapons are WeaponBox, weapons wich you can already find on the floor ( like weapons from fy_snow, iceworld, buzzkill, etc .. ) are not weaponsbox, they are armoury_entity and set_pev cannot delete them, however , let me test your code before i'm talking.
Sure you can't delete armoury enentities by forcing think, that's not how they work. It works for weaponbox, because it's think function is set to Kill and is delayed by 300 seconds.
PHP Code:
pWeaponBox->SetThink(&CWeaponBox::Kill);
pWeaponBox->pev->nextthink gpGlobals->time 300.0f
When think is enforced the 300.0 "countdown" is overriden and the Kill function is executed immediately.

To keep it short, as Bugsy said, when you pickup an armoury_entity a weapon entity is created and given to player. After drop, that weapon is packed inside weaponbox.

I never told you that you can't remove them with EngFunc_RemoveEntity, what I said is:
Quote:
If you want to remove an armoury_entity, you should not actually delete the entity. This entities are a bit special, if you remove them they won't respawn the next round again and this is the issue if cvar is changed or key is removed.
What I mean is:
1. cspum_type is 1, armoury_entity is removed
2. cspum_type is set to 2 after some time, but the removed entities will remain removed. IMO you should allow them to respawn next round. If you don't want that, simply calling EngFunc_RemoveEntity will do the job. Otherwise, use that:
PHP Code:
const XoCArmoury 
const m_iCount 35
set_pdata_int
(entm_iCount0XoCArmoury)
set_pev(entpev_effectspev(entpev_effects) | EF_NODRAW)  //really needed? 
Inside ArmouryTouch there is a check for m_iCount offset, and if you set it to 0 in TouchPre I don't think there will be any kind of issue. Basically, if it's 0 the function will do nothing.
__________________

Last edited by HamletEagle; 12-06-2016 at 12:52.
HamletEagle is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-06-2016 , 13:00   Re: help with CSPUM.
Reply With Quote #15

Just block picking them up then...
The code that forbids players to pick them up should work perfectly ( i use it on zombie plague to forbid zombies picking up armor )
__________________

Last edited by Depresie; 12-06-2016 at 13:02.
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-06-2016 , 13:36   Re: help with CSPUM.
Reply With Quote #16

Depresie, you are totally off-topic.
__________________
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2016 , 21:35   Re: help with CSPUM.
Reply With Quote #17

I should have provided this earlier, though you may have found it in my Armoury Manager plugin. The value returned by m_iType is not the CSW_ weapon constant that you may have expected. Use the below enum to determine weapon type based on the returned m_iType value. I also provided code for how to delete/restore armoury_entity's.

To get the CSW_ index of a m_iType value, use g_ArmouryTypes[ (m_iType value) ][ WeaponIndex ]
Spoiler
__________________

Last edited by Bugsy; 12-07-2016 at 18:29.
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-07-2016 , 18:29   Re: help with CSPUM.
Reply With Quote #18

I did the armoury_entity work and some code cleanup for you.. I added comments where I did everything, please review to see what I did and ask if you have any questions.

Something you should try to avoid is using magic numbers in your code, such is if ( cvar == 1 ), if ( iWeaponType == 0 ) etc. When other people look at your code, they do not have a clue as to what these values mean without reviewing other parts of your code. Instead, define an enum that holds all possible values and name them something that makes sense to others. This is something I did in your code.

I would also prefer the weapons to be stored in a bitsum using a single vault entry. Using an entry for each with the weapon name as key and a "1" for the value works, but it is less efficient. String comparisons and multiple nvault reads versus a single nvault read and a bitwise AND.

The way the armoury_entity handling works is when you add an armoury to the block list and they are touched (with cvar=1), the count is set to 0 and they disappear. When this weapon is removed from the block list or the block list is cleared, the armoury entity will re-appear in its original location and can be picked up.

Added GetWeaponIndex() function to get the weapon index based on keyword. It will return GWI_Duplicate on duplicate, GWI_NotFound on no matching weapon found. On successful find it will return the weapon index.
Spoiler
__________________

Last edited by Bugsy; 12-09-2016 at 19:51.
Bugsy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-09-2016 , 10:05   Re: help with CSPUM.
Reply With Quote #19

Amazing work bugsy, now it works perfect .. just one small problem i have been observed :

if i write amx_cspum_addkey 'x' or 'e' or 'u' they will be saved, output:

Quote:
] amx_cspum_addkey r
You successfully added 'r' to the list!
] amx_cspum_addkey u
You successfully added 'u' to the list!
] amx_cspum_addkey p
You successfully added 'p' to the list!
] amx_cspum_addkey p
This key is already saved in the pick up manager list.
] amx_cspum_addkey l
You successfully added 'l' to the list!

Anyway, thats being not my original problem so i should solve by myself, but thanks everybody for their time and effort! Hamlet and Bugsy <3

# Also bugsy, can you please next time post codes with [code] Tag and [spoiler] because now i need to re-indent all the code, because [php] tag broke them, anyway will not take to much time but thanks fi you take in consideration <3 <3 )
__________________
Project: Among Us

Last edited by Craxor; 12-09-2016 at 10:07.
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-09-2016 , 11:21   Re: help with CSPUM.
Reply With Quote #20

PHP Code:
containigKeyList] , szWeaponArg 
r, u, p, l are contained in gKeyList[i]. Your check needs to be improved.
__________________
HamletEagle is offline
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 10:52.


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