Raised This Month: $ Target: $400
 0% 

Weapon toss units


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-09-2010 , 05:09   Re: Weapon toss units
Reply With Quote #6

Actally it's hooking the SVC_TEMPENTITY (wich is 23) message and first param as TE_PLAYERDECAL... wich is 112.

TE_PLAYERDECAL params from include/message_const.inc
Code:
#define TE_PLAYERDECAL              112
// write_byte(TE_PLAYERDECAL)
// write_byte(playerindex)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(entity???)
// write_byte(decal number)
// [optional] write_short(model index)
the #define is the define for using it, the rest with // are informations about message parameters, that are between message_begin(msgtype, SVC_TEMPENTITY) and message_end()...

So... after knowing that I would do the following:

PHP Code:
#include <amxmodx>
#include <engine>

public plugin_init()
{
      
/* SVC_TEMPENTITY (event #23) event, trigger if parameter 1 is equal to 112 (TE_PLAYERDECAL) */
      
register_event("23""player_spray""a""1=112")
}

public 
player_spray()
{
      new 
id read_data(2/* as seen in the include, player index is the second parameter */
      
new iOrigin[3]

      
iOrigin[0] = read_data(3/* and of course, the coordinates... */
      
iOrigin[1] = read_data(4)
      
iOrigin[2] = read_data(5)

      
/* you can get the rest of parameters too if you need them */

      /* now, what you needed... distance... */

      
new iPlayerOrigin[3]

      
get_user_origin(idiPlayerOrigin)

      new 
iDistance get_distance(iPlayerOriginiOrigin)

      
client_print(idprint_chat"Distance to your spray: %d"iDistance)

easy :}

Note: not actually tested, but should work.
__________________

Last edited by Hunter-Digital; 07-09-2010 at 05:58.
Hunter-Digital is offline
 



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 07:05.


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