AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how do add sprite? (https://forums.alliedmods.net/showthread.php?t=159702)

GoOleM 06-20-2011 10:37

how do add sprite?
 
Help please, how to add a sprite to play this plugin?
PHP Code:

/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <fakemeta> 
#include <zombieplague> 

#define PLUGIN "Healing skill" 
#define VERSION "1.0" 
#define AUTHOR "teo" 

new cvar_activecvar_timecvar_amount 
new Float:user_time[32
new 
bool:can_heal[32

public 
plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
    
cvar_active register_cvar("zp_zombie_heal_enable""1"
    
cvar_time register_cvar("zp_zombie_time""5.0"
    
cvar_amount register_cvar("zp_zombie_heal_amount","200.0"
    
register_forward(FM_PlayerPreThink"fm_pthink"


public 
plugin_precache() 

    
precache_sound("zombie_plague/zombi_heal.wav"


public 
fm_pthink(id

    if (!
get_cvar_num("zp_on")) 
        return 
FMRES_IGNORED 
    
if ( zp_get_user_nemesis(id) || zp_get_user_survivor(id)) 
        return 
FMRES_IGNORED 
    
if (!zp_get_user_zombie(id)) 
        return 
FMRES_IGNORED 
    
if (!is_user_alive(id)) 
        return 
FMRES_IGNORED 
    
if (!get_pcvar_num(cvar_active)) 
        return 
FMRES_IGNORED 
    
new button pev(idpev_button
    if (
button IN_MOVELEFT || button IN_MOVERIGHT || button IN_FORWARD || button IN_BACK || button IN_JUMP
        
can_heal[id] = false 
    
if (!(button IN_MOVELEFT || button IN_MOVERIGHT || button IN_FORWARD || button IN_BACK || button IN_JUMP)) 
    { 
        if (!
can_heal[id]) 
        { 
            
can_heal[id] = true 
            user_time
[id] = get_gametime() 
        } 
        if (
can_heal[id]) 
        { 
            new 
Float:current_time get_gametime() 
            if (
current_time user_time[id] >= get_pcvar_float(cvar_time)) 
            { 
                
rehealth(id
                
can_heal[id] = false 
            

        } 
    } 
    return 
FMRES_HANDLED 


public 
rehealth(id

    new 
health pev(idpev_health
    if (
health zp_get_zombie_maxhealth(id)) 
    { 
        if (
health get_pcvar_float(cvar_amount) < zp_get_zombie_maxhealth(id)) 
        { 
            
set_pev(idpev_healthpev(idpev_health) + get_pcvar_float(cvar_amount)) 
            
emit_sound(idCHAN_BODY"zombie_plague/zombi_heal.wav"1ATTN_NORM0PITCH_NORM
        } 
        else 
        { 
            
set_pev(idpev_healthfloat(zp_get_zombie_maxhealth(id))) 
            
emit_sound(idCHAN_BODY"zombie_plague/zombi_heal.wav"1ATTN_NORM0PITCH_NORM
        } 
    } 



johnally 06-20-2011 11:16

Re: how do add sprite?
 
Add a sprite offset-y 45 above selected entity!
Global Variables
PHP Code:

#define H_SPRITE     "sprites/spriteA.spr" //sprite path

new g_sprtime;
new 
g_h_blue_spr;
new 
g_plugin_mode;
new 
g_cvarvalue

The function to be called:
PHP Code:

public addsprite(id,level,cid,index)
{
    if(!
cmd_access(id,level,cid,2))  // Cmd access check :)
    
{
        return 
PLUGIN_HANDLED
    
}
    new 
g_cvarvalue get_pcvar_numg_plugin_mode );
    
    
message_beginMSG_ALLSVC_TEMPENTITY );
    
write_byteTE_PLAYERATTACHMENT );
    
write_byteindex );
    
write_coord45 );
    
write_shortg_h_blue_spr ); 
    
write_shortget_pcvar_numg_sprtime ) );
    
message_end();

    return 
PLUGIN_CONTINUE;


PHP Code:

public plugin_precache()
{
    
g_h_blue_spr precache_modelH_SPRITE );
}

public 
plugin_init()
{
    
g_sprtime register_cvar"teamspr_sprite_time""32767" );
    
g_plugin_mode register_cvar"teamspr_mode""1" ); // teammate?


Cheers,

GoOleM 06-20-2011 11:28

Re: how do add sprite?
 
I can not (


All times are GMT -4. The time now is 23:32.

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