AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spray and user origins (https://forums.alliedmods.net/showthread.php?t=135487)

t3hNox 08-16-2010 17:08

Spray and user origins
 
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 ?

RedRobster 08-16-2010 17:39

Re: Spray and user origins
 
Where did you find that event? :shock:

t3hNox 08-16-2010 17:52

Re: Spray and user origins
 
http://forums.alliedmods.net/showthread.php?p=58076
Am I using it wrong ?

t3hNox 08-16-2010 17:53

Re: Spray and user origins
 
Sorry lags, delete this post.

drekes 08-16-2010 18:38

Re: Spray and user origins
 
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.

RedRobster 08-16-2010 19:05

Re: Spray and user origins
 
Quote:

Originally Posted by t3hNox (Post 1272861)

I have no idea. Haha. I was just wondering. :)

DarkGod 08-16-2010 19:44

Re: Spray and user origins
 
Quote:

Originally Posted by t3hNox (Post 1272861)

That plugin also works for sure (we run it on one of our servers) so not sure what your issue is here.

ConnorMcLeod 08-16-2010 19:51

Re: Spray and user origins
 
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

drekes 08-16-2010 23:36

Re: Spray and user origins
 
Quote:

Originally Posted by ConnorMcLeod (Post 1272955)
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

Hunter-Digital 08-16-2010 23:48

Re: Spray and user origins
 
Quote:

Originally Posted by ConnorMcLeod (Post 1272955)
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.


All times are GMT -4. The time now is 21:51.

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