AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Takedamage help (https://forums.alliedmods.net/showthread.php?t=164318)

neutron 08-10-2011 04:40

[HELP] Takedamage help
 
terrorist > counter terrorist in hits

PHP Code:

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN    "qwewqeweewq"
#define AUTHOR    "neutron"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage,"player","warn",1)
}

public 
warn(id)
{
    
client_print(0,print_chat,"testttt")


it is in everyone,
I want to have to hit the terrorist ct
sorry bad english:cry::cry:

Hunter-Digital 08-10-2011 04:47

Re: [HELP] Takedamage help
 
You must check the team of both attacker and victim by using cs_get_user_team()... see cstrike.inc for values and stuff.

Also, you don't have all params placed into the function, see ham_const.inc.

And note, attacker may be a non-player entity aswell, you need to check if is a player, easiest way is to is_user_connected() on attacker.

neutron 08-10-2011 04:55

Re: [HELP] Takedamage help
 
editttttttttttttttt

hornet 08-10-2011 05:27

Re: [HELP] Takedamage help
 
Explain what your trying to do?

Doc-Holiday 08-10-2011 05:31

Re: [HELP] Takedamage help
 
That is the correct call back

PHP Code:

public fwdPlayerHurt(iVictimiInflictoriAttackerFloat:flDamageiDmgbits 

get_user_team should be cs_get_user_team

hornet 08-10-2011 05:45

Re: [HELP] Takedamage help
 
Quote:

Originally Posted by Doc-Holiday (Post 1529432)
get_user_team should be cs_get_user_team

Not necessarily, either way will work. It depends if he intends on using the CStrike module for anything else, because if he removes the module, he can still check for get_user_team( id ) == 2 or he can just define the team constants himself.

abdul-rehman 08-10-2011 05:55

Re: [HELP] Takedamage help
 
get_user_team returns false results some time, to stay on the safe side, use cs_get_user_team or FM to retrieve player's team

hornet 08-10-2011 05:57

Re: [HELP] Takedamage help
 
Oh really? Didn't know that, hasn't happened to me yet :p
In that case stick with the Doc ;)

Doc-Holiday 08-10-2011 06:26

Re: [HELP] Takedamage help
 
Not only that he uses CS_TEAM_CT so hes already using cstrike.

avril-lavigne 08-10-2011 06:26

Re: [HELP] Takedamage help
 
PHP Code:

public fw_HamTakeDamagePostvictim iInflictor iAttacker Float:dmg DmgBits )
{    

    
client_print(victimprint_chat,  " ______DAMAGE %d",floatround(dmg)) 





All times are GMT -4. The time now is 03:20.

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