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

[HOWTO] Spawn Sprites


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xvil
BANNED
Join Date: Feb 2012
Old 03-10-2012 , 12:07   [HOWTO] Spawn Sprites
Reply With Quote #1

You Can Use this Script To Display Sprites

Get Player Origin:
PHP Code:
   new Float:start]
  
// get user Origin
  
entity_get_vectoridEV_VEC_originstart ); 
Display Sprite:
PHP Code:
  message_begin(MSG_PVSSVC_TEMPENTITYorigin)
  
write_byte(TE_SPRITETRAIL
  
write_coord(start[0]) // x
  
write_coord(start[1]) // y
  
write_coord(start[2] ) // z
  
write_coord(end[0]) // x  Example end[0] = start[0] + 100
  
write_coord(end[1]) // y  Example end[1] = start[1]  
  
write_coord(end[2]) // z  Example end[2] = start[2]
  
write_short(g_sprite// Sprite Index
  
write_byte(25// Count
  
write_byte(25// Life
  
write_byte(2// Scale
  
write_byte(50// Velocity Along Vector
  
write_byte(10// Rendomness of Velocity
  
message_end(); 

Example:
Spoiler


Screenshot:
Spoiler


Attached Thumbnails
Click image for larger version

Name:	HalfLife93.jpg
Views:	1640
Size:	45.0 KB
ID:	100462  
Attached Files
File Type: sma Get Plugin or Get Source (UseSprites.sma - 764 views - 999 Bytes)
File Type: zip flame.zip (49.4 KB, 135 views)

Last edited by Xvil; 03-12-2012 at 02:59.
Xvil is offline
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 03-10-2012 , 14:12   Re: [HOWTO] Display Sprites
Reply With Quote #2

Player will spawn fire at the place where they step?

Anyway, nice work.
__________________
Quote:
Originally Posted by addons_zz View Post
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.
JoKeR LauGh is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 03-10-2012 , 15:02   Re: [HOWTO] Display Sprites
Reply With Quote #3

Yes.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-12-2012 , 03:00   Re: [HOWTO] Display Sprites
Reply With Quote #4

Quote:
Originally Posted by JoKeR LauGh View Post
Player will spawn fire at the place where they step?

Anyway, nice work.
Yes the Fire Will spawn at the place where he step.

and Thanks.
Xvil is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 03-13-2012 , 14:34   Re: [HOWTO] Spawn Sprites
Reply With Quote #5

how can i do it for when a player dies(origin never changes)
I want to do a lightning sprite and a exploding sprite to show up when a player dies,
wil it be effective if i do it like this:

PHP Code:
  new Origin 
  

  engfunc
EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYOrigin); 
  
  
engfuncEngFunc_WriteCoordOrigin ); 
 
  
write_shortlightningsprite );  
  
write_byte); //sprite wil show only 1sec?
  //write_byte( 30 ); is this the damage that will be dealth?
  
write_byte10 ); //height of the sprite?
  //write_byte( 45 ); no need for this becous the player isnt gonna move?
  //write_byte( 40 ); no need for this becous the player isnt gonna move?
  
message_end( ); 
this is probably totally wrong, pls dont flame me i never worked with sprites before

Last edited by striker07; 03-13-2012 at 14:34.
striker07 is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-13-2012 , 15:24   Re: [HOWTO] Spawn Sprites
Reply With Quote #6

Quote:
Originally Posted by striker07 View Post
how can i do it for when a player dies(origin never changes)
I want to do a lightning sprite and a exploding sprite to show up when a player dies,
wil it be effective if i do it like this:

PHP Code:
  new Origin 
  

  engfunc
EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYOrigin); 
  
  
engfuncEngFunc_WriteCoordOrigin ); 
 
  
write_shortlightningsprite );  
  
write_byte); //sprite wil show only 1sec?
  //write_byte( 30 ); is this the damage that will be dealth?
  
write_byte10 ); //height of the sprite?
  //write_byte( 45 ); no need for this becous the player isnt gonna move?
  //write_byte( 40 ); no need for this becous the player isnt gonna move?
  
message_end( ); 
this is probably totally wrong, pls dont flame me i never worked with sprites before
this An Example:
PHP Code:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <cstrike> 

new g_Sprite 

public plugin_precache() 

    
g_Sprite precache_model("sprites/test.spr"

public 
plugin_init() 

     
    
register_event("DeathMsg","onDeath","a"

public 
onDeath() 

    new 
victim read_data(2
    new 
origin[3
    
get_user_origin(victim,origin
    
ShowSprite(origin
}
stock ShowSprite(origin[3]) 

    
// 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) 
     
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
    
write_byte(TE_SPRITE
    
write_coord(origin[0]) 
    
write_coord(origin[1]) 
    
write_coord(origin[2]+=30
    
write_short(g_Sprite// Sprite index 
    
write_byte(8
    
write_byte(255
    
message_end() 


Last edited by Xvil; 03-14-2012 at 13:48.
Xvil is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 03-14-2012 , 10:21   Re: [HOWTO] Spawn Sprites
Reply With Quote #7

Nice, thank you, this will defenitly make it easyer for me thx

but i do have a few questions:

the set_task 3.0 secs, does this mean that the showsprite will become 1, 3sec's after the victim has died?

coordinate z is the hight right? when you add +30 there does this mean that the sprite will start showing from z coordinate +=30 units? or that the sprite will be higher with 30 units?

for the scale, is that to extend the width of the sprite? If I enter a value lets say 3, will the sprite be 3 units wider? (sprite width +3 units?) I saw in your contributed notes that it is only for explosions so should i use that too for if i want to add a lightning effect?
striker07 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 03-14-2012 , 11:06   Re: [HOWTO] Spawn Sprites
Reply With Quote #8

Ah nice it certainly works but

for the lightning:
i want it to come out of the air, so that the height of the sprite dont matter becous now when players die (very low in the map) the lightning starts coming out of the air about one meter above the player heads and stops at his waste.

for the explosion:
it starts and his waste when it should start at the floor.

- for the lightning:
Can I fix this by making he sprite's height very big and keep the width or is there a way to code it so that the sprite automaticly gets streched when it spawns and starts from to top point of the map?

- for the explosion:
im gonna change the z cordinate for the sprite to write_coord(origin[2]); (without the +=30) and see what that gives

EDIT:

ok after alot of testing I now have this but i cant get it compiled becous of some errors
Spoiler

Errors:

Code:
Error: Undefined symbol "entity_get_vector" on line 421
Error: Undefined symbol "EV_VEC_origin" on line 421
Warning: Expression has no effect on line 421
Error: Expected token: ";", but found ")" on line 421
Error: Too many error messages on one line on line 421

Last edited by striker07; 03-14-2012 at 13:17.
striker07 is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-14-2012 , 13:47   Re: [HOWTO] Spawn Sprites
Reply With Quote #9

Sorry I'm Wrong
PHP Code:
#include <amxmodx> 
#include <engine> 
#include <fakemeta> 
#include <cstrike> 

new g_Sprite 

public plugin_precache() 

    
g_Sprite precache_model("sprites/test.spr"

public 
plugin_init() 

     
    
register_event("DeathMsg","onDeath","a"

public 
onDeath() 

    new 
victim read_data(2
    new 
origin[3
    
get_user_origin(victim,origin
    
ShowSprite(origin
}
stock ShowSprite(origin[3]) 

    
// 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) 
     
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY
    
write_byte(TE_SPRITE
    
write_coord(origin[0]) 
    
write_coord(origin[1]) 
    
write_coord(origin[2]+=30
    
write_short(g_Sprite// Sprite index 
    
write_byte(8
    
write_byte(255
    
message_end() 

Xvil is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-14-2012 , 13:54   Re: [HOWTO] Spawn Sprites
Reply With Quote #10

Spoiler


Test this:
Spoiler
Xvil 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 08:54.


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