Raised This Month: $ Target: $400
 0% 

Auto restart knives, how change knive to shotgun?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tramp
Senior Member
Join Date: Aug 2005
Old 02-21-2008 , 08:05   Auto restart knives, how change knive to shotgun?
Reply With Quote #1

Hi that is warm-up plugin. After 45 restart and normal game but before people have knifes only. How change knives to for example shotguns?
I tried to change this part of code, but it dont work

PHP Code:
public switchweapon(id)
{
    if (!
knifeArena)
        return 
PLUGIN_CONTINUE

    engclient_cmd
(id,"weapon_knife")

    return 
PLUGIN_CONTINUE

to this

PHP Code:
public switchweapon(id)
{
    if (!
knifeArena)
        return 
PLUGIN_CONTINUE

    engclient_cmd
(id,"weapon_xm1014")

    return 
PLUGIN_CONTINUE

weapon_xm1014


That is source code this plugin.
PHP Code:
/* 
* AMX Mod X script. 
* Auto restart Knives by VikuS
* Skrypt powstał na bazie skryptu Auto-Restart by -ThX-
* Działa tylko pod AMXX
*
* amx_auto_rr_knives -- 1-ON 0-OFF
*
* CVAR: auto_rr_time <time> default 45

*/    

#include <amxmodx> 
#include <amxmisc>

#define SETHUDMSG    set_hudmessage(000, 100, 255, -1.0, 0.25, 0, 6.0, 1.0, 0.1, 0.2, 4);
#define LEVEL_LEVEL    ADMIN_CFG

new bool:AutoRR true
new bool:knifeArena false

public plugin_init()
{
    
register_plugin("Auto-Restart-Knives","0.2","VikuS")
    
register_dictionary("auto_restart_knives.txt")
    
register_concmd("amx_auto_rr_knives","auto_rr",LEVEL_LEVEL," - 1 : ON | 0 : OFF")
    
register_cvar("auto_rr_time","45")
    
register_event("TextMsg","restart_time","a","2&#Game_C")
    
register_event("CurWeapon","switchweapon","be","1=1","2!29")
    return 
PLUGIN_CONTINUE
}

public 
auto_rr(id)
{
    if (!(
get_user_flags(id)&LEVEL_LEVEL)) {
        
client_print(idprint_console"[AMXX] %L"LANG_PLAYER"NO_ACCESS")
        
        return 
PLUGIN_HANDLED
    
}

    new 
arg [2]
    
read_argv(1,arg,1)

    if(
equal(arg"1"))
    {
        
AutoRR true
        client_print
(id,print_console,"[AMXX] %L"LANG_PLAYER"ENABLED")
    }
    else if(
equal(arg"0"))
    {
        
AutoRR false
        client_print
(id,print_console,"[AMXX] %L"LANG_PLAYER"DISABLED")
    }
    else if(!
equal(arg"1") || equal(!arg"0"))
    {
        
client_print(id,print_console,"amx_auto_rr_knives 1 = On | 0 = Off");
    }
    return 
PLUGIN_HANDLED
 
}

public 
switchweapon(id)
{
    if (!
knifeArena)
        return 
PLUGIN_CONTINUE

    engclient_cmd
(id,"weapon_knife")
    return 
PLUGIN_CONTINUE
}

public 
restart_time() 
{
    if (
AutoRR==true)
    {
        new 
restart_time=get_cvar_num("auto_rr_time")

        
knifeArena true

        SETHUDMSG
        show_hudmessage
(0"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",restart_time)

        
set_task(float(restart_time),"restart_map",0)
        
set_task(float(restart_time)-1,"restart_1s",0)
        
set_task(float(restart_time)-2,"restart_2s",0)
        
set_task(float(restart_time)-3,"restart_3s",0)
        
set_task(float(restart_time)-4,"restart_4s",0)
        
set_task(float(restart_time)-5,"restart_5s",0)

        if (
restart_time 10)
        {
        
set_task(float(restart_time)-10,"restart_10s",0)
        }
        if (
restart_time 15)
        {
        
set_task(float(restart_time)-15,"restart_15s",0)
        }
        if (
restart_time 20)
        {
        
set_task(float(restart_time)-20,"restart_20s",0)
        }
        if (
restart_time 30)
        {
        
set_task(float(restart_time)-30,"restart_30s",0)
        }
        if (
restart_time 40)
        {
        
set_task(float(restart_time)-40,"restart_40s",0)
        }
        if (
restart_time 50)
        {
        
set_task(float(restart_time)-50,"restart_50s",0)
        }
        if (
restart_time 60)
        {
        
set_task(float(restart_time)-60,"restart_60s",0)
        }
    }
}

public 
restart_60s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_MIN",1)
}
public 
restart_50s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",50)
}
public 
restart_40s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",40)
}
public 
restart_30s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",30)
}
public 
restart_20s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",20)
}
public 
restart_15s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",15)
}
public 
restart_10s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",10)
}
public 
restart_5s() 

    
SETHUDMSG 
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",5)
    
client_cmd(0,"spk vox/five")

public 
restart_4s() 

    
SETHUDMSG
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",4)
    
client_cmd(0,"spk vox/four")

public 
restart_3s()
{
    
SETHUDMSG
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",3)
    
client_cmd(0,"spk vox/three")
}
public 
restart_2s()
{
    
SETHUDMSG
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",2)
    
client_cmd(0,"spk vox/two")
}
public 
restart_1s()
{
    
SETHUDMSG
    show_hudmessage
(0,"%L"LANG_PLAYER"AUTO_RR_FOR_SEC",1)
    
client_cmd(0,"spk vox/one")
}

public 
restart_map() 
{
    if (
AutoRR==true)
    {
        
set_cvar_float("sv_restart",1.0);
        
knifeArena false
        set_task
(2.0,"hudmess_show",0)
        
SETHUDMSG
        show_hudmessage
(0"%L"LANG_PLAYER"AUTOMATIC"
        
client_cmd(0,"spk misc/trabka.wav")
    }
}

public 
hudmess_show()
{
        
set_hudmessage(01002000.050.6520.026.00.010.12)
        
show_hudmessage(0"%L"LANG_PLAYER"NICE_GAME")
}

public 
plugin_precache()
{
    
precache_sound"misc/trabka.wav")
    return 
PLUGIN_CONTINUE

__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.
Tramp is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-21-2008 , 08:52   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #2

It didn't work because players didn't have this weapon.
You must make sure that player will always have that weapon to make it work (give it after spawn, block drop, block buy).
__________________
Impossible is Nothing
Sylwester is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-21-2008 , 09:36   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #3

With this plugin you can choose primary and secondary weapon :
http://www.cs-amx.com/forum/index.ph...6698#msg106698
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Tramp
Senior Member
Join Date: Aug 2005
Old 02-21-2008 , 09:54   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #4

But when it comes to my plugin, will be working if I add there

give_item(0,"weapon_xm1014")

so

PHP Code:
public switchweapon(id)
{
    if (!
knifeArena)
        return 
PLUGIN_CONTINUE

    give_item
(0,"weapon_xm1014")
    
engclient_cmd(id,"weapon_xm1014")

    return 
PLUGIN_CONTINUE

That is ok? Connorr hmm this France plugin is ok but i like a counter from main plugin
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.
Tramp is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 02-21-2008 , 10:34   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #5

nope , i think you have to register when the player spawns
and then give him the weapon and use set_task with a little delay
__________________

Last edited by atomen; 02-21-2008 at 11:05.
atomen is offline
Send a message via MSN to atomen
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-21-2008 , 11:00   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #6

Tramp, the plugin you have posted (Auto restart Knives by Vikus) is not so well coded. connorr has posted much better plugin and as atomen said, that simple change "add give_item(0,"weapon_xm1014")" will not fix your problem.
__________________
Impossible is Nothing
Sylwester is offline
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 02-21-2008 , 12:15   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #7

Here is my lasyscript. Only has shotgun in it maybe i add cvar later.
Attached Files
File Type: sma Get Plugin or Get Source (shotgun.sma - 1131 views - 1.9 KB)
[X]-RayCat is offline
Tramp
Senior Member
Join Date: Aug 2005
Old 02-21-2008 , 15:03   Re: Auto restart knives, how change knive to shotgun?
Reply With Quote #8

Thanks so i will try connor plugin and RayCat
__________________
STER-Gaming.pl - The Best Multigaming Club, CS 1.6, CS:S, ET, COD 2 more and more ! Check forum forum.ster-gaming.pl

amxmodx - Polish support about amxx.
Tramp 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 21:08.


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