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

Waiting for other players [Plugin]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ColaSola
Junior Member
Join Date: Apr 2016
Old 04-30-2016 , 10:14   Waiting for other players [Plugin]
Reply With Quote #1

Hello everybody take a look there please: I compiled the plugin, Running in console but is not doing anything.The plugin should work like that: After i change the map everybody will get a message like: We still waiting other players. And no one have the right to move.Only for 15 seconds after the round will restart. Thanks!

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

new bool:g_firstround

new restart_seconds 20;
new 
g_rounds 0;

public 
plugin_init()
{
register_plugin("Waiting""2.0""")

register_event("HLTV""new_round""a""1=0""2=0");
register_logevent("end_round"2"1=Round_End");
register_logevent("round_start"2"1=Round_Start")

set_task(1.0"first_round"___"a"restart_seconds);
}

public 
new_round()
{
if(
g_firstround
{
set_hudmessage(random(255), random(255), random(255), -1.00.1515.15.0)
ShowSyncHudMsg(0CreateHudSyncObj(), "We still wait other players."
return;
}
}




public 
first_round()
{
restart_seconds--
if(
restart_seconds 0)
g_firstround true
else
{
server_cmd("sv_restart 1");
set_task(2.5"restart_again_sorry");
g_firstround false
return;
}
set_hudmessage(852551700.00.1911.11.0)
show_hudmessage(0"We still wait other players.^n%d secund%s ramas%s."restart_secondsrestart_seconds "a" "e"restart_seconds "a" "e")
}

public 
restart_again_sorry()
{
server_cmd("sv_restart 1");
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1033{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by ColaSola; 04-30-2016 at 10:21.
ColaSola is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-30-2016 , 11:21   Re: Waiting for other players [Plugin]
Reply With Quote #2

It should work like this :
After first round is triggered, you wont be able to move 15 seconds and you will se a hudmessage "We still wait other players.", after that round will restart and players will be able to move.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new const Float:TIME 15.0

new bool:g_firstround;
new 
bool:g_canMove;
new 
g_syncmsg;

public 
plugin_init()
{
register_plugin("Waiting For Players""1.0""Alliedmods")

register_event("HLTV""new_round""a""1=0""2=0");
RegisterHamHam_Spawn"player""Player_Freeze"); 
g_syncmsg CreateHudSyncObj();
}

public 
new_round()
{
if(!
g_firstround
{
set_task(TIME"Restart_Round")
set_hudmessage(random(255), random(255), random(255), -1.00.1515.1TIME)
ShowSyncHudMsg(0g_syncmsg"We still wait other players.")
g_firstround true
}
}

public 
Player_Freeze(id){

 if(
is_user_alive(id) && !g_canMove)
 {
    new 
iFlags pev(idpev_flags
    if( ~
iFlags FL_FROZEN 
    { 
     
set_pev(idpev_flagsiFlags FL_FROZEN
    } 
 }
}

public 
Restart_Round(){
  
g_canMove true;
  
server_cmd("sv_restartround 1"

siriusmd99 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-30-2016 , 12:12   Re: Waiting for other players [Plugin]
Reply With Quote #3

You said me in PM to make it with dhudmessage insead of synchudmsg, here we go :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <dhudmessage>
#include <hamsandwich>

new const Float:TIME 15.0

new bool:g_firstround;
new 
bool:g_canMove;

public 
plugin_init()
{
register_plugin("Waiting For Players""1.0""Alliedmods")

register_event("HLTV""new_round""a""1=0""2=0");
RegisterHamHam_Spawn"player""Player_Freeze"); 
}

public 
new_round()
{
if(!
g_firstround
{
set_task(TIME"Restart_Round")
set_dhudmessage(random(255), random(255), random(255), -1.00.1515.1TIME)
show_dhudmessage(0"We still wait other players.")
g_firstround true
}
}

public 
Player_Freeze(id){

 if(
is_user_alive(id) && !g_canMove)
 {
    new 
iFlags pev(idpev_flags
    if( ~
iFlags FL_FROZEN 
    { 
     
set_pev(idpev_flagsiFlags FL_FROZEN
    } 
 }
}

public 
Restart_Round(){
  
g_canMove true;
  
server_cmd("sv_restartround 1"

siriusmd99 is offline
ColaSola
Junior Member
Join Date: Apr 2016
Old 04-30-2016 , 12:50   Re: Waiting for other players [Plugin]
Reply With Quote #4

Thanks a lot!
ColaSola is offline
ColaSola
Junior Member
Join Date: Apr 2016
Old 05-01-2016 , 16:01   Re: Waiting for other players [Plugin]
Reply With Quote #5

Oh i forget something how can i add in this message a timer like "We still wait other players 15s/14s/13s"
ColaSola is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-02-2016 , 07:16   Re: Waiting for other players [Plugin]
Reply With Quote #6

OK, you want the same colour message will be every second ?

For example I generate random colour just one time and after I set the same colour for every second to show timer or every second different colours?
siriusmd99 is offline
ColaSola
Junior Member
Join Date: Apr 2016
Old 05-02-2016 , 09:59   Re: Waiting for other players [Plugin]
Reply With Quote #7

the color like how is in the dhud.
PHP Code:
set_dhudmessage(random(255), random(255), random(255), -1.00.1515.1TIME
ColaSola is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-02-2016 , 12:04   Re: Waiting for other players [Plugin]
Reply With Quote #8

Try :
I made also a cvar to set time , amx_waiting_time , you can set it from amxx.cfg to what value do you want.
Also , blocked the message "Game will restart in...", because it will be printed onto the hud message and it will look bad.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <dhudmessage>
#include <hamsandwich>

new g_time;
new 
bool:g_firstround;
new 
bool:g_canMove;
new 
g_counter;

public 
plugin_init()
{
register_plugin("Waiting For Players""1.0""Alliedmods")
g_time register_cvar("amx_waiting_time""15")
register_message(get_user_msgid("TextMsg"), "hook_TextMsg")
register_event("HLTV""new_round""a""1=0""2=0");
RegisterHamHam_Spawn"player""Player_Freeze"); 
}

public 
new_round()
{
if(!
g_firstround
{
g_counter get_pcvar_num(g_time)
new 
colours[3];
for(new 
isizeof(colours); i++)
  
colours[i] = random(255);
  
set_dhudmessage(colours[0], colours[1], colours[2], -1.00.1515.10.9)
show_dhudmessage(0"We are still waiting other players... ( %d seconds )"g_counter)
set_task(1.0"Restart_Round"_colours3,"a"g_counter)
g_counter--;
g_firstround true
}
}

public 
hook_TextMsg(msgidmsgdestmsgargs) {
    new 
message[32]
    
get_msg_arg_string(2message31
    
    if (!
g_canMove && equal(message"#Game_will_restart_in"))
        return 
PLUGIN_HANDLED 
    
    
return PLUGIN_CONTINUE 
}

public 
Player_Freeze(id){

 if(
is_user_alive(id) && !g_canMove)
 {
    new 
iFlags pev(idpev_flags
    if( ~
iFlags FL_FROZEN 
    { 
     
set_pev(idpev_flagsiFlags FL_FROZEN
    } 
 }
}

public 
Restart_Round(arg[]){
  if(
g_counter == 1)
  {
  
server_cmd("sv_restartround 1"); 
  }
  else
  {
  if(
g_counter == 0){
  
g_canMove true;
  return;
  }
  }
  
  
set_dhudmessage(arg[0], arg[1], arg[2], -1.00.1515.10.9)
  
show_dhudmessage(0"We are still waiting other players... ( %d seconds )"g_counter)
  
g_counter--;


Last edited by siriusmd99; 05-02-2016 at 12:06.
siriusmd99 is offline
ColaSola
Junior Member
Join Date: Apr 2016
Old 05-02-2016 , 15:16   Re: Waiting for other players [Plugin]
Reply With Quote #9

Perfectly working thanks!
ColaSola 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 00:15.


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