Raised This Month: $ Target: $400
 0% 

Need help generating smoke


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 11-16-2006 , 12:49   Need help generating smoke
Reply With Quote #1

I need some help. I want to generate some smoke from all alive players

I made:
PHP Code:
public plugin_init() {
    
register_plugin("ShNS""1.0""Hip_hop_x")
    
    
register_logevent("new_round"2"1=Round_Start")
}
public 
new_round(id) {
new 
smoke
smoke 
precache_model("sprites/steam1.spr")

    if(
is_user_alive(id)) {
        if(
get_cvar_num("sv_nadetail"))
                    {
                    new 
origin[3]
                    new 
mata
                    mata 
=  get_user_origin(idorigin2)
                        
message_begin(MSG_ALL ,SVC_TEMPENTITY)
                        
write_byteTE_SMOKE )
                        
write_coord(mata)    
                        
write_coord(mata)
                        
write_coord(mata)
                        
write_short(smoke)
                        
write_byte50 )    // scale in 0.1's
                        
write_byte10 )   // framerate
                        
message_end()
                    } 
    
                } 
    else     {    
    return 
PLUGIN_CONTINUE    
        
} return PLUGIN_HANDLED

How should I set the smoke to all alive players? And how to fix the warnings? Can you help me?
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
VEN
Veteran Member
Join Date: Jan 2005
Old 11-16-2006 , 14:32   Re: Need help generating smoke
Reply With Quote #2

precache_model should be in plugin_precache
id isn't passed to the logevent hook, so you should use for example get_players with "a" flag and loop through all indexes, you can find examples in amxmodx/scripting in some of the sma files
It would be better to use MSG_PVS instead of MSG_ALL for visual effects like this one, and pass the origin of the message in message_begin
should be write_coord(origin[0]), write_coord(origin[1]) and write_coord(origin[2])
VEN is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 11-16-2006 , 15:38   Re: Need help generating smoke
Reply With Quote #3

Thanks VEN, I'll try it tommorow.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
dutchmeat
Senior Member
Join Date: Sep 2006
Old 11-17-2006 , 04:54   Re: Need help generating smoke
Reply With Quote #4

So it should be:

Code:
#include <amxmodx> 
public plugin_init() { 
    register_plugin("ShNS", "1.0", "Hip_hop_x") 
 
    register_logevent("new_round", 2, "1=Round_Start") 
}
new smoke //outside new_round
public new_round(id) { 
for(new a = 1; a <= get_playersnum(); a++) {
        if(get_cvar_num("sv_nadetail")) 
        { 
                    new origin[3] 
                    get_user_origin(id,origin)
                    message_begin(MSG_PVS,SVC_TEMPENTITY) 
                    write_byte( 5 ) //TE_SMOKE
                    write_coord(origin[0])     
                    write_coord(origin[1]) 
                    write_coord(origin[2]) 
                    write_short(smoke) 
                    write_byte( 50 )    // scale in 0.1's 
                    write_byte( 10 )   // framerate 
                    message_end() 
        }else{     
      return PLUGIN_CONTINUE     
        }
}
return PLUGIN_HANDLED 
}
 
public plugin_precache(){ //precache the models/sprites/sounds/ whatever
smoke = precache_model("sprites/steam1.spr") 
}
If you want a trail that follows the player, you can use this:

Code:
#include <amxmodx> 
public plugin_init() { 
    register_plugin("PlayerTrail", "1.0", "Dutchmeat") 
}
new smoke
public server_frame() { 
for(new a = 1; a <= get_playersnum(); a++) {
if(is_user_alive(a)){   //make sure the client is connected and alive
message_begin( MSG_BROADCAST, SVC_TEMPENTITY) 
write_byte(22) //#define TE_BEAMFOLLOW 22 Create a line of decaying beam segments until entity stops moving
write_short(a)  //player
write_short(smoke) //Sprite
write_byte(6)  //Life  
write_byte(5)  // Width 
write_byte(255)  // red 
write_byte(255)  // green 
write_byte(255)  // blue 
write_byte(80)  // Brightness
message_end() 
}
}
}
public plugin_precache(){ //precache the models/sprites/sounds/ whatever
smoke = precache_model("sprites/steam1.spr") 
}

Last edited by dutchmeat; 11-17-2006 at 05:29.
dutchmeat is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-17-2006 , 05:18   Re: Need help generating smoke
Reply With Quote #5

dutchmeat: reread what i said before.
Also your methods very inefficient.
VEN is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 11-17-2006 , 05:29   Re: Need help generating smoke
Reply With Quote #6

Edited,
and what do you mean by inefficient?
dutchmeat is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-17-2006 , 05:44   Re: Need help generating smoke
Reply With Quote #7

This article will tell you in details http://wiki.amxmodx.org/index.php/Optimizing_Plugins
VEN is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 11-17-2006 , 17:45   Re: Need help generating smoke
Reply With Quote #8

Tommorow when I'll get home I'll try what VEN suggested to me. If I'll have problems I'll post a reply.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
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 20:34.


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