Raised This Month: $ Target: $400
 0% 

Blocking flashlight (impulse) only in T team.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tramp
Senior Member
Join Date: Aug 2005
Old 03-07-2008 , 21:31   Blocking flashlight (impulse) only in T team.
Reply With Quote #1

Hi could you help me?

I have such a briliant code

PHP Code:

#include <amxmodx>
#include <cstrike>

new bool:hasLight[32]

public 
plugin_init()
{
    
register_event("HLTV""playerSpawn""be")
}

public 
client_impulse(idimpulse)
{
    if(
impulse != 100)
        return 
PLUGIN_HANDLED_MAIN
    
if(!hasLight[id] && cs_get_user_team(id) == CS_TEAM_T)
    {
        
client_print(id,print_chat,"[H&S] Sorry, you can't use FlashLight!");
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE
}

public 
playerSpawn(idhasLight[id] = false 
And it will be blocking flashlight in the first round while you are in Terrorist team. If you join CT and next T you will have flashlight, and plugin won't block it.

How to repair it?

I tried also this command:
reset_user_wstats but this is not resseting equipment


Thanks
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.

Last edited by Tramp; 03-08-2008 at 04:51.
Tramp is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-07-2008 , 21:51   Re: Blocking flashlite (impulse) only in T team.
Reply With Quote #2

well to start, you hooked the player's spawn wrong.
learn how to here
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Tramp
Senior Member
Join Date: Aug 2005
Old 03-08-2008 , 03:51   Re: Blocking flashlite (impulse) only in T team.
Reply With Quote #3

It would help? :d

This code is extracted from this plugin.

http://forums.alliedmods.net/showthread.php?p=490909

and i added this && cs_get_user_team(id) == CS_TEAM_T

------
edit
------

PHP Code:
#include <amxmodx>
#include <cstrike>
#define MAX_PLAYERS 32

new bool:hasLight[32]
new 
bool:g_restart_attempt[MAX_PLAYERS 1]

public 
plugin_init() {
    
register_event("ResetHUD""event_hud_reset""be")
    
register_clcmd("fullupdate""clcmd_fullupdate")
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
}

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_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_CT)
    {
        
client_print(id,print_chat,"[H&S] Sorry, you can't use FlashLight!");
        return 
PLUGIN_HANDLED_MAIN
    
}
    return 
PLUGIN_CONTINUE

So now i rewrite it :-)

But there is still problem. Situation:
player has been transferred from Terrorist (where flashlight is available) to CT with flashlight on.
He still has flashlight :/ and can use it.

It works only for new people who never been i Terrorist Team

=========
edit2

i've noticed that this problem is due to this plugin. Normal flashlight is being stoped before round end. But in this plugin depends on player click.

PHP Code:

 
#include <amxmodx>
 #include <engine>

 
new flashlight[33];

 public 
plugin_init() {
    
register_plugin("CustomFlashlight","0.10","Avalanche");
    
register_event("Flashlight","event_flashlight","b");
    
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");
 }

 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")); // R
        
write_byte(get_cvar_num("flashlight_g")); // G
        
write_byte(get_cvar_num("flashlight_b")); // B
        
write_byte(1); // life
        
write_byte(get_cvar_num("flashlight_decay")); // decay rate
        
message_end();
    }
 } 
Could you try to prevent it? I dont know how
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.

Last edited by Tramp; 03-08-2008 at 05:14.
Tramp is offline
Tramp
Senior Member
Join Date: Aug 2005
Old 03-08-2008 , 06:58   Re: Blocking flashlight (impulse) only in T team.
Reply With Quote #4

Okey, now i know how to do it.

Just in customflashlight we should add round end and there
flashlight[id] = false

Please close.
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.
Tramp is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-08-2008 , 07:04   Re: Blocking flashlight (impulse) only in T team.
Reply With Quote #5

So, you want to allow custom flashlight for only 1 team, and no flashlight for the other team ?
And do you want to use old custom flashlight plugin, of v0.11 ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Tramp
Senior Member
Join Date: Aug 2005
Old 03-08-2008 , 07:29   Re: Blocking flashlight (impulse) only in T team.
Reply With Quote #6

Quote:
Originally Posted by connorr View Post
So, you want to allow custom flashlight for only 1 team, and no flashlight for the other team ?
Yes and it works that what i have done
But now i have problem with random flashlight color, new color after "F" click :d


Quote:
And do you want to use old custom flashlight plugin, of v0.11 ?
Hmm i dont know what you wanted to said
I'm editing this plugin typical "cat vs mouse" :d
without any darkness, sounds etc.

I'm adding, fog, changeable darknes etc.
I when i get to know how to make random flashlights i merge this code in the new

I dont know that amxx could be so easy

You could test what i did there:
http://forums.alliedmods.net/showthr...highlight=Seek



This one modified with darkness etc, from djeyl was crashing my server ;)
So i started "recoding" this which i posted
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.
Tramp is offline
Reply



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:08.


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