Raised This Month: $ Target: $400
 0% 

2 more little problems


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-26-2011 , 13:22   2 more little problems
Reply With Quote #1

so...i have this plugin
i've tried to make it set a cvar's value to 7 on round end and then restore it on round start (variable nvg_radius)
but it doesn't work...it doesn't set the radius back to normal on round start
and the second problem is that sometimes, the hand model doesn't change back on round start either
here's the code...please help
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

new Hands[33], RandomMaxPlayersChekUserHandsSetNVision

// Normal Models
new const MODELS[3][] =
{
    
"",
    
"models/zombie_plague/zombie_win.mdl",
    
"models/zombie_plague/human_win.mdl"
}

new const 
MODELS2[3][] =
{
    
"",
    
"models/zombie_plague/zombie_win_2.mdl",
    
"models/zombie_plague/human_win_2.mdl"
}

// Fliped Models
new const MODELS_FLIP[3][] =
{
    
"",
    
"models/zombie_plague/zombie_win-f.mdl",
    
"models/zombie_plague/human_win-f.mdl"
}

new const 
MODELS_FLIP2[3][] =
{
    
"",
    
"models/zombie_plague/zombie_win-f_2.mdl",
    
"models/zombie_plague/human_win-f_2.mdl"
}


new 
g_iModelIndex[3], g_iModelIndexFlip[3], g_iModelIndex2[3], g_iModelIndexFlip2[3], g_iWinTeamnvg_radius

public plugin_init()
{
    
register_plugin("[ZP] Sub-Plugin: New Win Messages""1.4""Shidla / xPaw / 93()|29!/<" )
    
register_event("HLTV""EventRoundStart""a""1=0""2=0" )
    
register_event("CurWeapon""EventCurWeapon""be""1=1")

    
MaxPlayers get_maxplayers()

    
register_cvar("Shidla""[ZP] Sub-Plugin: New Win Messages v.1.4"FCVAR_SERVER|FCVAR_SPONLY)
    
register_cvar("zp_new_win_messages""[ZP] Sub-Plugin: New Win Messages v.1.4"FCVAR_SERVER|FCVAR_SPONLY)

    
ChekUserHands register_cvar("zp_new_win_msg_chek" "1")
    
SetNVision register_cvar("zp_new_win_msg_set_nvision" "1")
}

public 
plugin_precache()
{
    for (new 
WIN_ZOMBIES<= WIN_HUMANSi++)
    {
        
// Normal Models
        
precache_model(MODELS[i])
        
g_iModelIndex[i] = engfunc(EngFunc_AllocStringMODELS[i])
        
precache_model(MODELS2[i])
        
g_iModelIndex2[i] = engfunc(EngFunc_AllocStringMODELS2[i])

        
// Fliped Models
        
precache_model(MODELS_FLIP[i])
        
g_iModelIndexFlip[i] = engfunc(EngFunc_AllocStringMODELS_FLIP[i])
        
precache_model(MODELS_FLIP2[i])
        
g_iModelIndexFlip2[i] = engfunc(EngFunc_AllocStringMODELS_FLIP2[i])
    }
}

public 
client_connect(id)
{
    if(!
is_user_bot(id) && get_pcvar_num (ChekUserHands))
        
query_client_cvar(id "cl_righthand" "Hands_CVAR_Value")
}

public 
Hands_CVAR_Value(id, const cvar[], const value[])
{
    if((
<= id <= MaxPlayers) && get_pcvar_num (ChekUserHands))    // Bug Fix & Cheking
        
Hands[id] = str_to_num(value)
}

public 
client_disconnect(id)
{
    if(
get_pcvar_num (ChekUserHands))
        
Hands[id] = 0
}

public 
zp_round_ended(iTeam)
{
    if (
iTeam == WIN_NO_ONE)
        return
    
    
g_iWinTeam iTeam
    
new iPlayers[32], iNum
    get_players
(iPlayersiNum"ch")

    
Random random_num(1)
    for (new 
iiNumi++)
    {
        if(
get_pcvar_num (ChekUserHands))
            
client_cmd(iPlayers[i], "cl_righthand ^"1^"")

        if(
get_pcvar_num(SetNVision))
        {
            
nvg_radius get_cvar_num("zp_nvg_size")
            
set_cvar_num("zp_nvg_size"7)
            
            
zp_set_user_nightvision(iPlayers[i], 1)
        }
        
        switch(
Random)
        {
            case 
0:
            {
                if (
get_user_weapon(iPlayers[i]) != CSW_KNIFE)
                    
set_pev(iPlayers[i], pev_viewmodelg_iModelIndexFlip[iTeam])
                else
                    
set_pev(iPlayers[i], pev_viewmodelg_iModelIndex[iTeam])
            }

            case 
1:
            {
                if (
get_user_weapon(iPlayers[i]) != CSW_KNIFE)
                    
set_pev(iPlayers[i], pev_viewmodelg_iModelIndexFlip2[iTeam])
                else
                    
set_pev(iPlayers[i], pev_viewmodelg_iModelIndex2[iTeam])
            }
        }
    }
}

public 
EventRoundStart()
{
    
g_iWinTeam WIN_NO_ONE
    
    
if (get_cvar_num("zp_nvg_size") != nvg_radius)
        
set_cvar_num("zp_nvg_size"nvg_radius)
    
    if(
get_pcvar_num (ChekUserHands))
    {
        for (new 
1<= MaxPlayersi++)
        {
            if(!
is_user_connected(i))
                continue        
// xPaw fix)))

            
client_cmd(i"cl_righthand ^"%d^""Hands[i])
        }
    }
}

public 
EventCurWeapon(const id)
{
    if (
g_iWinTeam WIN_NO_ONE)
    {
        if (
get_pcvar_num (ChekUserHands))
            
client_cmd(id"cl_righthand ^"1^"")

        switch(
Random)
        {
            case 
0:
            {
                if (
get_user_weapon(id) != CSW_KNIFE)
                    
set_pev(idpev_viewmodelg_iModelIndexFlip[g_iWinTeam])
                else
                    
set_pev(idpev_viewmodelg_iModelIndex[g_iWinTeam])
            }

            case 
1:
            {
                if (
get_user_weapon(id) != CSW_KNIFE)
                    
set_pev(idpev_viewmodelg_iModelIndexFlip2[g_iWinTeam])
                else
                    
set_pev(idpev_viewmodelg_iModelIndex2[g_iWinTeam])
            }
        }
    }

Attached Files
File Type: sma Get Plugin or Get Source (zp_new_win_msg_1.4.sma - 535 views - 5.0 KB)
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
 



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 04:18.


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