Creating an entity messes up
Hey everyone, I have a plugin that is supposed to create an entity "info_tfdetect". This entity controls settings for the maps in the game Team Fortress Classic. With this plugin I am trying to remove a current "info_tfdetect" if there is one, then make a new one. After it is created it should set the values to it.
All the plugin seems to do at the moment is spawn every entity in the map at 0,0,0 origin. Here is the code... Code:
|
Re: Creating an entity messes up
I think you wanted to make it like that:
Quote:
|
Re: Creating an entity messes up
Can't you just do:
switch(keyname) { case "blah": do_something(...) case "blah2": do_someting(...) } |
Re: Creating an entity messes up
You can't use switch with arrays.
|
Re: Creating an entity messes up
Quote:
I don't understand why every entity is spawning there anyway? There isn't anywhere in the code that I can see to have everything spawn there, only the "info_tfdetect". Maybe this code could be causing that, I don't know why it would be though. It's all I can think of. Code:
|
Re: Creating an entity messes up
I already said what you have to do:
Quote:
You do not want to do that for every entity so you have to check for entity classname: get_kvd(kvdid, KV_ClassName, ...) But as i said before you better also check for entity validity, this may save the server from crash. |
Re: Creating an entity messes up
Quote:
Sorry that I don't understand :P |
Re: Creating an entity messes up
You have to use pev_valid(ent).
You have to do something like that: Code:
public forward_keyvalue(ent2, kvdid) { |
Re: Creating an entity messes up
Alright, I 'think' I did what you said, but it still spawns us all at (0 0 0) and the entity doesn't work that was suppose to be made :(.
Here is all the code i'm using now... Code:
|
Re: Creating an entity messes up
Code:
|
| All times are GMT -4. The time now is 22:28. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.