Raised This Month: $ Target: $400
 0% 

Que hago mal aca?


  
 
 
Thread Tools Display Modes
Author Message
UnrealT
Member
Join Date: Jul 2013
Old 08-06-2013 , 20:10   Que hago mal aca?
#1

Hola gente , he vuelto despues de tantos dias.
Y hoy me puse a probar sobre entidad y cuando alguien la toca..
Pero no logro hacer que funcione , que me de lo que quiero..
PHP Code:
#define HEMDL "models/w_hegrenade.mdl"
#define FBMDL "models/w_flashbang.mdl"
#define SGMDL "models/w_smokegrenade.mdl"

#define HECN "BombaHE"
#define FBCN "BombaFB"
#define SGCN "BombaSG"

enum
{
    
HE 0,
    
FB,
    
SG
}

public 
plugin_precache()
{
    
precache_model(HEMDL)
    
precache_model(FBMDL)
    
precache_model(SGMDL)
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
register_forward(FM_Touch"TouchNade")
}

public 
fw_PlayerKilled (victim)
{
    new 
origin[3], randomm random_num(1,3)
    
    
get_user_origin(victimorigin0)
    
    switch (
randomm)
    {
        case 
1CreateNade(originHE)
        case 
2CreateNade(originFB)
        case 
3CreateNade(originSG)
    }
}

public 
CreateNade(origin[3], Nade)
{
    new 
Float:fOrigin[3]
    
    new 
ent create_entity("info_target")
    
    switch (
Nade)
    {
        case 
HE:
        {
            
entity_set_model(entHEMDL)
            
entity_set_string(entEV_SZ_classnameHECN)
        }
        case 
FB:
        {
            
entity_set_model(entFBMDL)
            
entity_set_string(entEV_SZ_classnameFBCN)
        }
        case 
SG:
        {
            
entity_set_model(entSGMDL)
            
entity_set_string(entEV_SZ_classnameSGCN)
        }
    }
    
    
entity_set_size(entFloat:{-2.0, -2.0, -2.0}, Float:{2.02.02.0})
    
IVecFVec(originfOrigin)
    
entity_set_origin(entfOrigin)
    
entity_set_int(entEV_INT_solidSOLID_BBOX)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS)
    
drop_to_floor(ent)
}

public 
TouchNade (ident)
{
    new 
szClasName[32]
    
    
entity_get_string(entEV_SZ_classnameszClasName31)
    
    if (
equal(szClasNameHECN))
    {
        
client_print(idprint_chat"Has tocado una HeGrenade")
        
give_item(id"weapon_hegrenade")
    }
    else if (
equal(szClasNameFBCN))
    {
        
client_print(idprint_chat"Has tocado una FlashGrenade")
        
give_item(id"weapon_flashbang")
    }
    else if (
equal(szClasNameSGCN))
    {
        
client_print(idprint_chat"Has tocado una SmokeGrenade")
        
give_item(id"weapon_smokegrenade")
    }

No se como lograr que al tocar cierta bomba me de ese mismo item y tampoco sale el mensaje

Edit: Lo que no me funciona es el TOUCH

Last edited by UnrealT; 08-06-2013 at 20:18.
UnrealT is offline
_Pro_
Senior Member
Join Date: Mar 2012
Location: Argentina
Old 08-06-2013 , 20:33   Re: Que hago mal aca?
#2

Proba y decime!
PHP Code:
/*
* ent = Touched
* id = Toucher
*/
public TouchNade(entid)
{
    if (!
pev_valid(ent) || 32 id 1) return FMRES_IGNORED
    
    
new szClasName[32]

    
entity_get_string(entEV_SZ_classnameszClasName31)

    if (
equal(szClasNameHECN))
    {
        
client_print(idprint_chat"Has tocado una HeGrenade")
        
give_item(id"weapon_hegrenade")
    }
    else if (
equal(szClasNameFBCN))
    {
        
client_print(idprint_chat"Has tocado una FlashGrenade")
        
give_item(id"weapon_flashbang")
    }
    else if (
equal(szClasNameSGCN))
    {
        
client_print(idprint_chat"Has tocado una SmokeGrenade")
        
give_item(id"weapon_smokegrenade")
    }

_Pro_ is offline
Send a message via MSN to _Pro_ Send a message via Skype™ to _Pro_
UnrealT
Member
Join Date: Jul 2013
Old 08-06-2013 , 20:48   Re: Que hago mal aca?
#3

Quote:
Originally Posted by _Pro_ View Post
Proba y decime!
PHP Code:
/*
* ent = Touched
* id = Toucher
*/
public TouchNade(entid)
{
    if (!
pev_valid(ent) || 32 id 1) return FMRES_IGNORED
    
    
new szClasName[32]

    
entity_get_string(entEV_SZ_classnameszClasName31)

    if (
equal(szClasNameHECN))
    {
        
client_print(idprint_chat"Has tocado una HeGrenade")
        
give_item(id"weapon_hegrenade")
    }
    else if (
equal(szClasNameFBCN))
    {
        
client_print(idprint_chat"Has tocado una FlashGrenade")
        
give_item(id"weapon_flashbang")
    }
    else if (
equal(szClasNameSGCN))
    {
        
client_print(idprint_chat"Has tocado una SmokeGrenade")
        
give_item(id"weapon_smokegrenade")
    }

Sigue sin funcionar u.u
UnrealT is offline
_Pro_
Senior Member
Join Date: Mar 2012
Location: Argentina
Old 08-06-2013 , 20:57   Re: Que hago mal aca?
#4

Acabo de probar el codigo que pasaste al principio, y si anda ¬¬

Edit: Chequea si esta vivo el toucher

Last edited by _Pro_; 08-06-2013 at 20:57.
_Pro_ is offline
Send a message via MSN to _Pro_ Send a message via Skype™ to _Pro_
UnrealT
Member
Join Date: Jul 2013
Old 08-06-2013 , 21:07   Re: Que hago mal aca?
#5

Que raro ami no me anda...
UnrealT is offline
 



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 00:38.


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