AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Smoke puffs (https://forums.alliedmods.net/showthread.php?t=155374)

DoviuX 04-21-2011 05:27

Smoke puffs
 
How can I make smoke puffs from a player, they repeat and disables on round end ?

PHP Code:

        if((iClass[id] == 3) && (gInfected[id]))
        {
            
set_task(2.0"smoker_puff")
        }


public 
smoker_puff(id)
{
    if(!
is_user_alive(id))
        return;

        new 
Float:fOrigin[3], iOrigin[3
        
entity_get_vectoridEV_VEC_originfOrigin); 
        
    if(
iClass[id] == 3)
    {
            
iOrigin[0] = floatround(fOrigin[0]) 
            
iOrigin[1] = floatround(fOrigin[1]) 
            
iOrigin[2] = floatround(fOrigin[2]) 
                 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITYiOrigin
            
write_byte(TE_SMOKE
            
engfuncEngFunc_WriteCoord,fOrigin[0]) 
            
engfuncEngFunc_WriteCoord,fOrigin[1]) 
            
engfuncEngFunc_WriteCoord,fOrigin[2]) 
            
write_short(smoker_spr
            
write_byte(35
                
write_byte(20
                
write_byte(0
            
message_end() 
    }
    
set_task(3.0"smoker_puff"TASKID_PUFF id)



Mini_Midget 04-21-2011 10:16

Re: Smoke puffs
 
set_task has extra optional arguments. You can have it loop with the flag 'b'.
Here: http://www.amxmodx.org/funcwiki.php?go=func&id=253

Also, I would personally make a ent and have it attach/follow the player and then make that ent think every so often to puff out smoke.

Hunter-Digital 04-21-2011 21:49

Re: Smoke puffs
 
I belive he needs the puff to be on death, like L4D's smoker... the CS 1.6's grenade does something similar, there's a plugin that replaces the original smoke grenade and makes a new one exacly the same, look it up.

DoviuX 04-22-2011 01:36

Re: Smoke puffs
 
Yes when dies it does smoke, but when he walks and etc there's some kinda green puffs with him, like he is smelly or smth :D

Hunter-Digital 04-22-2011 03:16

Re: Smoke puffs
 
Quote:

Originally Posted by DoviuX (Post 1455219)
Yes when dies it does smoke, but when he walks and etc there's some kinda green puffs with him, like he is smelly or smth :D

For that a task is just fine... but your code isn't.

You're not sending player ID in to the task, hook player spawn, remove the task and add it again:
Code:

remove_task(id)
set_task(1.0, "smoker_puff", id)



All times are GMT -4. The time now is 19:50.

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