Raised This Month: $32 Target: $400
 8% 

x2 First Blood


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
delayedCoder
Junior Member
Join Date: Jul 2011
Location: under binary
Old 07-24-2011 , 02:34   x2 First Blood
Reply With Quote #1

x2 First Blood
Version: 0.3
Author: delayedCoder



Description:

When first blood is drawn, the attacker gets double the kill points instead of one.



Requirements:
- AMX Mod X 1.8.0 or above
- Ham Sandwich Module enabled



Changelog:
Version 0.1:
- initial release

Version 0.2:
- cleaned up code
- removed 'fun' module by using hamsandwich

Version 0.3:
- added a check to ensure that there is no loopholes
- added team check
- added suicide check
Attached Files
File Type: sma Get Plugin or Get Source (v03_2xFB.sma - 676 views - 608 Bytes)

Last edited by delayedCoder; 07-26-2011 at 21:50. Reason: Updated version
delayedCoder is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-24-2011 , 04:52   Re: x2 First Blood
Reply With Quote #2

- You can easily avoid of using the hamsandwich module here.
- You can remove <amxmisc> , it isn't needed.
- You should have some checks, like that the attacker can be a Non-Player entity.

Would look like this:

PHP Code:
#include <amxmodx>
#include <fun>

#define VERSION    "0.1"

new bool:firstBlood true;

new 
g_iMaxPlayers;
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin("x2 First Blood"VERSION"delayedCoder");
    
    
register_event("DeathMsg","hook_death","a");
    
register_event("HLTV""newRound""a""1=0""2=0");
    
    
g_iMaxPlayers get_maxplayers()
}

public 
hook_death()
{
    if (
firstBlood)
    {
        new 
attacker read_data(1);
        
        if(
IsPlayer(attacker) && is_user_connected(attacker))
        {
            
set_user_frags(attackerget_user_frags(attacker) + 2);
        
            
firstBlood false;
        }
    }
}

public 
newRound()
{
    
firstBlood true;

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 06:37   Re: x2 First Blood
Reply With Quote #3

Quote:
Originally Posted by bibu View Post
- You can easily avoid of using the hamsandwich module here.
What's wrong with ham ?
DeathMsg can be altered or faked by other plugins (jb for example).
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 06:50   Re: x2 First Blood
Reply With Quote #4

Quote:
Originally Posted by bibu View Post
PHP Code:
set_user_frags(attackerget_user_frags(attacker) + 2); 
The game Counter-Strike already add 1 frag when killing an enemy. If you add 2 frags, they will win 3 frags. I'm wrong ?
Honors is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-24-2011 , 07:21   Re: x2 First Blood
Reply With Quote #5

Quote:
Originally Posted by Honors View Post
The game Counter-Strike already add 1 frag when killing an enemy. If you add 2 frags, they will win 3 frags. I'm wrong ?
Yes wanted to point that out too, forgot it.

To drekes:

I don't have anything against ham, just in this case it isn't needed IMO. And what do you mean with altering and faking DeathMsg?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 08:12   Re: x2 First Blood
Reply With Quote #6

Quote:
Originally Posted by bibu View Post
Yes wanted to point that out too, forgot it.

To drekes:

I don't have anything against ham, just in this case it isn't needed IMO. And what do you mean with altering and faking DeathMsg?
I think ham is more reliable in this case.

From messages.inc:

Code:
/* These are the same as above, except that the messages sent
 *  are also sent to all other plugins and Metamod plugins.
 * This means that if you send one of these messages, other plugins will
 *  be notified, which was previously impossible.  
 * BE CAREFUL! Using these incorrectly, or not for their intended purpose,
 *  could cause infinite recursion or something just as bad. 
 * NOTE! These natives are experimental.
 */
native emessage_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
native emessage_end();
native ewrite_byte(x);
native ewrite_char(x);
native ewrite_short(x);
native ewrite_long(x);
native ewrite_entity(x);
native ewrite_angle(x);
native ewrite_coord(x);
native ewrite_string(const x[]);
If a plugin send a msg with these, this plugin will also be triggered & give frags when it isn't necessary (depending on the code)

Also in lots of Jailbreak plugins, DeathMsg is registered using register_message() & the attacker id is changed to 0 to hide the terrorist's kills. This also may be a problem.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
bibu
Veteran Member
Join Date: Sep 2010
Old 07-24-2011 , 08:24   Re: x2 First Blood
Reply With Quote #7

Who cares about JB?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Shadymn
Senior Member
Join Date: Sep 2010
Old 07-24-2011 , 10:33   Re: x2 First Blood
Reply With Quote #8

Quote:
Originally Posted by Honors View Post
The game Counter-Strike already add 1 frag when killing an enemy. If you add 2 frags, they will win 3 frags. I'm wrong ?
eagle eye
Shadymn is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 12:07   Re: x2 First Blood
Reply With Quote #9

Quote:
Originally Posted by bibu View Post
Who cares about JB?
It was just an example. Any plugin / mod can alter or fake it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-24-2011 , 12:21   Re: x2 First Blood
Reply With Quote #10

If ham is enabled, you can use Ham_AddPoint instead of get_user_frags + set_user_frags.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 21:10.


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