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

Solved What is wrong with this script?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xjonx
Member
Join Date: Nov 2016
Location: Builders League UnitedHQ
Old 11-16-2016 , 21:25   What is wrong with this script?
Reply With Quote #1

This is supposed to restart the round when no one is on red team anymore.
Do I need GetClientOfUserId?
All it seems to do is display a message on the bottom center of the screen saying "round end".
(credit obviously given, i'm only good at editing plugins rather than creating as I am still learning)

Script
__________________
I'm sometimes slow at responding... just be patient.
My favorite quote: "...for I believe in an eye for an eye."
My Website: http://jon-xjonx-nat.jimdo.com/

Last edited by xjonx; 11-18-2016 at 13:06. Reason: Solved
xjonx is offline
Send a message via Skype™ to xjonx
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 11-16-2016 , 21:53   Re: What is wrong with this script?
Reply With Quote #2

Like this?
Spoiler
__________________
xines is offline
xjonx
Member
Join Date: Nov 2016
Location: Builders League UnitedHQ
Old 11-17-2016 , 13:26   Re: What is wrong with this script?
Reply With Quote #3

Quote:
Originally Posted by xines View Post
Like this?
Spoiler
Didn't work exactly as I wanted to, it just makes the announcer say "1" and restart the round without ending first, so most of the other plugin I'm using don't register, as most of them work at Round Start. What I would like is how to force the round to end, then restart the round where the round limit rule still applies. I was thinking of modifying the game_round_win entity with AcceptEntityInput. But I don't how to do that exactly, only basic stuff
__________________
I'm sometimes slow at responding... just be patient.
My favorite quote: "...for I believe in an eye for an eye."
My Website: http://jon-xjonx-nat.jimdo.com/
xjonx is offline
Send a message via Skype™ to xjonx
headline
SourceMod Moderator
Join Date: Mar 2015
Old 11-17-2016 , 15:46   Re: What is wrong with this script?
Reply With Quote #4

This?

Snippet from: DarthNinja. Any time you THINK you have to use ServerCommand, you almost always don't. Add me on steam if you need more help.
Attached Files
File Type: sp Get Plugin or Get Source (something.sp - 186 views - 1.2 KB)
headline is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 11-18-2016 , 04:32   Re: What is wrong with this script?
Reply With Quote #5

Headline, why not just
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <tf2_stocks>

public Plugin myinfo =
{
    
name        "Omniwolf's Auto Restart Zombies",
    
author        "Omniwolf, Snippet from: DarthNinja",
    
description    "Auto Restarts when RED is empty",
    
version        "1.0",
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"Callback_CheckEmptyEventHookMode_PostNoCopy);
    
HookEvent("player_team"Callback_CheckEmptyEventHookMode_PostNoCopy);
}

public 
void Callback_CheckEmpty(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetRoundState() == RoundState_RoundRunning && !GetTeamClientCount(view_as<int>(TFTeam_Red)))
        
CreateTimer(1.0Timer_EndRound);
}

public 
Action Timer_EndRound(Handle timer)
{
    
/* Thanks DarthNinja */
    
int iEnt = -1;
    if ((
iEnt FindEntityByClassname(iEnt"game_round_win")) < 1)
    {
        
iEnt CreateEntityByName("game_round_win");
        if (
IsValidEntity(iEnt)) DispatchSpawn(iEnt);
    }

    
SetVariantInt(0);
    
AcceptEntityInput(iEnt"SetTeam");
    
AcceptEntityInput(iEnt"RoundWin");

?
__________________
Grey83 is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 11-18-2016 , 11:45   Re: What is wrong with this script?
Reply With Quote #6

Quote:
Originally Posted by Grey83 View Post
Headline, why not just
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <tf2_stocks>

public Plugin myinfo =
{
    
name        "Omniwolf's Auto Restart Zombies",
    
author        "Omniwolf, Snippet from: DarthNinja",
    
description    "Auto Restarts when RED is empty",
    
version        "1.0",
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"Callback_CheckEmptyEventHookMode_PostNoCopy);
    
HookEvent("player_team"Callback_CheckEmptyEventHookMode_PostNoCopy);
}

public 
void Callback_CheckEmpty(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetRoundState() == RoundState_RoundRunning && !GetTeamClientCount(view_as<int>(TFTeam_Red)))
        
CreateTimer(1.0Timer_EndRound);
}

public 
Action Timer_EndRound(Handle timer)
{
    
/* Thanks DarthNinja */
    
int iEnt = -1;
    if ((
iEnt FindEntityByClassname(iEnt"game_round_win")) < 1)
    {
        
iEnt CreateEntityByName("game_round_win");
        if (
IsValidEntity(iEnt)) DispatchSpawn(iEnt);
    }

    
SetVariantInt(0);
    
AcceptEntityInput(iEnt"SetTeam");
    
AcceptEntityInput(iEnt"RoundWin");

?
It doesn't matter. If I were to write something myself it'd probably look more like that.
headline is offline
xjonx
Member
Join Date: Nov 2016
Location: Builders League UnitedHQ
Old 11-18-2016 , 12:51   Re: What is wrong with this script?
Reply With Quote #7

Quote:
Originally Posted by Grey83 View Post
Headline, why not just
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <tf2_stocks>

public Plugin myinfo =
{
    
name        "Omniwolf's Auto Restart Zombies",
    
author        "Omniwolf, Snippet from: DarthNinja",
    
description    "Auto Restarts when RED is empty",
    
version        "1.0",
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"Callback_CheckEmptyEventHookMode_PostNoCopy);
    
HookEvent("player_team"Callback_CheckEmptyEventHookMode_PostNoCopy);
}

public 
void Callback_CheckEmpty(Event event, const char[] namebool dontBroadcast)
{
    if (
GameRules_GetRoundState() == RoundState_RoundRunning && !GetTeamClientCount(view_as<int>(TFTeam_Red)))
        
CreateTimer(1.0Timer_EndRound);
}

public 
Action Timer_EndRound(Handle timer)
{
    
/* Thanks DarthNinja */
    
int iEnt = -1;
    if ((
iEnt FindEntityByClassname(iEnt"game_round_win")) < 1)
    {
        
iEnt CreateEntityByName("game_round_win");
        if (
IsValidEntity(iEnt)) DispatchSpawn(iEnt);
    }

    
SetVariantInt(0);
    
AcceptEntityInput(iEnt"SetTeam");
    
AcceptEntityInput(iEnt"RoundWin");

?
You know, I was thinker around the lines of a timer... thanks that works
__________________
I'm sometimes slow at responding... just be patient.
My favorite quote: "...for I believe in an eye for an eye."
My Website: http://jon-xjonx-nat.jimdo.com/
xjonx is offline
Send a message via Skype™ to xjonx
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 04:46.


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