Raised This Month: $12 Target: $400
 3% 

[Zombie Plague] Set Ammo Packs for All Players after x sec.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
carrx
Junior Member
Join Date: Mar 2020
Old 07-04-2022 , 06:15   [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #1

Hello! I have a strong request for a person who would like to make a small plugin for free.

I need a plugin that changed the number of ap for everyone on the server to x value after x seconds. Example: After changing the map to a new one, players enter and after 10 seconds everyone sets AP to 10.

Why do I need it? Because I have a set prize for winning the round (5 ap) and when players enter after changing the map, game commencing is called and only a few players get this prize. Then I have an auto restart 10 seconds after changing the map and after it also gives everyone on the server a reward.

Much thanks!
carrx is offline
TribalBlood
Member
Join Date: Oct 2020
Old 07-04-2022 , 06:58   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <zombieplague>

new cvar_ammopack;

public 
plugin_init()
{
    
register_plugin("Ammo_Pack_Change""1.2""TribalBlood");
    
register_clcmd("say /changeap""Time");
    
cvar_ammopack register_cvar("AP_amount""10");
}

public 
Time(id)
{
    if(!(
get_user_flags(id) & ADMIN_BAN))
    {
        return;
    }

    
client_print_color(00"edit this.");
    
set_task(15.0"Change_AP"id);
}

public 
Change_AP()
{
    for(new 
iget_maxplayers(); i++)
    {
        if(
is_user_connected(i))
        {
            
zp_set_user_ammo_packs(iget_pcvar_num(cvar_ammopack));
        }
    }


Last edited by TribalBlood; 07-05-2022 at 20:50. Reason: Code Update.
TribalBlood is offline
carrx
Junior Member
Join Date: Mar 2020
Old 07-04-2022 , 17:07   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #3

Thank you very much it's work, but i also need seconds after ap must change

Somthing like: after 15 seconds past change AP for all to 10.
carrx is offline
carrx
Junior Member
Join Date: Mar 2020
Old 07-05-2022 , 16:48   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #4

Quote:
Originally Posted by TribalBlood View Post
PHP Code:
#include <amxmodx>
#include <zombieplague>

public plugin_init()
{
    
register_plugin("Ammo_Pack_Change""1.1""TribalBlood");
    
register_clcmd("say /changeap""Time");
}

public 
Time(id)
{
    if(!(
get_user_flags(id) & ADMIN_BAN))
    {
        return;
    }

    
client_print_color(00"after 15 sec... [edit this]");
    
set_task(15.0"Change_AP");
}

public 
Change_AP()
{
    for(new 
iget_maxplayers(); i++)
    {
        
zp_set_user_ammo_packs(i10);
    }
}

/*
// when somebody enter.
public client_putinserver(id)
{
    zp_set_user_ammo_packs(id, 10);
}
*/ 

Not working. Compile whitout problems, No error logs but plugin doesn't set ap after 15 sec.

Last edited by carrx; 07-05-2022 at 16:48.
carrx is offline
carrx
Junior Member
Join Date: Mar 2020
Old 07-06-2022 , 05:37   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #5

Quote:
Originally Posted by TribalBlood View Post
PHP Code:
#include <amxmodx>
#include <zombieplague>

new cvar_ammopack;

public 
plugin_init()
{
    
register_plugin("Ammo_Pack_Change""1.2""TribalBlood");
    
register_clcmd("say /changeap""Time");
    
cvar_ammopack register_cvar("AP_amount""10");
}

public 
Time(id)
{
    if(!(
get_user_flags(id) & ADMIN_BAN))
    {
        return;
    }

    
client_print_color(00"edit this.");
    
set_task(15.0"Change_AP"id);
}

public 
Change_AP()
{
    for(new 
iget_maxplayers(); i++)
    {
        if(
is_user_connected(i))
        {
            
zp_set_user_ammo_packs(iget_pcvar_num(cvar_ammopack));
        }
    }

Same. No errors, compile whitout problems, Plugin ON... but does not set ap 10.

If i write manualy in chat: /changeap then after 15 sec plugin set my ap to 10.

Last edited by carrx; 07-06-2022 at 05:39.
carrx is offline
TribalBlood
Member
Join Date: Oct 2020
Old 07-06-2022 , 09:18   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #6

What Zp version do you use?
__________________
My Steam Profile

- Online Rarely -
TribalBlood is offline
carrx
Junior Member
Join Date: Mar 2020
Old 07-06-2022 , 16:49   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?t=72505
zp_plugin_50_patched - Version: 5.0.8a

Maby add AP command to this plugin (auto restart that im using on server)?
PHP Code:
#include <amxmodx>
#include <zombieplague>

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

#define TIMER_TASK        123456
#define RESTART_TASK      789123

new g_counter  

new g_autorestart
new g_autoenabled
new g_autocds
new g_autocount_color
new g_autostart_color
new g_auto_xypos

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
    
register_dictionary("auto_restart_vl.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autocds register_cvar("amx_autorr_cds","0")
    
g_autorestart register_cvar("amx_autorr_time","12")
    
g_autocount_color register_cvar("amx_autorr_count_color","0 255 0")
    
g_autostart_color register_cvar("amx_autorr_start_color","255 15 15")
    
g_auto_xypos register_cvar("amx_autorr_xypos","-1.0 0.25")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
}

public 
RoundStart()
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    
if(g_bRoundStart)
    {
        static 
rgbFloat:xFloat:y
        HudMsgPos
(x,y)
        
HudMsgColor(g_autostart_colorrgb)
        
        
set_hudmessagergbxy00.05.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))
        return 
PLUGIN_HANDLED
    
    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 
    
    
static rgbFloat:xFloat:y
    HudMsgPos
(x,y)
    
HudMsgColor(g_autocount_colorrgb)
    
    
set_hudmessagergbxy00.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"floatround(fSec))
    
    if(
get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter 11 && 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
        g_counter 
0
    
}
}

public 
RestartRound() 
{
    
server_cmd("sv_restartround 1")
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_auto_xypos coords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)


Last edited by carrx; 07-07-2022 at 04:16.
carrx is offline
TribalBlood
Member
Join Date: Oct 2020
Old 07-07-2022 , 07:44   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <zombieplague>

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

#define TIMER_TASK        123456
#define RESTART_TASK      789123

new g_counter  

new g_autorestart
new g_autoenabled
new g_autocds
new g_autocount_color
new g_autostart_color
new g_auto_xypos

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
    
register_dictionary("auto_restart_vl.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autocds register_cvar("amx_autorr_cds","0")
    
g_autorestart register_cvar("amx_autorr_time","12")
    
g_autocount_color register_cvar("amx_autorr_count_color","0 255 0")
    
g_autostart_color register_cvar("amx_autorr_start_color","255 15 15")
    
g_auto_xypos register_cvar("amx_autorr_xypos","-1.0 0.25")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
}

public 
RoundStart()
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    
if(g_bRoundStart)
    {
        static 
rgbFloat:xFloat:y
        HudMsgPos
(x,y)
        
HudMsgColor(g_autostart_colorrgb)
        
        
set_hudmessagergbxy00.05.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))
        return 
PLUGIN_HANDLED
    
    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 
    
    
static rgbFloat:xFloat:y
    HudMsgPos
(x,y)
    
HudMsgColor(g_autocount_colorrgb)
    
    
set_hudmessagergbxy00.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"floatround(fSec))
    
    if(
get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter 11 && 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
        g_counter 
0
    
}
}

public 
RestartRound() 
{
    
server_cmd("sv_restartround 1")

    for(new 
xget_maxplayers(); x++)
    {
        if(
is_user_connected(x))
        {
            
zp_set_user_ammo_packs(x10);
        }
    }
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_auto_xypos coords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)

__________________
My Steam Profile

- Online Rarely -

Last edited by TribalBlood; 07-07-2022 at 07:45.
TribalBlood is offline
carrx
Junior Member
Join Date: Mar 2020
Old 07-07-2022 , 17:04   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #9

It worked! Thank you for your work and patience! I wish you good health and happiness in these difficult times.
carrx is offline
TribalBlood
Member
Join Date: Oct 2020
Old 07-07-2022 , 19:51   Re: [Zombie Plague] Set Ammo Packs for All Players after x sec.
Reply With Quote #10

Quote:
Originally Posted by carrx View Post
It worked! Thank you for your work and patience! I wish you good health and happiness in these difficult times.
Thank you, and you too man.
__________________
My Steam Profile

- Online Rarely -
TribalBlood is offline
Reply


Thread Tools
Display Modes

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 11:59.


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