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

[Req] Specified hostage events


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Somegod
Member
Join Date: Dec 2009
Location: New York
Old 12-15-2012 , 12:16   [Req] Specified hostage events
Reply With Quote #1

I need a plugin that if a certain hostage gets killed, the person who kills that hostage would receive 1000$, and display a chat message to all.
Somegod is offline
Somegod
Member
Join Date: Dec 2009
Location: New York
Old 12-15-2012 , 13:56   Re: [Req] Specified hostage events
Reply With Quote #2

Nope nobody can do it?
Somegod is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 12-16-2012 , 01:00   Re: [Req] Specified hostage events
Reply With Quote #3

This is a rather strange request, and honestly it is rather simple. Took about 4 an a half minutes to do it, and this code is untested. Although, it should work. When you try it, let me know if it works / glitches in any way. Have fun!
PHP Code:
#include <sourcemod>

new g_iAccount = -1;

public 
Plugin:myinfo 
{
    
name "Paid Hostage Kill",
    
author "Marcus",
    
description "A simple plugin to get money when a hostage is killed",
    
version "0.0.1",
    
url "http://www.snbx.info"
};

public 
OnPluginStart()
{
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");

    
HookEvent("hostage_killed"Hostage_Killed);
}

public 
Action:Hostage_Killed(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
GetClientOfUserId(GetEventInt(event"attacker"));
    if (
ClientIsAlive(i) && ClientIsInGame(i))
    {
        new 
iNewMoney GetEntData(ig_iAccount) + 1000;
        
SetEntData(ig_iAccount, (iNewMoney 16000) ? 16000 iNewMoney4true); // Thanks to Mitchell for this code.
    
}

Marcus_Brown001 is offline
Somegod
Member
Join Date: Dec 2009
Location: New York
Old 12-17-2012 , 11:54   Re: [Req] Specified hostage events
Reply With Quote #4

Thanks mate, will test now
Somegod is offline
Somegod
Member
Join Date: Dec 2009
Location: New York
Old 12-17-2012 , 12:00   Re: [Req] Specified hostage events
Reply With Quote #5

Quote:
Originally Posted by Marcus_Brown001 View Post
This is a rather strange request, and honestly it is rather simple. Took about 4 an a half minutes to do it, and this code is untested. Although, it should work. When you try it, let me know if it works / glitches in any way. Have fun!
PHP Code:
#include <sourcemod>

new g_iAccount = -1;

public 
Plugin:myinfo 
{
    
name "Paid Hostage Kill",
    
author "Marcus",
    
description "A simple plugin to get money when a hostage is killed",
    
version "0.0.1",
    
url "http://www.snbx.info"
};

public 
OnPluginStart()
{
    
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount");

    
HookEvent("hostage_killed"Hostage_Killed);
}

public 
Action:Hostage_Killed(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
GetClientOfUserId(GetEventInt(event"attacker"));
    if (
ClientIsAlive(i) && ClientIsInGame(i))
    {
        new 
iNewMoney GetEntData(ig_iAccount) + 1000;
        
SetEntData(ig_iAccount, (iNewMoney 16000) ? 16000 iNewMoney4true); // Thanks to Mitchell for this code.
    
}

I changed a line because it gave compile errors. Also it does not select the certain hostage. but non the less thank you!

Code:
#include <sourcemod>

new g_iAccount = -1;

public Plugin:myinfo = 
{
    name = "Paid Hostage Kill",
    author = "Marcus",
    description = "A simple plugin to get money when a hostage is killed",
    version = "0.0.1",
    url = "http://www.snbx.info"
};

public OnPluginStart()
{
    g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");

    HookEvent("hostage_killed", Hostage_Killed);
}

public Action:Hostage_Killed(Handle:event, const String:name[], bool:dontBroadcast)
{
    new i = GetClientOfUserId(GetEventInt(event, "attacker"));
    if (!IsPlayerAlive(i) && !IsClientInGame(i))
    {
        new iNewMoney = GetEntData(i, g_iAccount) + 1000;
        SetEntData(i, g_iAccount, (iNewMoney > 16000) ? 16000 : iNewMoney, 4, true); // Thanks to Mitchell for this code.
    }
}
Somegod is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 12-17-2012 , 16:32   Re: [Req] Specified hostage events
Reply With Quote #6

Yeah, that was my bad. Forgot I was making it for when a hostage died, so I had the wrong if statements xD
Marcus_Brown001 is offline
Somegod
Member
Join Date: Dec 2009
Location: New York
Old 12-17-2012 , 16:54   Re: [Req] Specified hostage events
Reply With Quote #7

None the less it works fine. In the temporary basis, Im using it ;D
Somegod is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-17-2012 , 20:37   Re: [Req] Specified hostage events
Reply With Quote #8

marcus on your if statements you ahould check id the client is in game first then check if he is alive
Mitchell is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 12-17-2012 , 21:00   Re: [Req] Specified hostage events
Reply With Quote #9

Yeah, I realize that now, threw it together rather quick
Marcus_Brown001 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 16:24.


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