Raised This Month: $ Target: $400
 0% 

[csgo] display a menu at round start


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PresidentEvil
AlliedModders Donor
Join Date: Jun 2012
Old 10-22-2014 , 17:43   [csgo] display a menu at round start
Reply With Quote #1

so here is a plugin a friend made for me, it will force the clients to do a console command at map end(idk why it says roundend), anyways, can someone modify it so it also forces clients to do that command when they join a team

the idea is the sm_top menu is shown when they join the server, and also at map end(when server switches maps and the drops are given), right now it only display to clients at map end

PHP Code:

#include <sdktools>
#include <sourcemod>

public OnPluginStart()
{
    
HookEvent("round_end"RoundEnd);
}
public 
Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
timeleft;
    
GetMapTimeLeft(timeleft);
    if (
timeleft <= 0)
    {
        
UseCMD();
    }
}

UseCMD()
{
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i)) FakeClientCommand(i"sm_top");

__________________

Last edited by PresidentEvil; 10-22-2014 at 17:43.
PresidentEvil is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 10-22-2014 , 19:23   Re: [csgo] display a menu at round start
Reply With Quote #2

PHP Code:

#include <sdktools>
#include <sourcemod>

public OnPluginStart()
{
    
HookEvent("round_end"RoundEnd);
}

public 
OnClientPutInServer(client){
    if(!
IsFakeClient(client)) FakeClientCommand(client"sm_top");
}

public 
Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
timeleft;
    
GetMapTimeLeft(timeleft);
    if (
timeleft <= 0)
    {
        
UseCMD();
    }
}

UseCMD()
{
    for(new 
1<= MaxClientsi++)
        if(
IsClientInGame(i)) FakeClientCommand(i"sm_top");

And the reason it says round_end is because the code checks if it is the last round end. If it were to wait for map_end, then the players would already be loading the new map and therefore not ingame.
thecount is offline
PresidentEvil
AlliedModders Donor
Join Date: Jun 2012
Old 10-23-2014 , 01:19   Re: [csgo] display a menu at round start
Reply With Quote #3

ty
__________________
PresidentEvil is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 10-23-2014 , 07:18   Re: [csgo] display a menu at round start
Reply With Quote #4

Quote:
Originally Posted by PresidentEvil View Post
so here is a plugin a friend made for me
so I'm your friend... (is my plugin) xDD

Quote:
Originally Posted by thecount View Post
And the reason it says round_end is because the code checks if it is the last round end. If it were to wait for map_end, then the players would already be loading the new map and therefore not ingame.
Yeah exactly, instead of OnMapEnd that dont work properly for this plugin
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 10-23-2014 at 07:19.
Franc1sco is offline
Send a message via MSN to Franc1sco
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 03:11.


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