Raised This Month: $ Target: $400
 0% 

Need Methods,Natives and Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-16-2012 , 10:25   Need Methods,Natives and Functions
Reply With Quote #1

Hey there,
I have made a plugin for my server,I want to know the following:


How to stop "giving money on each round"? //I don't wan't to give clients money on each round
How to stop "Picking up ground weapons"? //In few maps,Weapons are on ground,I don't want any client to pickup weapons from ground

I want these two things to complete my plugin,Help me on these specially the first one.



Thanks in Advance!.
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-16-2012 , 10:29   Re: Need Methods,Natives and Functions
Reply With Quote #2

you want to stop by a command?
yamin is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-16-2012 , 10:45   Re: Need Methods,Natives and Functions
Reply With Quote #3

Quote:
Originally Posted by Waleed View Post
How to stop "Picking up ground weapons"? //In few maps,Weapons are on ground,I don't want any client to pickup weapons from ground
Hook Ham_Touch with armoury_entity and block it with HAM_SUPERCEDE.
__________________
<VeCo> is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-16-2012 , 14:25   Re: Need Methods,Natives and Functions
Reply With Quote #4

umm,I don't know how to configure it,Sorry!

I think to register,I will be using
PHP Code:
registerHam(Ham_Touch"weapons or which entity??""Don'tPickWeapons"
PHP Code:
     Description:        Called whenever two entities touch.
     * 
Forward params:    function(thisidother);
     * Return 
type:        None.
     * 
Execute params:    ExecuteHam(Ham_Touchthisidother);
     */
    
Ham_Touch
What is "idother" ?
If I am wrong then correct me.
Tell me code please,In note above these constants,It was return that the will need something "pev" ? O_O
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-16-2012 , 14:33   Re: Need Methods,Natives and Functions
Reply With Quote #5

PHP Code:
RegisterHam(Ham_Touch,"entity","function"
Entity should be "armoury_entity", that's the entity of map weapons.
Weapons, dropped by players are "weaponbox" and "weapon_shield" (for the shield).
Function is the name of the function, that will be called. (the name can not contain the ' character)

As you can see, the called function have 2 parameters - "this" is the touched entity (i.e. the id of the weapon entity), "idother" is the toucher entity (we will use it as id of player, that touches the weapon). So the function can be made like this:

PHP Code:
public function(ent,id// ent - weapon ent id, id - (player) id
{
if(!
is_user_alive(id)) return HAM_IGNORED // if the weapon is touched by another entity, but not a player, don't block the touch
return HAM_SUPERCEDE // block the touch if the toucher is a player

Or you can simply do:

PHP Code:
public function(ent,id) return is_user_alive(id) ? HAM_SUPERCEDE HAM_IGNORED 
But always use what you know and undestand.
__________________

Last edited by <VeCo>; 06-16-2012 at 14:33.
<VeCo> is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-16-2012 , 14:59   Re: Need Methods,Natives and Functions
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <engine>

#tryinclude <cstrike_pdatas>
 // custom includes there : http://forums.alliedmods.net/showthread.php?p=1712101#post1712101
#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif  

#define VERSION "0.0.1"
#define PLUGIN "No Ground Weapons + No Money"

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    new 
armoury
    
while( (armoury find_ent_by_class(armoury"armoury_entity")) > )
    {
        
remove_entity(armoury)
    }
}

public 
Event_HLTV_New_Round()
{
    new 
players[32], num
    get_players
(playersnum"h")
    for(--
numnum>=0num--)
    {
        
set_pdata_bool(players[num], m_bNotReceivingMoneyNextRoundfalse)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 06:12.


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