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

Put A Sprite In The Userīs Origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 09-01-2010 , 13:58   Put A Sprite In The Userīs Origin
Reply With Quote #1

Hello, iīm trying to put a animated sprite in the players origin but my code doesnīt work

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

#define PLUGIN "Asd"
#define VERSION "1.0"
#define AUTHOR "Asd"

new beampoint
//new beampoint[] = "sprites/Emi/portal1.spr"


public plugin_precache() 
{
    
beampoint precache_model("sprites/Emi/portal1.spr")        
    
//precache_model(beampoint)
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /sprite","portal")
 }
public 
portal(id)
{
    
console_print(id"Getting  Origin...!")  
    new 
Float:origin[3
    
pev(idpev_originorigin)
    
console_print(id"Done")  
    
console_print(id"Adding 25 More Units In Coord Z...")  
    
origin[2] = origin[2] + 25
    console_print
(id"Done!")  
    
console_print(id"Going To Create Sprite Function...")  
    
set_task(5.0"CreateSprite"__:origin3)  
    
client_print(idprint_chat"Creando Sprite en 5 segundos")
    
console_print(id"Done!")  
    
//set_task(5.0, "CreateSprite")  
     
}

public 
CreateSprite(origin[3]) // This doesnīt work
{
    
message_begin(MSG_ALLSVC_TEMPENTITY
    
write_byte(TE_SPRITE)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2] + 200)
    
write_short(beampoint
    
write_byte(2
    
write_byte(200)
    
message_end()

Any help?
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 09-01-2010 at 14:01.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2010 , 15:30   Re: Put A Sprite In The Userīs Origin
Reply With Quote #2

Because you are passing a float vector in set_task() but using it as an integer in the handling function.

PHP Code:
public CreateSprite(Float:origin[3])
{
    
message_begin(MSG_ALLSVC_TEMPENTITY
    
write_byte(TE_SPRITE)
    
write_coord(floatround(origin[0]))
    
write_coord(floatround(origin[1]))
    
write_coord(floatround(origin[2] + 200))
    
write_short(beampoint
    
write_byte(2
    
write_byte(200)
    
message_end()

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 09-01-2010 , 19:10   Re: Put A Sprite In The Userīs Origin
Reply With Quote #3

NOthing happens Exolent
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2010 , 19:20   Re: Put A Sprite In The Userīs Origin
Reply With Quote #4

After looking in message_const.inc:
PHP Code:
#define TE_SPRITE                   17       // Additive sprite, plays 1 cycle
// write_byte(TE_SPRITE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index) 
// write_byte(scale in 0.1's) 
// write_byte(brightness) 
Your scale is 2. Since it is in 0.1's, the resulting scale is 0.2.
Change the scale to something like 10 or more. (10 is the original size of the sprite, since 10 * 0.1 = 1.0)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 09-01-2010 , 19:25   Re: Put A Sprite In The Userīs Origin
Reply With Quote #5

That you Exolen, but, the animation only happens once, should i use a task?

And, how can i to register a player touching the sprite?
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 09-01-2010 at 19:34.
S34Qu4K3 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 09-01-2010 , 20:45   Re: Put A Sprite In The Userīs Origin
Reply With Quote #6

I don't think you can see if someone is touching it, but you can hook prethink and see if someone enters within a certain radius.
__________________
RedRobster is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 09-01-2010 , 20:49   Re: Put A Sprite In The Userīs Origin
Reply With Quote #7

mmm, can you give me an example?
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-01-2010 , 22:36   Re: Put A Sprite In The Userīs Origin
Reply With Quote #8

If you manually create an entity that holds that sprite, you can hook it's touch.

Example:
Code:
public plugin_init()
{
   register_touch("portal", "player", "player_touch_portal")
}

public player_touch_portal(ent, id)
{
   // ...
}

public create_sprite(Float:fOrigin[3])
{
   new ent = create_entity("info_target")

   entity_set_string(ent, EV_SZ_classname, "portal")
   entity_set_model(ent, "sprites/Emi/portal1.spr")

   DispatchSpawn(ent)

   entity_set_origin(ent, fOrigin)
   entity_set_size(ent, Float:{-2.0, -2.0, -2.0}, Float:{2.0, 2.0, 2.0})
   entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
   entity_set_float(ent, EV_FL_scale, 1.0)

   /* I don't remember what you must do to play the animation on an entity's sprite... search :P */
}
__________________

Last edited by Hunter-Digital; 09-02-2010 at 18:15.
Hunter-Digital is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 09-02-2010 , 06:06   Re: Put A Sprite In The Userīs Origin
Reply With Quote #9

No work, nothing happens when i touch the sprite
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 09-02-2010 , 08:36   Re: Put A Sprite In The Userīs Origin
Reply With Quote #10

Change register_touch() to register_touch("player", "portal", "player_touch_portal").

This is how it is shown on the funcwiki:
register_touch(Toucher[], Touched[], function[])
__________________
RedRobster 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 03:28.


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