AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Creating entity (https://forums.alliedmods.net/showthread.php?t=113637)

Mxnn 12-28-2009 21:19

Creating entity
 
I'm trying to create an entity.. I copy this from No Team Buy:
PHP Code:

new ENT_CLASS create_entity("info_map_parameter")

plugin_precache() {
        
ENT_CLASS create_entity("info_map_parameter")
        
DispatchKeyValue("info_map_parameter""buying""3")
        
DispatchSpawn(ENT_CLASS)



But didn't works.. I'm trying that the players can't buy anything .. The problem is this because if i put this:
PHP Code:

        remove_entity("armoury_entity")
        
        
ENT_CLASS create_entity("info_map_parameter")
        
DispatchKeyValue("info_map_parameter""buying""3")
        
DispatchSpawn(ENT_CLASS

The weapons in the floor (like fy_iceworld) dissapear. But if i put this:
PHP Code:

        ENT_CLASS create_entity("info_map_parameter")
         
DispatchKeyValue("info_map_parameter""buying""3")
         
DispatchSpawn(ENT_CLASS)

        
remove_entity("armoury_entity"

The weapons didn't dissapear! In some way the stuff stops the plugin.

Help, i ask for help many times but my thread allways have 1 post (mine)

I help when i can help...

Thanks

Arkshine 12-28-2009 21:25

Re: Creating entity
 
DispatchKeyValue("info_map_parameter", "buying", "3")

how DispatchKeyValue() is supposed to know on what entity it should apply the keyvalue ?

-> DispatchKeyValue(ENT_CLASS, "buying", "3")

Arkshine 12-28-2009 21:25

Re: Creating entity
 
http://www.amxmodx.org/funcwiki.php?...alue&go=search

ConnorMcLeod 12-28-2009 21:30

Re: Creating entity
 
Create your ent in plugin_precache() forward, and remove armouries in plugin_init() forward.

Arkshine 12-28-2009 21:31

Re: Creating entity
 
Ah. He forgets to add public.

Mxnn 12-28-2009 21:55

Re: Creating entity
 
Yes i forget it but i have it in the code..
But can be that in the first round works the handle buy but in the second don't works?

EDIT: In the plugin_precache it works but the armoury entities didn't dissapear..
I will try to put in a function the other stuff

EDIT2: Thanks to you it works :D +k


All times are GMT -4. The time now is 04:14.

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