Raised This Month: $ Target: $400
 0% 

auto_restart_knives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-05-2009 , 13:11   Re: auto_restart_knives
Reply With Quote #1

, I didn't even touch that line. The only change I noticed you made was the knife -> deagle .

Updated.
__________________
fysiks is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 04-05-2009 , 14:36   Re: auto_restart_knives
Reply With Quote #2

i was bored too

PHP Code:
/* Plugin generated by AMXX-Studio */
/* 
FAQ: 
When Setting The Value For -> amx_auto_restart <- 
Setting Value Like This amx_auto_restart "30.0" Is Correct
Setting Value Like This amx_auto_restart "30" Is Not Correct
Because The Cvar Value Is A Float
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Auto Restart Deagle vl"
#define VERSION "1.0"
#define AUTHOR "vato loco [GE-S]"

#define EXTRAOFFSET_WEAPONS    4
#define OFFSET_CLIPAMMO          51

#define TIMER_TASK        123456
#define RESTART_TASK      789123

#define ACCESS_LEVEL ADMIN_IMMUNITY

new g_counter  

new g_autorestart
new g_autoenabled

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 
new bool:g_bDeagleArena

new g_iMaxPlayers

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
register_event("CurWeapon","ForceDeagle","be","1=1","2!26")
    
    
register_concmd("amx_auto_deagle","DeagleArena",ACCESS_LEVEL,"amx_auto_deagle <1/0>")
    
    
register_dictionary("auto_rr_deagle.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autorestart register_cvar("amx_auto_restart","45.0")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
    
    
g_iMaxPlayers get_maxplayers()
}

public 
DeagleArena(idlvlcid
{
    if(!
cmd_access(idlvlcid2))
        return 
PLUGIN_HANDLED
    
    
new szarg[8]
    
read_argv(1,szarg,7)
    
    if(
equal(szarg,"1"))
    {
        
set_pcvar_num(g_autoenabled1)
        
client_print(0,print_chat,"%L"LANG_PLAYER"ENABLED")
    }
    else if(
equal(szarg,"0"))
    {
        
set_pcvar_num(g_autoenabled0)
        
client_print(0,print_chat,"%L"LANG_PLAYER"DISABLED")
    }
    return 
PLUGIN_HANDLED



public 
RoundStart()
{
    if(
get_pcvar_num(g_autoenabled) && g_bDeagleArena)
    {
        for(new 
<= g_iMaxPlayers i++) 
        {
            if(
is_user_connected(i) && is_user_alive(i))
            {
                
fm_strip_user_weapons(i)
                
fm_give_item(i"weapon_deagle"
                
engclient_cmd(i,"weapon_deagle")
                
                new 
weapon_id fm_find_ent_by_owner(-1"weapon_deagle"i)
                
                if(
weapon_id)
                {
                    
fm_set_weapon_ammo(weapon_id56)
                }
            }
        }
    }
    if(
g_bRoundStart)
    {
        
set_hudmessage02550, -1.00.4015.08.00.00.0, -1)
        
ShowSyncHudMsg0g_SyncGameStart"%L",LANG_PLAYER"GAME_STARTED")
    }
    
g_bRoundStart false
    
    
return PLUGIN_CONTINUE
}

public 
RestartTask() 
{
    if(
get_pcvar_num(g_autoenabled) && !g_bDeagleArena)
    {
        
pause("ac","M_Antirusher.amxx")
        
        
g_bDeagleArena true
        
        set_task
(1.0,"TimeCounter",TIMER_TASK,_,_,"a",get_pcvar_num(g_autorestart))
        
set_task(get_pcvar_float(g_autorestart),"RestartRound",RESTART_TASK)
        
    }
    return 
PLUGIN_CONTINUE
}

public 
TimeCounter() 
{
    
g_counter++
    
    new 
Float:iRestartTime get_pcvar_float(g_autorestart) - g_counter
    
new Float:fSec
    fSec 
iRestartTime 
    
    set_hudmessage
0255255, -1.00.2500.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"fSec)
    
    if(
get_pcvar_num(g_autorestart) - g_counter && get_pcvar_num(g_autorestart) - g_counter !=0)
    {
        static 
szNum[32]
        
num_to_word(get_pcvar_num(g_autorestart) - g_counterszNum31)
        
client_cmd(0,"speak ^"vox/%s^""szNum)
    }
    if(
g_counter == get_pcvar_num(g_autorestart))
    {
        
g_bRoundStart true
    
}
}

public 
RestartRound() 
{
    new 
cmdrestartround[50]
    
formatex(cmdrestartround49"sv_restartround 1")
    
server_cmd(cmdrestartround)
    
    
unpause("ac","M_Antirusher.amxx")
    
    
g_bDeagleArena false
}

public 
ForceDeagle(id)

    if(
get_pcvar_num(g_autoenabled) && g_bDeagleArena)
    {
        new 
weapon_num
        weapon_num 
read_data(2)
        
        if(
weapon_num != CSW_DEAGLE
        {
            
engclient_cmd(id,"weapon_deagle")
        }
    }
    return 
PLUGIN_CONTINUE
}

stock fm_strip_user_weapons(index) {
    new 
ent fm_create_entity("player_weaponstrip")
    if (!
pev_valid(ent))
        return 
0
    
    dllfunc
(DLLFunc_Spawnent)
    
dllfunc(DLLFunc_Useentindex)
    
engfunc(EngFunc_RemoveEntityent)
    
    return 
1
}

stock fm_set_weapon_ammo(weapon_idnewammo) {    
    
    
set_pdata_int(weapon_idOFFSET_CLIPAMMOnewammoEXTRAOFFSET_WEAPONS)
}

stock fm_give_item(index, const item[]) {
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
        return 
0
    
    
new ent fm_create_entity(item)
    if (!
pev_valid(ent))
        return 
0
    
    
new Float:origin[3]
    
pev(indexpev_originorigin)
    
set_pev(entpev_originorigin)
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)
    
    new 
save pev(entpev_solid)
    
dllfunc(DLLFunc_Touchentindex)
    if (
pev(entpev_solid) != save)
        return 
ent
    
    engfunc
(EngFunc_RemoveEntityent)
    
    return -
1
}

stock fm_create_entity(const classname[]) {
    
    return 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringclassname)) 
}

stock fm_find_ent_by_owner(index, const classname[], ownerjghgtype 0) {
    new 
strtype[11] = "classname"ent index
    
switch (jghgtype) {
        case 
1copy(strtype6"target")
            case 
2copy(strtype10"targetname")
        }
    
    while ((
ent engfunc(EngFunc_FindEntityByStringentstrtypeclassname)) && pev(entpev_owner) != owner) {}
    
    return 
ent

Attached Files
File Type: txt auto_rr_deagle.txt (739 Bytes, 254 views)
File Type: sma Get Plugin or Get Source (auto_rr_deagle.sma - 749 views - 5.4 KB)
__________________

Last edited by vato loco [GE-S]; 04-05-2009 at 16:03.
vato loco [GE-S] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-05-2009 , 14:53   Re: auto_restart_knives
Reply With Quote #3

Nice. I was only trying to duplicate his code. You made your own . Oh, and I don't know much about CS so I only edited non-mod-specific code.

Some thoughts:

PHP Code:
if(!cmd_access(idlvlcid2))
{
    
client_print(idprint_console"%L"LANG_PLAYER"NO_ACCESS")
    
    return 
PLUGIN_HANDLED

You don't need the client_print() because cmd_access() will automatically show "no access" or "usage - blah blah".
__________________
fysiks is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 04-05-2009 , 14:55   Re: auto_restart_knives
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
You don't need the client_print() because cmd_access() will automatically show "no access" or "usage - blah blah".
hehe lol you are right...

edit: fixed
__________________

Last edited by vato loco [GE-S]; 04-05-2009 at 14:59.
vato loco [GE-S] 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 02:24.


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