Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2013-01-25 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
January 24, 2013, 07:06:09 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to stop a player from rescuing hostages  (Read 87 times)
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« on: December 01, 2012, 11:54:41 PM »

So I want to restrict a couple of races so that when they are invincible they can't plant/defuse or rescue.

Lucky's code to stop someone from defusing doesn't seem to work

Code:
public bomb_begindefuse(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(bClientInDuel[client])
{
new Float:velocity[3];
velocity[2]=200.0;
SetEntDataVector(client,m_vecBaseVelocity,velocity,true);
PrintHintText(client, "You can not defuse while in a duel");
}
}


So I'm not really sure how to go about stopping someone from planting/defusing, nor from rescuing hosties ... help ?
« Last Edit: December 02, 2012, 12:19:08 AM by Remy Lebeau » Logged
Remy Lebeau
Full Member
***
Posts: 172


View Profile
« Reply #1 on: December 02, 2012, 12:21:04 AM »

Ok - so I can probably use this stop stop the planting/defusing:

http://forums.alliedmods.net/showthread.php?t=96444  I should be able to check for bomb plant/defuse, and then just slap the player, which should stop them :-)



EDIT:  So this code doesn't seem to work:

Code:
public OnPluginStart()
{
HookEvent( "bomb_beginplant", Event_BeginPlant, EventHookMode_Pre );

}


public Action:Event_BeginPlant( Handle:event, const String:name[], bool:dontBroadcast )
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(bClientInDuel[client])
{

PrintHintText(client, "You can not plant the bomb while in a duel");
return Plugin_Handled;
}
return Plugin_Continue;
}

My understanding is that this should effectively stop the bomb planting ?  Any insight into why it wouldn't work ?
« Last Edit: December 02, 2012, 12:48:26 AM by Remy Lebeau » Logged
Revan
Sr. Member
****
Posts: 346



View Profile
« Reply #2 on: December 02, 2012, 06:00:59 AM »

return Plugin_Handled/Plugin_Stop doesn't work on some events.

A probably more clean way to prevent bomb defuse is to play around with the progress bar netprop.
Just use the War3Source native for that.
War3_Progressbar(client,iDuration);

Code:
public Action:Event_BeginPlant( Handle:event, const String:name[], bool:dontBroadcast )
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(bClientInDuel[client])
{
PrintHintText(client, "You can not plant the bomb while in a duel");
//max amount of iDuration is 15 seconds(CS:S/CS:GO limit). so you need to
//create a timer and re-apply it.
War3_Progressbar(client,15);
}
return Plugin_Continue;
}
or try playing around with this:
Code:
SetEntPropFloat(bombent, Prop_Send, "m_flDefuseCountDown", 3.0);

If you wan't to stop bomb planting I think it's the best to do something like this(untested):
Code:
stock W3DenyBombPlant(client, bool:shouldDeny)
{
if(shouldDeny)
SDKHook(client, SDKHook_ThinkPost, OnThinkPost);
else
SDKUnhook(client, SDKHook_ThinkPost, OnThinkPost);
}


public OnThinkPost(entity)
{
SetEntProp(entity,Prop_Send,"m_bInBombZone",false);
}

Stop hostage rescue is easy:
Code:
new g_LeaderOffset = -1;
public OnPluginStart()
{
g_LeaderOffset = FindSendPropOffs("CHostage", "m_leader");
if(g_LeaderOffset == -1)
{
SetFailState("Failed to lookup CHostage::m_leader offset");
}
HookEvent("hostage_follows", OnHostageFollows, EventHookMode_Pre);
}

public Action:OnHostageFollows(Handle:event, const String:name[], bool:dontBroadcast)
{
new hostage = GetEventInt("hostage");
SetEntDataEnt2(hostage, g_LeaderOffset, 0);
return Plugin_Handled;
}
Logged

#war3source
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!