Raised This Month: $ Target: $400
 0% 

[ANY] Map Zones (with forwards)


Post New Thread Reply   
 
Thread Tools Display Modes
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-08-2014 , 13:09   Re: [ANY] Map Zones (with forwards)
Reply With Quote #41

Code:
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) {     static Handle:mp_friendlyfire = INVALID_HANDLE     if (!mp_friendlyfire) mp_friendlyfire = FindConVar("mp_friendlyfire")     ServerCommand("sm_diactzone myzone")     CreateTimer(28.0+GetConVarFloat(mp_friendlyfire), Timer_ActivateZone, _, TIMER_FLAG_NO_MAPCHANGE) }
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
lordoflort
Member
Join Date: Dec 2010
Old 02-08-2014 , 13:19   Re: [ANY] Map Zones (with forwards)
Reply With Quote #42

Quote:
Originally Posted by Root_ View Post
Code:
public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) {     static Handle:mp_friendlyfire = INVALID_HANDLE     if (!mp_friendlyfire) mp_friendlyfire = FindConVar("mp_friendlyfire")     ServerCommand("sm_diactzone myzone")     CreateTimer(28.0+GetConVarFloat(mp_friendlyfire), Timer_ActivateZone, _, TIMER_FLAG_NO_MAPCHANGE) }
How would that look with mp_freezetime?
__________________
lordoflort is offline
lordoflort
Member
Join Date: Dec 2010
Old 02-08-2014 , 13:50   Re: [ANY] Map Zones (with forwards)
Reply With Quote #43

PHP Code:
new Handle:FreezeTime

public OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart)
    
HookEvent("round_end"OnRoundEnd)
    
FreezeTime FindConVar("mp_freezetime")
}

public 
OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ServerCommand("sm_diactzone noobct")
    
CreateTimer(40.0+GetConVarFloat(FreezeTime), Timer_ActivateZone_TIMER_FLAG_NO_MAPCHANGE)
}

public 
Action:Timer_ActivateZone(Handle:timer)
{
    
ServerCommand("sm_actzone noobct")
}

public 
OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
CloseHandle(Timer_ActivateZone);


I get tag mismatch when trying to compile this, on line 23 (CloseHandle)
__________________
lordoflort is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-08-2014 , 14:30   Re: [ANY] Map Zones (with forwards)
Reply With Quote #44

You should assign timer handle as global. So
Code:
new Handle:MyTimer, Handle:FreezeTime public OnPluginStart() {     HookEvent("round_start", OnRoundStart)     HookEvent("round_end", OnRoundEnd)     FreezeTime = FindConVar("mp_freezetime") } public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast) {     ServerCommand("sm_diactzone noobct")     MyTimer = CreateTimer(40.0+GetConVarFloat(FreezeTime), Timer_ActivateZone, _, TIMER_FLAG_NO_MAPCHANGE) } public Action:Timer_ActivateZone(Handle:timer) {     ServerCommand("sm_actzone noobct") } public OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) {     if (MyTimer != INVALID_HANDLE)     {         CloseHandle(MyTimer);         MyTimer = INVALID_HANDLE     } }
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
lordoflort
Member
Join Date: Dec 2010
Old 02-08-2014 , 14:47   Re: [ANY] Map Zones (with forwards)
Reply With Quote #45

Thank you so much!

- Now for a question about your plugin:

Is it possible to set either the no shooting or melee only punishment to allow weapon equip?
As of now I cannot pick up a bomb or buy gear if I'm in such a zone.
__________________
lordoflort is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-08-2014 , 14:54   Re: [ANY] Map Zones (with forwards)
Reply With Quote #46

Well noshoot punishment might not work in this case. Because if you re-equip a weapon, cooldown will be removed.
However you can re-download a plugin and set punishment to 'custom' as well as use this plugin.
Code:
public Action:OnEnteredProtectedZone(client, const String:name[], const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         if (StrEqual(name, "myzone", false) && GetConVarBool(ShowZones))         {             PrintToChat(client, "%sYou have entered \"%s\" zone.", prefix, name);                         SDKHook(client, SDKHook_PreThink, OnPreThink);         }     } } public Action:OnLeftProtectedZone(client, const String:name[], const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         // It's also called whenever player dies within a zone, so dont show a message if player died there         if (StrEqual(name, "myzone", false) && GetConVarBool(ShowZones) && IsPlayerAlive(client))         {             PrintToChat(client, "%sYou have left \"%s\" zone.", prefix, name);                         SDKUnhook(client, SDKHook_PreThink, OnPreThink);         }     } } public OnPreThink(client) {     SetEntPropFloat(client, Prop_Send, "m_flNextAttack", GetGameTime() + 1.0); }
It is really requires latest version of zones plugin. Nothing was changed, but added zones name into forward.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
lordoflort
Member
Join Date: Dec 2010
Old 02-08-2014 , 15:04   Re: [ANY] Map Zones (with forwards)
Reply With Quote #47

So, if I compile what you wrote, and set to custom, it should work?
__________________
lordoflort is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-08-2014 , 15:09   Re: [ANY] Map Zones (with forwards)
Reply With Quote #48

I assume it will work, however I've not tested it. Only way to know is compiling and testing.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
lordoflort
Member
Join Date: Dec 2010
Old 02-08-2014 , 15:11   Re: [ANY] Map Zones (with forwards)
Reply With Quote #49

plugin name should be custom, when I compile?
__________________
lordoflort is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-08-2014 , 15:15   Re: [ANY] Map Zones (with forwards)
Reply With Quote #50

Yea, to detect what exactly zone was used, you should enter its name.
Code:
if (StrEqual(name, "myzone", false)
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ 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 13:14.


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