Raised This Month: $ Target: $400
 0% 

I've run out of ideas.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smdobay
Member
Join Date: Feb 2005
Old 04-23-2005 , 14:10   I've run out of ideas.
Reply With Quote #1

Okay, I'm writing a hostile intent ff plugin involving event_damage.

I use
Code:
new  attacker = get_user_attacker(id)
where id is the victim and then get_user_team to check for ff, but for some reason it never returns that two people are on the same team. The numbers seem almost random.

Here's the code: [Edit]Updated Code[/Edit]

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> //new g_iServerHits = 0 new can_tk[33] public plugin_init() {     register_plugin("StopFire","0.7","i r winnar|XeroBlood")     register_event("Damage", "event_damage","b","2!0" )     register_event("DeathMsg", "event_death","b","2!0" )     register_clcmd("amx_setff","settk",ADMIN_KICK," <target> <1 = Enable FF|0 = Disable FF>")     //register_clcmd("tellhp","tellhp") } public client_authorized(id){     can_tk[id] = 1 } public tellhp(id){     new tStr[101]     format(tStr,100,"Your HP is %d",get_user_health(id))     client_print(id,print_console,tStr)     return PLUGIN_HANDLED } public settk(id,level,cid){     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,1)     if (!is_user_connected(player)) return PLUGIN_HANDLED     new szSwitch[4]     read_argv(2, szSwitch, 4)     new iSwitch = str_to_num(szSwitch)     can_tk[player] = clamp( iSwitch, 0, 1 ) // Min=0   Max=1     new tName[51]     get_user_name(player,tName,50)     new tStr[101]     if( iSwitch == 1 )         format(tStr,100,"FF Enabled on %s",tName)     else         format(tStr,100,"FF Disabled on %s",tName)     client_print(id,print_console,tStr)     return PLUGIN_HANDLED } public event_damage(id){     if( !is_user_connected( id ) )         return PLUGIN_CONTINUE     new attacker = get_user_attacker(id)     if( !is_user_connected( attacker ) )         return PLUGIN_CONTINUE     if (team(id) == team(attacker) && can_tk[attacker] == 0){         set_user_health(id,100)     }     //g_iServerHits++     return PLUGIN_CONTINUE } public event_death(){     new killer = read_data(1)     new victim = read_data(2)         new tSt[101]     format(tSt,100,"Attacker team:%d",team(killer))     client_print(victim,print_chat,tSt)     format(tSt,100,"Your team: %d",team(victim))     client_print(victim,print_chat,tSt)         return PLUGIN_HANDLED } public team(tID){     new tTeam = entity_get_int(tID,EV_INT_team)     return tTeam }
smdobay is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2005 , 22:16  
Reply With Quote #2

Try this (I didn't test it, let me know if it don't work):
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> new g_iServerHits = 0 new can_tk[33] public plugin_init() {     register_plugin("StopFire","0.7","i r winnar")     register_event("Damage", "event_damage","b","2!0" )     register_clcmd("amx_setff","settk",ADMIN_KICK," <target> <1 = Enable FF|0 = Disable FF>")     register_clcmd("tellhp","tellhp") } public client_authorized(id){     can_tk[id] = 1 } public tellhp(id){     new tStr[101]     format(tStr,100,"Your HP is %d",get_user_health(id))     client_print(id,print_console,tStr)     return PLUGIN_HANDLED } public settk(id,level,cid){ //Grant Points     if (!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,1)     if (!is_user_connected(player)) return PLUGIN_HANDLED     new szSwitch[4]     read_argv(2, szSwitch, 4)     new iSwitch = str_to_num(szSwitch)     can_tk[player] = clamp( iSwitch, 0, 1 ) // Min=0   Max=1     new tName[51]     get_user_name(player,tName,50)     new tStr[101]     if( iSwitch == 1 )         format(tStr,100,"FF Enabled on %s",tName)     else         format(tStr,100,"FF Disabled on %s",tName)     client_print(id,print_console,tStr)     return PLUGIN_HANDLED } public event_damage(id){     if( !is_user_connected( id ) )         return PLUGIN_CONTINUE     new attacker = get_user_attacker(id)     if( !is_user_connected( attacker ) )         return PLUGIN_CONTINUE     if (get_user_team(id) == get_user_team(attacker) && !can_tk[attacker]){         set_user_health(id,get_user_health(id))     }     g_iServerHits++     return PLUGIN_CONTINUE }
xeroblood is offline
Send a message via MSN to xeroblood
smdobay
Member
Join Date: Feb 2005
Old 04-23-2005 , 22:38  
Reply With Quote #3

It doesn't work.

I looked over your code and it seems sound. I'm thinking that it is probably not returning the correct teams.
smdobay is offline
smdobay
Member
Join Date: Feb 2005
Old 04-23-2005 , 23:13  
Reply With Quote #4

Figured out what's wrong. get_user_team in hostile intent returns shots fired, not team.

Anyone know the HI function for team?
smdobay is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-24-2005 , 02:19  
Reply With Quote #5

Try using Engine to fetch EV_INT_team
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
smdobay
Member
Join Date: Feb 2005
Old 04-24-2005 , 14:18  
Reply With Quote #6

hah, good idea
smdobay is offline
smdobay
Member
Join Date: Feb 2005
Old 04-24-2005 , 14:53  
Reply With Quote #7

Avalanche, you da man.
Did I say you were good?
You're amazing.
Works perfectly; Many thanks
smdobay 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 09:57.


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