Raised This Month: $ Target: $400
 0% 

How To Enable This Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 08-12-2009 , 07:58   How To Enable This Plugin
Reply With Quote #1

hi How to enable this plugin player respawns but how to make sound when he respawns here my respawn sound version it compiles but sound won't work:

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

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");
}

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
  client_cmd(id, "spk umbrella/admin.wav")
    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)
    }
}
DoviuX is offline
Send a message via Skype™ to DoviuX
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
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 08-12-2009 , 08:42   Re: How To Enable This Plugin
Reply With Quote #3

it doesn't work :/
DoviuX is offline
Send a message via Skype™ to DoviuX
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 18:25.


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