Raised This Month: $ Target: $400
 0% 

touch help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 08-22-2005 , 17:47   touch help
Reply With Quote #1

How would it be possible to see if someone got close enough or touches a sprite? This is for the loot plugin:
http://forums.alliedmods.net/showthread.php?t=3995
It places a loot bag sprite over dead bodies and if you are close enough you can type loot and it will loot the dead body. I would love to change it so that if your just close enough to it it will auto loot for you. Anyone have any ideas on how to see if someone gets close or touches it?
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-22-2005 , 18:16  
Reply With Quote #2

pfn_touch

get_user_origin
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 08-22-2005 , 18:57  
Reply With Quote #3

I see that ptd will be the player so that makes sense but how would I check to make sure that ptr is the sprite? if I did something like entity_get_string(ptr, EV_SZ_classname, name, length)
then I printed the name would it return the name of the sprite?
I'm guessing that would be the best way of making sure that the player and the sprite touched...by using entity_get_string and making sure ptd is player and ptr is sprite?
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-22-2005 , 19:03  
Reply With Quote #4

Something like this: (although I have absolutely no clue if it would work)

Code:
new name[64] entity_get_string(ptr, EV_SZ_classname, name, length) if(containi(name,"env_sprite")!=-1) {       // OMFG!!111oneone }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 08-22-2005 , 19:15  
Reply With Quote #5

There's a good example of pfn_touch in my Satchel Charges plugin.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 08-22-2005 , 20:32  
Reply With Quote #6

here is my edit of the loot plugin...I got the plugin compiled and I tested it out but its not doing anything when I go next to the loot sprite could someone help me out? maybe env_sprite isn't the classname of the sprite? I'm not sure
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-22-2005 , 21:05  
Reply With Quote #7

Get entmod, load the sprite, then type entmod_lookingat while looking at it. If that doesn't say anything, or it shows "worldspawn", then do e_search.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 08-22-2005 , 21:50  
Reply With Quote #8

ok I spawned the sprite with entmod_spawnmodel but when I do e_search or entmod_lookingat I dont see anything that says anything about a sprite
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-22-2005 , 22:01  
Reply With Quote #9

I don't know, do e_search and look for it in that.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
atambo
Senior Member
Join Date: Oct 2004
Location: Pittsburgh, PA
Old 08-23-2005 , 04:26  
Reply With Quote #10

alright I added a print so that it will print the classname of whatever you touch and it was printing player, func_buyzone, weaponbox and the like correctly but when I went up to a the loot sprite it didn't do anything is there anything else I need to do to get it to think the loot sprite is an entity or something?
__________________
atambo is offline
Send a message via AIM to atambo Send a message via MSN to atambo Send a message via Yahoo to atambo
Reply



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


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