Raised This Month: $ Target: $400
 0% 

petit probleme + night interdit ct


  
 
 
Thread Tools Display Modes
Author Message
spirit
Senior Member
Join Date: Jul 2009
Location: Quimper
Old 12-18-2009 , 04:19   petit probleme + night interdit ct
#1

bonjour j'ai un petit problème avec se plugin qui autorise seulement la torche au ct le problème c'est que il n'on pas les multiple couleur de la torche puis je voudrai ajouter que les terroristes aient une nightvision et que pour les ct c'est bloquer

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>

#define MAX_PLAYERS 32

new bool:hasLight[32]
new 
bool:g_restart_attempt[MAX_PLAYERS 1]
new 
flashlight[33];

public 
plugin_init() 
{
    
//event
    
register_event("ResetHUD""event_hud_reset""be")
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
    
register_event("Flashlight","event_flashlight","b");
    
    
//cvar
    
register_cvar("flashlight_custom","1");
    
register_cvar("flashlight_r","100");
    
register_cvar("flashlight_g","100");
    
register_cvar("flashlight_b","100");
    
register_cvar("flashlight_radius","9");
    
register_cvar("flashlight_decay","60");
    
    
register_clcmd("fullupdate""clcmd_fullupdate")
}

public 
clcmd_fullupdate() 
{
    return 
PLUGIN_HANDLED_MAIN
}

public 
event_restart_attempt() 
{
    
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}

public 
event_hud_reset(id
{
    if (
g_restart_attempt[id]) 
    {
        
g_restart_attempt[id] = false
        
return
    }
    
event_player_spawn(id)
}
public 
event_flashlight(id
{
    if(!
get_cvar_num("flashlight_custom")) 
    {
        return;
    }
    
    if(
flashlight[id]) 
    {
        
flashlight[id] = 0;
    }
    else 
    {
        
flashlight[id] = 1;
    }
    
    
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
    
write_byte(flashlight[id]);
    
write_byte(100);
    
message_end();
    
    
entity_set_int(id,EV_INT_effects,entity_get_int(id,EV_INT_effects) & ~EF_DIMLIGHT);
}

public 
client_PreThink(id
{
    if(!
get_cvar_num("flashlight_custom")) 
    {
        return;
    }
    
    if(
flashlight[id]) 
    {
        new 
origin[3];
        
get_user_origin(id,origin,3);
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(27); // TE_DLIGHT
        
write_coord(origin[0]); // X
        
write_coord(origin[1]); // Y
        
write_coord(origin[2]); // Z
        
write_byte(get_cvar_num("flashlight_radius")); // radius
        
write_byte(get_cvar_num("flashlight_r")); // Rouge
        
write_byte(get_cvar_num("flashlight_g")); // vert
        
write_byte(get_cvar_num("flashlight_b")); // Bleu
        
write_byte(1); // life
        
write_byte(get_cvar_num("flashlight_decay"));
        
message_end();
    }
}  

public 
event_player_spawn(id)
{
    
hasLight[id] = false
}

public 
client_impulse(idimpulse)
{
    if(
impulse != 100)
        return 
PLUGIN_HANDLED_MAIN
    
if(!hasLight[id] && cs_get_user_team(id) == CS_TEAM_T)
    {
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE


Last edited by spirit; 12-18-2009 at 04:22.
spirit 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 17:46.


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