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 03-01-2007 , 08:07   Re: Nightvision Color
Reply With Quote #1

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 #2

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
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