AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Touch help (https://forums.alliedmods.net/showthread.php?t=209827)

MercedeSx7 03-02-2013 11:16

Touch help
 
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

micapat 03-02-2013 11:45

Re: Touch help
 
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_*.

Torge 03-02-2013 11:45

Re: Touch help
 
What are you trying?

MercedeSx7 03-02-2013 12:02

Re: Touch help
 
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

micapat 03-02-2013 12:18

Re: Touch help
 
Not Hamsandwich. Engine !

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

wickedd 03-02-2013 12:19

Re: Touch help
 
What are you trying to do?

MercedeSx7 03-02-2013 12:24

Re: Touch help
 
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?

micapat 03-02-2013 12:38

Re: Touch help
 
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" );
    }



MercedeSx7 03-02-2013 12:43

Re: Touch help
 
Yes thanks it works but i can get the weapon for about 5 times, any whay of picking it up unlmited times?

ConnorMcLeod 03-02-2013 13:37

Re: Touch help
 
Quote:

Originally Posted by MercedeSx7 (Post 1905144)
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)
    }            




All times are GMT -4. The time now is 21:48.

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