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

Touch help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MercedeSx7
Senior Member
Join Date: Feb 2012
Location: Serbia
Old 03-02-2013 , 11:16   Touch help
Reply With Quote #1

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

public plugin_init()
{
    
register_forward(FM_Touch"touch");
}

public 
touch(idweapon)
{
    if (!
pev_valid(weapon) || !pev_valid(id))
        return;
        
    if (
equal(weapon"models/w_ak47.mdl"))
    {
        
fm_give_item(id"weapon_ak47");
    }

Can anyone help me? :S
__________________
MercedeSx7 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-02-2013 , 11:45   Re: Touch help
Reply With Quote #2

Use <engine>. It will be more efficient and more easier to develop. To help, search information about the native "register_touch".

About to give a weapon, use fun ( "give_item" ). It's more efficient than fm_*.
__________________
micapat is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 03-02-2013 , 11:45   Re: Touch help
Reply With Quote #3

What are you trying?
Torge is offline
MercedeSx7
Senior Member
Join Date: Feb 2012
Location: Serbia
Old 03-02-2013 , 12:02   Re: Touch help
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fun>

public plugin_init()
{
    
RegisterHam(Ham_Touch"weapon_mp5navy""mp5_touch");
}

public 
mp5_touchiTouchediToucher )
{
    
give_item(iToucher"weapon_mp5navy");

Fatal Error: no free edicts, what is wrong hre :S
__________________
MercedeSx7 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-02-2013 , 12:18   Re: Touch help
Reply With Quote #5

Not Hamsandwich. Engine !

http://www.amxmodx.org/funcwiki.php?go=module&id=3
__________________

Last edited by micapat; 03-02-2013 at 12:18.
micapat is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 03-02-2013 , 12:19   Re: Touch help
Reply With Quote #6

What are you trying to do?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
MercedeSx7
Senior Member
Join Date: Feb 2012
Location: Serbia
Old 03-02-2013 , 12:24   Re: Touch help
Reply With Quote #7

I need it for SURF.
Im just giving and example of some weapon when someone help me i will add all weapons.
Its like when someone touches a weapon he gets it but the weapon that is built on map still is there.
Dont tell me to use Weapon Spawner cause that dosent work good.

Edit @micapat donnt know how, could you please?
__________________

Last edited by MercedeSx7; 03-02-2013 at 12:26.
MercedeSx7 is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 03-02-2013 , 12:38   Re: Touch help
Reply With Quote #8

Untested:

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

public plugin_init( )
{
    
register_touch"weaponbox""player""CAK47__Touch" );
    
register_touch"armoury_entity""player""CAK47__Touch" );
}

public 
CAK47__TouchiAk47iPlayer )
{
    if( 
cs_get_weapon_idiAk47 ) == CSW_AK47 && !user_has_weaponiPlayerCSW_AK47 ))
    {
        
entity_set_intiAk47EV_INT_solidSOLID_NOT );
        
entity_set_intiAk47EV_INT_flagsentity_get_intiAk47EV_INT_flags ) | FL_KILLME );
        
        
give_itemiPlayer"weapon_ak47" );
    }

__________________
micapat is offline
MercedeSx7
Senior Member
Join Date: Feb 2012
Location: Serbia
Old 03-02-2013 , 12:43   Re: Touch help
Reply With Quote #9

Yes thanks it works but i can get the weapon for about 5 times, any whay of picking it up unlmited times?
__________________
MercedeSx7 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-02-2013 , 13:37   Re: Touch help
Reply With Quote #10

Quote:
Originally Posted by MercedeSx7 View Post
Yes thanks it works but i can get the weapon for about 5 times, any whay of picking it up unlmited times?
No, it doesn't work, weaponbox and armoury_entity can't work with cs_get_weapon_id.

What you exactly want is still not clear, i would bet following plugin would suit your needs :

PHP Code:
#define ARMOURY_SPAWN_TIME_CVAR_NAME "mp_armoury_respawn_delay"
#define ARMOURY_DEFAULT_SPAWN_TIME "3.0"

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Respawn Armoury"
#define VERSION "0.0.1"

new g_pCvarArmouryRespawnDelay

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )

    
g_pCvarArmouryRespawnDelay register_cvar(ARMOURY_SPAWN_TIME_CVAR_NAMEARMOURY_DEFAULT_SPAWN_TIME)

    new 
szArmouryClass[] = "armoury_entity"
    
RegisterHam(Ham_TouchszArmouryClass"OnCArmoury_ArmouryTouch_Post"true)
    
RegisterHam(Ham_ThinkszArmouryClass"OnCArmoury_Think")
}

public 
OnCArmoury_ArmouryTouch_PostiArmoury )
{
    if( 
pev(iArmourypev_effects) & EF_NODRAW )
    {
        
set_pev(iArmourypev_nextthinkget_gametime() + get_pcvar_float(g_pCvarArmouryRespawnDelay))
    }
}

public 
OnCArmoury_ThinkiArmoury )
{
    if( 
pev(iArmourypev_effects) & EF_NODRAW )
    {
        
ExecuteHamB(Ham_CS_RestartiArmoury)
    }            

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-02-2013 at 13:55.
ConnorMcLeod 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 17:36.


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