Raised This Month: $ Target: $400
 0% 

emit_sound and stop with task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mr.Bot
Member
Join Date: Mar 2007
Old 06-24-2007 , 14:29   emit_sound and stop with task
Reply With Quote #1

Hello i whant to add a task to play a sound for all player in the game and when i get out of my fenwick i whant the sound off.
I do this but it dosn't work can you help me plz thx

Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fun>

#define PLUGIN "Fenmaster"
#define VERSION "1.0"
#define AUTHOR "PsYcOpAtHe"

new aiment[33];
new oldmodel[33][33]
new allow[33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("voiture","make_aiment");
    register_clcmd("supvoiture","delete_aiment");
    register_touch("player","player","crash")
}

public plugin_precache()
{
    precache_model("models/fenwick.mdl");
}

public make_aiment(id)
{
    if(!(get_user_flags(id) & ADMIN_KICK))
    {
        client_print(id,print_chat,"Tu n'a pas acces a cela n'esseye même pas !");
        return PLUGIN_HANDLED;
    }
    set_view(id, CAMERA_3RDPERSON)
    aiment[id] = create_entity("info_target");
    entity_set_model(aiment[id],"models/fenwick.mdl");
    entity_set_int(aiment[id],EV_INT_movetype,MOVETYPE_FOLLOW);
    entity_set_edict(aiment[id],EV_ENT_aiment,id);
    entity_set_int(aiment[id],EV_INT_sequence,1);
    entity_set_float(aiment[id],EV_FL_animtime,20.0);
    entity_set_float(aiment[id],EV_FL_framerate,1.0);
    allow[id] = 0
    
    set_task(3.0,"play_sound", id+34,"",0, "b")
    
    return PLUGIN_HANDLED
}

public crash(entid, id)
{
    if(allow[entid] == 1 || allow[id] == 1) 
        return PLUGIN_HANDLED
    
    if(aiment[id] && aiment[entid]) {
        new hp = get_user_health(entid)
        new hp2 = get_user_health(id)
        set_user_health(entid,(hp - 200))
        set_user_health(id,(hp2 - 200))
        set_user_info(id,"model",oldmodel[id])
        return PLUGIN_HANDLED
    }
    if(aiment[id]) {
        new hp = get_user_health(id)
        set_user_health(id,(hp - 10))
        return PLUGIN_HANDLED
    }
    if(aiment[entid]) {
        set_user_health(id,0)
        return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

public delete_aiment(id)
{
    remove_entity(aiment[id])
    set_view(id, CAMERA_NONE)
    allow[id] = 1
    
    if(task_exists(id+34))
    {
        remove_task(id+34)
    }
}

public play_sound(taskid)
{
    new id = taskid - 34
    
    emit_sound(aiment[id], CHAN_VOICE, "apache/ap_rotor2.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
}
__________________


Mr.Bot is offline
 


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 21:24.


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