Raised This Month: $ Target: $400
 0% 

How To Enable This Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Max!
Member
Join Date: Jun 2009
Old 08-12-2009 , 08:16   Re: How To Enable This Plugin
Reply With Quote #2

not too good at coding but i think your problem is that:
1. you didnt precache the sound
2.emit_sound(id, CHAN_VOICE, "this is the sound to be played", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define RESPAWN_TIMER 5 //respawn player after RESPAWN_TIMER seconds
#define TID_RESP 2551

new g_timeleft[33]
new g_msg[64]
new g_max_players
new g_HudSync
new const g_lamesound[32] = "umbrella/admin.wav"
public plugin_init(){
    register_plugin("Respawn", "1.0", "Sylwester")
    register_event("DeathMsg", "fwd_ClientKill", "a")
    register_logevent("logevent_round_end", 2, "1=Round_End")
    g_max_players = get_maxplayers()
    g_HudSync = CreateHudSyncObj()
}

public plugin_precache()
{ 
     precache_sound("umbrella/respawn.wav");
     precache_sound(g_lamesound)
}

public fwd_ClientKill(){
    static id, CsTeams:team
    id = read_data(2)
    team = cs_get_user_team(id)
    if(!is_user_connected(id) || is_user_alive(id) || (team != CS_TEAM_T))
        return
    g_timeleft[id] = RESPAWN_TIMER
    set_task(1.0, "count", TID_RESP+id)
    if(is_user_bot(id))
        return
    set_hudmessage(0, 245, 0, 0.38, 0.25, _, _, 1.0, _, _, -1)
    format(g_msg, 34, "Respawn in %d.", g_timeleft[id])
    ShowSyncHudMsg(id, g_HudSync, g_msg)
}


public count(tid){
    static id, CsTeams:team
    id = tid-TID_RESP
    team = cs_get_user_team(id)
    if(!is_user_connected(id) || is_user_alive(id) || (team != CS_TEAM_T))
        return


    g_timeleft[id] -= 1
    if(g_timeleft[id] <= 0){
        set_pev(id,pev_deadflag,DEAD_RESPAWNABLE);
        set_task(0.2, "respawn", id)
        return
    }else{
        set_task(1.0, "count", TID_RESP+id)
    }
    
    if(is_user_bot(id))
        return
    set_hudmessage(0, 245, 0, 0.38, 0.25, _, _, 1.0, _, _, -1)
    format(g_msg, 34, "Respawn in %d.", g_timeleft[id])
    ShowSyncHudMsg(id, g_HudSync, g_msg)
}


public respawn(id){
    static CsTeams:team
    team = cs_get_user_team(id)
    if(!is_user_connected(id) || is_user_alive(id) || (team != CS_TEAM_T))
        return
    emit_sound(id, CHAN_VOICE, g_lamesound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    dllfunc(DLLFunc_Spawn, id)
}


public logevent_round_end(){
    new i
    for(i=1; i<=g_max_players; i++){
        if(task_exists(TID_RESP+i))
            remove_task(TID_RESP+i)
    }
}
Max! is offline
 



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 18:25.


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