Raised This Month: $ Target: $400
 0% 

Register Touch...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 08-28-2015 , 12:12   Register Touch...
Reply With Quote #1

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

new CLASSNAME[] = "info_target"

new FILE[96]

new 
score[33]

new const 
WBMODEL[] = { "models/w_weaponbox.mdl" }

public 
plugin_init()
{
    
register_plugin("WB""1.0""redivcram")
    
    
register_touch("info_target""player""FwdPlayerTouchWeaponBox")
    
    
register_clcmd("wpbox_spawn""cmd_wpboxspawn")
    
register_clcmd("wpbox_remove""cmd_wpboxremove")
    
register_clcmd("wpbox_score""cmd_score")
}

public 
plugin_precache()
{
    
precache_model(WBMODEL)
}

public 
cmd_wpboxspawn(id)
{
    new 
origin[3]
    
get_user_origin(idorigin3)
    
wb_spawn(origin)
    
    return 
PLUGIN_HANDLED
}

public 
cmd_wpboxremove(id)
{
    new 
weaponbox = -1
    
while((weaponbox find_ent_by_class(weaponboxCLASSNAME)))
        
remove_entity(weaponbox)

    return 
PLUGIN_HANDLED
}

wb_spawn(origin[3])
{
    new 
weaponbox create_entity(CLASSNAME)
    
    if(!
weaponbox)
        return 
PLUGIN_HANDLED

    
new Float:vec[3]
    
IVecFVec(originvec)
    
entity_set_origin(weaponboxvec)
    
entity_set_model(weaponboxWBMODEL)
    
DispatchSpawn(weaponbox)
    
    return 
PLUGIN_HANDLED
}

public 
FwdPlayerTouchWeaponBox(weaponboxid)
{
    
score[id]++
    
client_print(idprint_chat"You got 1 score for picking up a Weapon Box")
    
remove_entity(weaponbox)
    
    return 
PLUGIN_HANDLED

Entity successfully spawns, whenever player touches it, doesn't do anything
redivcram is offline
 


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 22:14.


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