AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] mp_freezetime problem (https://forums.alliedmods.net/showthread.php?t=193215)

Kilroy666 08-17-2012 13:01

[help] mp_freezetime problem
 
1 Attachment(s)
Hi, mp_freezetime dosent stop player from moving at round start(it work only when you change weapon ex: knife > usp > knife) any idea/help :x ?

+ if someone will be so nice to help me make hud
on the left top corrner ex:
today we...
start in % seconds
alive terrorists %
(it show only when plugin is activated)
+music when countdown start

(i know its alot but i belive there are still good helpful people :D)

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>

#define PLUGIN "Ganiany"
#define VERSION "0.5"
#define AUTHOR "Gierek"
new g_tempid, goniec
new ctek[33]
new bron[33]
new Float:roundstart
new gn_time
new gn_speed
new Float: speed
public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_clcmd("say /ganiany", "ganianyspr");
        register_clcmd("say_team /ganiany", "ganianyspr");

        register_event("CurWeapon","cur_weapon","be", "1=1");

        register_forward(FM_CmdStart, "CmdStart");

        RegisterHam(Ham_Spawn, "player", "Odrodzenie", 1);
        RegisterHam(Ham_TakeDamage, "player", "TakeDamage");

        register_logevent("round_start", 2, "1=Round_Start")
        register_logevent("round_end", 2, "1=Round_End")

        register_cvar("gn_enable", "1")
        gn_time = register_cvar("gn_time", "20.0")
        gn_speed = register_cvar("gn_speed", "550.0")
        register_cvar("gn_weapon", "1")
}
public plugin_cfg()
{       
        server_cmd("sv_maxspeed 1600");
}
public cur_weapon(id)
{

        if(!is_user_alive(id))
                return PLUGIN_HANDLED;

        static Float:nowtime
        nowtime = get_gametime()

        if(goniec==1 && nowtime - roundstart < get_cvar_float("mp_roundtime")*60)
                engclient_cmd(id,"weapon_knife");

        return PLUGIN_HANDLED;
}
public round_start()
{
        roundstart = get_gametime()
}
public round_end()
{
        goniec=0
}
public CmdStart(id, uc_handle)
{
        if(!is_user_alive(id))
                return FMRES_IGNORED;


        static Float: nowtime
        nowtime = get_gametime()

        if(goniec==1 && ctek[id] == 0)
        {
                if(nowtime - roundstart <  get_cvar_float("mp_roundtime")*60)
                        set_user_maxspeed(id, speed);
                else
                {
                        set_user_maxspeed(id, 250.0);
                        if(bron[id]==1)
                        {
                                bron[id]=0
                                give_item(id, "weapon_m4a1")
                                cs_set_user_bpammo(id, CSW_M4A1, 120)
                        }
                }
        }
        return FMRES_IGNORED;
}
public Odrodzenie(id)
{
        if(!is_user_alive(id) || !is_user_connected(id))
                return PLUGIN_CONTINUE;

        set_user_maxspeed(id, 250.0);
        return PLUGIN_CONTINUE;
}
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
        if(!is_user_alive(this) || !is_user_connected(this) || !is_user_connected(idattacker) || get_user_team(this) == get_user_team(idattacker))
                return HAM_IGNORED;

        static Float:nowtime
        nowtime = get_gametime()

        if(cs_get_user_team(idattacker) == CS_TEAM_T && cs_get_user_team(this) == CS_TEAM_CT)
        {
                if(goniec==1 && nowtime - roundstart <  get_cvar_float("mp_roundtime")*60)
                {
                        set_user_frags(this,get_user_frags(this)+1)
                        return HAM_SUPERCEDE
                }
        }
        return HAM_IGNORED;       
}
public ganianyspr(id)
{
        if(get_cvar_num("gn_enable"))
        {
                if(cs_get_user_team(id) == CS_TEAM_T)
                {
                        client_print(id, print_chat, "[rzeznia.eu] Nie jestes Klawiszem");
                        return PLUGIN_HANDLED;
                }
                if(!is_user_alive(id))
                {
                        client_print(id, print_chat, "[rzeznia.eu] Nie Zyjesz wiec nie mozesz uzywac tej komendy");
                        return PLUGIN_HANDLED;
                }
                if(goniec==1)
                {
                        client_print(id, print_chat, "[rzeznia.eu] Ganiany jest juz wlaczony");
                        return PLUGIN_HANDLED;
                }
                goniec = 1
                force_open()
                ganiany()
                speed = get_pcvar_float(gn_speed)
                if(speed<250.0)
                        speed=250.0
        }
        return PLUGIN_HANDLED;
}
public ganiany()
{
        new players[32], pnum
        get_players(players, pnum)

        new Float: czas = get_pcvar_float(gn_time)

        for( new i; i<pnum;i++ )
        {
                g_tempid = players[i];

                if(get_cvar_num("gn_weapon"))
                        bron[g_tempid] = 1
                else
                        bron[g_tempid] = 0

                if(cs_get_user_team(g_tempid) == CS_TEAM_T && is_user_alive(g_tempid))
                {
                        set_user_maxspeed(g_tempid, 550.0);
                        ctek[g_tempid] = 0
                }
                if(cs_get_user_team(g_tempid) == CS_TEAM_CT && is_user_alive(g_tempid))
                {
                        strip_user_weapons(g_tempid);
                        give_item(g_tempid, "weapon_knife");       
                        set_user_maxspeed(g_tempid, 0.01);
                        set_task(czas, "ganianystart", g_tempid)
                        ctek[g_tempid] = 1
                }
        }
}
public ganianystart(id)
{
        ctek[id] = 0
}
public force_open()
{
        new ent = -1
        while((ent = fm_find_ent_by_class(ent, "func_door")))
        {                               
                dllfunc(DLLFunc_Use, ent, 0)
        }       
}


Napoleon_be 08-17-2012 22:57

Re: [help] mp_freezetime problem
 
It is because the code is setting maxspeed to a different value than set when freezetime is running. Delete the set_user_maxspeed options in your code and you won't be able to walk again while being in freeze time.


All times are GMT -4. The time now is 05:44.

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