Raised This Month: $ Target: $400
 0% 

Nightvision Color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-24-2007 , 12:53   Nightvision Color
Reply With Quote #1

hi, i tryed to change the NightVision color, but i don't dunno 100 %
my code:
Code:
#include <amxmodx>
#include <amxmisc>


#define PLUGIN "Test nvg color"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"

new pnumenable;
new pcolor;
new pnumradius
new pnumdecay

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("NVGToggle","open_nvg","be");
    
    pnumenable = register_cvar("custom_nvg","1");
    pcolor = register_cvar("custom_nvg_rgb","255 0 255");
    pnumradius = register_cvar("custom_nvg_radius","60");
    pnumdecay = register_cvar("custom_nvg_decay","70");
    
}

public open_nvg(id)
{
    if( (!id) || !is_user_connected(id))
    return PLUGIN_CONTINUE;
    
    if(!get_pcvar_num(pnumenable)) 
    return PLUGIN_CONTINUE;
    
    new origin[3];
    get_user_origin(id,origin,3)
    
    new color[17];
    get_pcvar_string(pcolor,color,16);
    
    new iRed[5], iGreen[7], iBlue[5]
    parse(color,iRed,4,iGreen,6,iBlue,4)
    
    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    write_byte(TE_DLIGHT);
    
    write_coord(origin[0]);
    write_coord(origin[1]);
    write_coord(origin[2]);
    
    write_byte(get_pcvar_num(pnumradius))
    
    write_byte(str_to_num(iRed))
    write_byte(str_to_num(iGreen))
    write_byte(str_to_num(iBlue))
    
    write_byte(7)
    write_byte(get_pcvar_num(pnumdecay))
    
    message_end();
    
    return PLUGIN_CONTINUE;
}
Problem: The Nighvision color won't changed, it's green but when i stop the nightvision appear for 1 second my TE_DLIGHT . Any ideia for what message type i should use to can change the nightvision color.

thanks

Last edited by SAMURAI16; 02-24-2007 at 13:11.
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 02-24-2007 , 19:19   Re: Nightvision Color
Reply With Quote #2

replace TE_DLIGHT from write_byte(TE_DLIGHT); with 27.
And will be: write_byte(27);


Te_DLIGHT
Code:
message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id) write_byte(27) // TE_DLIGHT write_coord(origin[0]) // X coord write_coord(origin[1]) // Y coord write_coord(origin[2]) // Z coord write_coord(radius) // radius write_byte(250) // red write_byte(0) // green write_byte(0) // blue write_byte(250) // brightness write_byte(10) // life write_coord(0) // decay rate message_end()
I tried to make a plugin but doesn't work . Maybe you will find a way to make it to work.

Last edited by hip_hop_x; 02-24-2007 at 20:36.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 02-24-2007 , 21:12   Re: Nightvision Color
Reply With Quote #3

Hi, i have no idea to solve your problem.
But i have a source where you can probably find a solution ;)
Look at here: http://forums.alliedmods.net/showthr...ght=specialist
This superhero (from Superhero Mod, i hope you know that) have an blue NVG.
I have this one installed and it works very nice..

greetz regalis
regalis is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-25-2007 , 03:21   Re: Nightvision Color
Reply With Quote #4

hip_hop_x it's better to use TE_DLIGHT instead of "27" to prevent hardcode. TE_DLIGHT it's alearly defined in message_const "27" .

regalis thanks for information, i will try

SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Old 02-25-2007, 11:49
Inogood
This message has been deleted by Inogood. Reason: yes, stupid post
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 03-01-2007 , 05:45   Re: Nightvision Color
Reply With Quote #6

Just wondering, did you fix this in the end SAMURAI16?
I could use this in the future if it works.
__________________
It's a mystery.
Mini_Midget is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 03-01-2007 , 08:07   Re: Nightvision Color
Reply With Quote #7

no.. i tryed new 3 ways to create this plugin but doesen't works correct
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
mogel
Senior Member
Join Date: Jan 2007
Old 03-01-2007 , 11:46   Re: Nightvision Color
Reply With Quote #8

Moin,

Code:
public plugin_init() {
    register_clcmd("nightvision","ToggleNVG") 
}
// ------------------------------------------------------------------------------
//
// weißes (!!) Nachtsichtgerät
// Idee von http://forums.alliedmods.net/showthread.php?t=51817
// dazu einfach lokal eine Lichtquelle alle 100ms erzeugen (oder weniger)
public ToggleNVG(player) { 
    if (spieler[player][E_S_USENVG])
    {
        StopNVG(player)
    } else
    {
        StartNVG(player)
    }

    return PLUGIN_HANDLED 
}
public StartNVG(player) {
    if ((roundstatus != RS_RUNNING) || (spieler[player][E_S_USENVG]) || !is_user_connected(player)) return PLUGIN_CONTINUE
    
    new name[32] 
    get_user_name(player, name, 32) 
    
    spieler[player][E_S_USENVG] = 1
    
    // anschalten
    set_task(0.2, "ShowNVG", player + 100, name, 32, "b")     // another task id for each player 
    
    return PLUGIN_CONTINUE
} 
public StopNVG(player) {
    
    // bereits abgeschaltet
    if (!spieler[player][E_S_USENVG]) return PLUGIN_CONTINUE
    
    // jetzt wirklich ausschalten
    remove_task(player + 100) 
    
    spieler[player][E_S_USENVG] = 0

    return PLUGIN_CONTINUE
}
public ShowNVG(player[]) {
    new id = get_user_index(player) 
    
    if (!is_user_connected(id)) return 

    // Radius setzen ... tote Spieler sehen mehr
    new radius = 50
    if (!is_user_alive(id)) radius = 100
    
    // jetzt die Position holen
    new origin[3]
    get_user_origin(id, origin)
    
    // Monitoring nicht vergessen
    if (fxinuse) return
    fxinuse = 1
    
    // lokale Lichtquelle erzeugen
    message_begin(MSG_ONE, SVC_TEMPENTITY, {0,0,0}, id) 
    
    write_byte(27) 
    
    write_coord(origin[0]) 
    write_coord(origin[1]) 
    write_coord(origin[2]) 
    
    write_byte(radius)
    
    write_byte(100) 
    write_byte(100) 
    write_byte(100)
    
    write_byte(5)         // Life
    write_byte(0)         // Decay
    
    message_end() 
    
    fxinuse = 0
}
hand, mogel
__________________
mogel is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 03-01-2007 , 13:40   Re: Nightvision Color
Reply With Quote #9

1) it's corrupted and i want to know are defined missed variables
2) i don't thing this will work because on "public ToggleNVG(player)" it's checked this :
PHP Code:
if (spieler[player][E_S_USENVG])
    {         
StopNVG(player
And where is defined to see when start the nightvision ?
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
mogel
Senior Member
Join Date: Jan 2007
Old 03-01-2007 , 15:40   Re: Nightvision Color
Reply With Quote #10

Hmm,

sorry ... it is a fast copy from my plugin

Code:
spieler[player][E_S_USENVG]

a simple boolean to check if the player already use the nvg

roundstatus != RS_RUNNING

it is a enum to remember the round-state ... running (between roundstart & roundend) and not running (the other time) ... the nvg can only start if the round running
Code:
enum ROUNDSTATUS {
	RS_END,
	RS_RUNNING,
	RS_UNDEFINED
}
new ROUNDSTATUS:roundstatus = RS_UNDEFINED
Code:
enum E_SPIELER {
	E_S_LEVEL,		// Level des Spielers
	E_S_SPEED,		// geschwindgikeit des Spieler
	E_S_MODEL,		// Model des Zombies bzw. Typ
	E_S_HOSTAGE_KILLED,	// soviele Geisel diese Runde gekillt
	E_S_HOSTAGE_RESCUED,	// soviele gerettet
	E_S_BOMB_PLANTED,	// soviele Bomben gelegt
	E_S_BOMB_DEFUSED,	// soviele entschärft
	E_S_PINGWARN,		// Ping-Warnungen
	E_S_SPAWNPROTECT,	// 1 wenn der Bot geschützt ist beim Spawn
	E_S_READVAULT,		// Spieler-Daten muss noch aus dem Vault gelesen werden
	E_S_LASTFLARE,		// letzte Fackel gelegt .. nur alle 5 Sekunden möglich
	E_S_HEALTH,		// Health des Spielers bzw. Bots
	E_S_USENVG		// NVG wird bereits benutzt
}
new spieler[33][E_SPIELER]
hand, mogel
__________________
mogel 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 00:37.


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