[Solved] Saving entities
Lets say that we spawned a entity on a map, how can we save it to a file?
Could I do something like this? PHP Code:
|
Re: Saving entities
Using fopen( file, "rt" ) + fgets() + parsing the string with parse() for example and you could save in a var.
|
Re: Saving entities
with parse()
it takes fragments from lines sepparated by spaces with max length and places them into variables and see this tutorial: http://forums.alliedmods.net/showthread.php?t=46218 |
Re: Saving entities
Something like this then..
PHP Code:
EDIT: How can I remove an entity? Could I use get_user_aiming and get the classname of the ent and remove it? |
Re: Saving entities
That code should work I think, try it :P
aaand... if you want to remove entities when you look at them... yeah, that's a way... depends on what you really wanna do |
Re: Saving entities
Everything works fine, atleast the saving/loading, but when it's loading the entities, it just.. goes bad. Could I make a custom stock or something that spawns the ent at that origin, something like createEnt(vOrigin)?
|
Re: Saving entities
What do you mean by "it goes bad" ? what happens ?
PHP Code:
|
Re: Saving entities
Quote:
EDIT: Quick test. I saved 5 ents, when I loaded them, 1 ent was loaded and spawned in the middle of the map. Something is not right. Dinner now, more testing later. EDIT2: The number of spawned ents is now fixed, the only problem is the origin where they're spawning. EDIT3: Never mind, solved. Thanks for the help, digital! |
| All times are GMT -4. The time now is 13:51. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.