Raised This Month: $ Target: $400
 0% 

Spray and user origins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-16-2010 , 17:08   Spray and user origins
Reply With Quote #1

Well I don't understand what is wrong:
PHP Code:
new sprayorigins[3]
public 
plugin_init() {
    
register_event("23""NewSpray""a""1=112")
}

public 
NewSpray()
{
    
sprayorigins[0] = read_data(3)    // Spray coord x
    
sprayorigins[1] = read_data(4)    // Spray coord y
    
sprayorigins[2] = read_data(5)    // Spray coord z
    
    
client_print(0print_chat"Spray position: X %f | Y %f | Z %f"sprayorigins[0], sprayorigins[1],sprayorigins[2])

All origins will be 0.0000
And also if I use:
PHP Code:
new userorigin[3]
get_user_origin(iduserorigin
It will return 0.000
However,
PHP Code:
pev(idpev_originuserorigin
will return the actual origin of a player in a map.

In this case I'm more interesated why the origin of a spray is 0.000 ?
t3hNox is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-16-2010 , 17:39   Re: Spray and user origins
Reply With Quote #2

Where did you find that event?
RedRobster is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-16-2010 , 17:52   Re: Spray and user origins
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?p=58076
Am I using it wrong ?
t3hNox is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-16-2010 , 17:53   Re: Spray and user origins
Reply With Quote #4

Sorry lags, delete this post.
t3hNox is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-16-2010 , 18:38   Re: Spray and user origins
Reply With Quote #5

I never used numbers as events before, but event 23 is DeathMsg if i'm right.
http://wiki.amxmodx.org/Half-Life_1_Game_Events

Try register_impulse instead.

Are you using 'new userorigin' or 'new Float: userorigin' for get_user_origin. Because get_user_origin() will return an integer, and pev will return a Float.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-16-2010 , 19:05   Re: Spray and user origins
Reply With Quote #6

Quote:
Originally Posted by t3hNox View Post
I have no idea. Haha. I was just wondering.
RedRobster is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-16-2010 , 19:44   Re: Spray and user origins
Reply With Quote #7

Quote:
Originally Posted by t3hNox View Post
That plugin also works for sure (we run it on one of our servers) so not sure what your issue is here.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-16-2010 , 19:51   Re: Spray and user origins
Reply With Quote #8

23 is NOT DeathMsg

Code:
#define SVC_TEMPENTITY				23
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)
Event could also be registered like this :

Code:
register_event(SVC_TEMPENTITY, "Event_TempEntity_PlayerDecal", "a", "1=112")


@t3hNox

read_data() returns origin as an integer
same for get_user_origin
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-16-2010 at 19:53.
ConnorMcLeod is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-16-2010 , 23:36   Re: Spray and user origins
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
23 is NOT DeathMsg

Code:
#define SVC_TEMPENTITY                23
I'm sorry, like i said i never used numbers to register an event, and 23 was deathmsg in the half life game events list.
thanks for correcting me connor
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-16-2010 , 23:48   Re: Spray and user origins
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
register_event(SVC_TEMPENTITY, "Event_TempEntity_PlayerDecal", "a", "1=112")
register_event() requires that first parameter is a string, just leave it at "23".

The problem with the first code is that you print it wrong, using %f (wich is used for FLOAT) instead of %d (wich is used for numbers, like your case)
Just change %f to %d and that's it, leave everything else alone.
__________________

Last edited by Hunter-Digital; 08-16-2010 at 23:51.
Hunter-Digital is offline
Reply


Thread Tools
Display Modes

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 21:51.


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