Raised This Month: $32 Target: $400
 8% 

heating


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-06-2020 , 12:17   heating
Reply With Quote #1

hello good morning, i have this warming plugin works fine but has a problem. when there is no one or 1 player enters the warm-up begins. I would like it to start when there are 2 or more players playing.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>

new g_Timeg_HudSyncRefg_verified[33]

public 
plugin_init()
{
    
register_plugin("ARDM""1.0""spree")
    
register_cvar("amx_art","50")
    
    
g_HudSyncRef CreateHudSyncObj()
    
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
RegisterHam(Ham_Killed,"player","player_kill"0)
    
    
register_event("TeamInfo""join_team""a")
    
register_message(get_user_msgid("Money"),"block_money")

    
register_clcmd("chooseteam","blockchooseteam")
    
register_clcmd("drop","blockdrop")
    
register_clcmd("radio1","blockradio")
    
register_clcmd("radio2","blockradio")
    
register_clcmd("radio3","blockradio")
    
    
set_task(1.0"restart"654201_0"b"0)
    
g_Time get_cvar_num("amx_art")
}

public 
client_putinserver(id)
{
    
g_verified[id] = true
}

public 
block_money()
{
    if(
g_Time 0) return PLUGIN_HANDLED
    
return PLUGIN_CONTINUE
}

public 
restart()
{
    
g_Time--
    if(
g_Time 0){
    
set_hudmessage(0150255, -1.00.150_1.0__, -1)
    
ShowSyncHudMsg(0g_HudSyncRef"Calentamiento!^nReinicio automatico en %d segundos."g_Time)
    }else{
    
remove_task(654201)
    
server_cmd("sv_restartround 1")
    
set_task(3.0"glahf")
    }
}

public 
glahf()
{
    
set_hudmessage(150500, -1.00.1520.12.00.10.5, -1)
        
show_hudmessage0"Buena suerte, diviertete!")
}

public 
join_team()
{
    static 
pidTeamName[32]
    
pid read_data(1)
    
read_data(2TeamNamesizeof TeamName 1)
    switch(
TeamName[0]){
    case 
'C': if(!is_user_alive(pid) && g_verified[pid]) ExecuteHamB(Ham_CS_RoundRespawn,pid)
    case 
'T': if(!is_user_alive(pid) && g_verified[pid]) ExecuteHamB(Ham_CS_RoundRespawn,pid)
    }
    return 
0
}

public 
player_spawn(id)
{
    if(
is_user_alive(id) && g_Time 1){
    
g_verified[id] = false
    cs_set_user_money
(id,0)
    
set_user_godmode(id,1)
    
set_user_rendering(id,kRenderFxGlowShell,255,150,0,kRenderNormal,50)
    
set_task(2.0"off_godmode"id)
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")
    
give_item(id"item_assaultsuit")
    
give_item(id"weapon_deagle")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id,"ammo_50ae")
    
give_item(id"weapon_hegrenade")
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
give_item(id"weapon_ak47")
        
give_item(id,"ammo_762nato")
        
give_item(id,"ammo_762nato")
        
give_item(id,"ammo_762nato")
        }else{
        
give_item(id"weapon_m4a1")
        
give_item(id,"ammo_556nato")
        
give_item(id,"ammo_556nato")
        
give_item(id,"ammo_556nato")
        }
    }
}

public 
off_godmode(id)
{
    
set_user_godmode(id,0)
    
set_user_rendering(id)
}

public 
player_kill(victimattacker)
{
    if(
g_Time 2)
    {
        
set_task(2.0"respawn"victim)
        
set_hudmessage(1500150, -1.00.2911.01.00.11.0, -1)
        
show_hudmessage(victim"Recuperacion")
        
strip_user_weapons(victim)
        
        if(
is_user_alive(attacker) && cs_get_user_team(attacker) == CS_TEAM_T){
        
give_item(attacker,"ammo_762nato")
        
give_item(attacker,"ammo_50ae")
        }else if(
is_user_alive(attacker)){
        
give_item(attacker,"ammo_556nato")
        
give_item(attacker,"ammo_50ae")    
        }
    }
}

public 
respawn(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR) return
    
ExecuteHamB(Ham_CS_RoundRespawn,id)
}

public 
blockchooseteam(id)
{
    if(
g_Time 0){
    
color_print(id"!tCalentamiento:!n elige equipo bloqueado!")
    
client_cmd(id,"spk buttons/blip1.wav")
    return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
blockdrop(id)
{
    if(
g_Time && is_user_alive(id)){
    
color_print(id"!tCalentamiento:!n caida bloqueada!")
    
client_cmd(id,"spk buttons/blip1.wav")
    return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
blockradio(id)
{
    if(
g_Time && is_user_alive(id)){
    
color_print(id"!tCalentamiento:!n radio bloqueado!")
    
client_cmd(id,"spk buttons/blip1.wav")
    return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_disconnected(id)
{
    if(
task_exists(id)){
    
remove_task(id)
    }
}

stock color_print(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^x04"); // Green Color
    
replace_all(msg190"!n""^x01"); // Default Color
    
replace_all(msg190"!t""^x03"); // Team Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");{
            for (new 
0counti++){
            if (
is_user_connected(players[i])){
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
            }
        }
    }

El Abuelo Loco is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2020 , 12:22   Re: heating
Reply With Quote #2

Possibly just:
Code:
if(is_user_alive(id) && g_Time > 1 && get_playersnum() > 1){
__________________
DJEarthQuake is offline
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-06-2020 , 12:32   Re: heating
Reply With Quote #3

Quote:
Originally Posted by DJEarthQuake View Post
Possibly just:
Code:
if(is_user_alive(id) && g_Time > 1 && get_playersnum() > 1){
where do i add it? in what line?
El Abuelo Loco is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2020 , 13:23   Re: heating
Reply With Quote #4

Replacement first line on player_spawn.
__________________
DJEarthQuake is offline
Old 12-06-2020, 13:56
El Abuelo Loco
This message has been deleted by El Abuelo Loco. Reason: no es lo que queria ppner
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-06-2020 , 14:00   Re: heating
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
Replacement first line on player_spawn.
MMM. when I enter the server it starts to warm up and it actually has to do it when there are 2 or more players on the server.

Last edited by El Abuelo Loco; 12-06-2020 at 14:01.
El Abuelo Loco is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2020 , 15:26   Re: heating
Reply With Quote #6

Replace > 1 with >= 2

There might be more involved but at a glance that was where I would start.
__________________

Last edited by DJEarthQuake; 12-06-2020 at 15:27.
DJEarthQuake is offline
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-06-2020 , 16:25   Re: heating
Reply With Quote #7

Quote:
Originally Posted by DJEarthQuake View Post
Replace > 1 with >= 2

There might be more involved but at a glance that was where I would start.
The poor thing but still starts "automatic restart in 25 seconds .." 1 player is connected.
El Abuelo Loco is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2020 , 17:16   Re: heating
Reply With Quote #8

The task needs moved to a new function then looking more carefully.
Code:
public client_putinserver(id) if(get_playersnum() > 1)set_task(1.0, "restart", 654201, _, 0, "b", 0);

So then the task won't process if there is only 1 player.
__________________
DJEarthQuake is offline
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-06-2020 , 17:50   Re: heating
Reply With Quote #9

Quote:
Originally Posted by DJEarthQuake View Post
The task needs moved to a new function then looking more carefully.
Code:
public client_putinserver(id) if(get_playersnum() > 1)set_task(1.0, "restart", 654201, _, 0, "b", 0);

So then the task won't process if there is only 1 player.
it was already I give up does not work.
El Abuelo Loco is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2020 , 19:22   Re: heating
Reply With Quote #10

HINT: The join_team function needs the player restriction code added also.
__________________
DJEarthQuake 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 16:04.


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