Register touch and pick up?
Is it possible to register a dropped entity <medkit for this example> and adding it to an inventory section <amx menu> ?
More importantly, how? Oh and, how do you make it so it gets picked up even though the player has less than 100 hp <medkit> unless the user has activated it <give item_medkit> from menu? public pfn_touch(ent,id) K i get that part... classname item_medkit. Then my brain shuts down -_- |
Re: Register touch and pick up?
I don't understand what you're asking. Maybe you could rephrase it.
|
Re: Register touch and pick up?
Wow, Sorry about that... late night yesterday...
Ok. So, I have set up a basic inventory mod that allows you to pick up stuff from the ground and put them into your inventory. Now frankly, the problem is... I have no idea how to make a script so you can pick an item up (Ammo, batteries etc.), delete the ent of the picked up item, and make it so that when you use it in your inventory, it doesn't get re-added to your inventory in like 4 seconds, but is picked up by the player in game <so it gives you ammo and then disapears mod based, like how you would pick up anything in normal half-life 1>... Code:
give item_healthkit //spawns healthkit in playerSo frankly, if someone could write up an example/tutorial on how to use the pfn_touch function, I can learn from that -_-. Do you understand now? Code:
|
Re: Register touch and pick up?
If you are going do it with engine, register_touch is alot easier to use imo.
PHP Code:
|
Re: Register touch and pick up?
Quote:
Thanks alot, too bad I can't karma you anymore... damn system... anyway... I tested this on SCSTUFF plugin Code:
gives me tag mismatch, and when on <75 hp it forces the entity to go into inventory. Although if I spawn it on myself it works so I just have to pick it up and use it <more realistic anyway -_-> Plus the medkits don't respawn, I suspected this... but how do I fix it? |
Re: Register touch and pick up?
You should be using && (and) instead of || (or). The else statement isn't needed.
On what line is the tag mismatch? If you want it to come back, you could try saving its origin, and moving it far away. Set a task to restore it back to its original origin. |
Re: Register touch and pick up?
Quote:
So how do I move it far away? I don' thave entmod so that isn't going to fly, something else perhaps? <Reminder, I just started 3 days ago> |
Re: Register touch and pick up?
Instead of removing the ent, you could reduce the players hp.
|
Re: Register touch and pick up?
and btw, maybe this runs faster:
register_event("ItemPickup","healthkit_event" ,"b","1&item_healthkit" ) public healthkit_event(id) { // do stuff // apple pie, pizza... } |
Re: Register touch and pick up?
Quote:
|
| All times are GMT -4. The time now is 00:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.