AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Methods,Natives and Functions (https://forums.alliedmods.net/showthread.php?t=187670)

Waleed 06-16-2012 10:25

Need Methods,Natives and Functions
 
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!.

yamin 06-16-2012 10:29

Re: Need Methods,Natives and Functions
 
you want to stop by a command?

<VeCo> 06-16-2012 10:45

Re: Need Methods,Natives and Functions
 
Quote:

Originally Posted by Waleed (Post 1729821)
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.

Waleed 06-16-2012 14:25

Re: Need Methods,Natives and Functions
 
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

<VeCo> 06-16-2012 14:33

Re: Need Methods,Natives and Functions
 
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.

ConnorMcLeod 06-16-2012 14:59

Re: Need Methods,Natives and Functions
 
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)
    }




All times are GMT -4. The time now is 06:12.

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