Raised This Month: $51 Target: $400
 12% 

player_sapped_object and object's ID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 08-03-2011 , 06:51   player_sapped_object and object's ID
Reply With Quote #1

So i recently started doing some checks on sappers...
lets say i want to prevent some admins' buildings to be sapped, so i should look when a spy saps them.
I looked in the wiki section "tf2 events" and i found out this
PHP Code:
player_sapped_object 
that has the following structure
PHP Code:
short     userid     user ID of the spy
short     ownerid     user ID of the building owner
byte      object     
short     sapperid     index of the sapper 
Is there any way to get the object's ID or classname out of that "byte object" ?
__________________
napalm00 is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-03-2011 , 11:06   Re: player_sapped_object and object's ID
Reply With Quote #2

This may be able to help, my friend: http://forums.alliedmods.net/showthread.php?p=1329948
__________________
pheadxdll is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 08-03-2011 , 11:39   Re: player_sapped_object and object's ID
Reply With Quote #3

Quote:
Originally Posted by pheadxdll View Post
This may be able to help, my friend: http://forums.alliedmods.net/showthread.php?p=1329948
yup i already know about that plugin, unfortunately it only does checks on the spy and the engineer, not on the buildings
__________________
napalm00 is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 08-03-2011 , 12:56   Re: player_sapped_object and object's ID
Reply With Quote #4

PHP Code:
public OnPluginStart()
{
     
HookEvent("player_sapped_object",Sapped);
}
public 
Action:Sapped(Handle:event, const String:name[], bool:dontBroadcast)
{
     new 
object GetEventInt(event"object");
     switch(object)
     {
          case 
0:
          {
               
//Dostuff for Dispenser
          
}
          case 
1:
          {
               
//Dostuff for Teleporter
               //You would need to get the objectmode to distinguish between entrance/exit
          
}
          case 
2:
          {
               
//Dostuff for Sentry
          
}
     } 


Last edited by Tylerst; 08-03-2011 at 13:16.
Tylerst is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 08-03-2011 , 12:57   Re: player_sapped_object and object's ID
Reply With Quote #5

So just tweak it a bit.. you've got the engi, check if he's an admin. You want to check the building ^

Not a bad idea to add some entity checks too, events could always change.
__________________
pheadxdll is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 08-03-2011 , 13:19   Re: player_sapped_object and object's ID
Reply With Quote #6

Quote:
Originally Posted by pheadxdll View Post
So just tweak it a bit.. you've got the engi, check if he's an admin. You want to check the building ^

Not a bad idea to add some entity checks too, events could always change.
Wow awesome!!! Thank you both guys!!!
__________________
napalm00 is offline
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 05:23.


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