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

Help Function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 02-03-2012 , 08:45   Help Function
Reply With Quote #1

This function is made by atomen plugin.
And i wanted to add part of clients deaths, to lose points with "deaths" and "deaths headshot" .

PHP Code:
public fwd_Client_Killed()
{
 if(
is_ps_on())
 {
  new 
attacker get_msg_arg_int(1);
  new 
victim get_msg_arg_int(2);
 
  
gb_user_alive[victim] = false;
 
  if(
gb_user_connected[attacker] && get_pcvar_num(ps_frags_on))
  {
   
// No need for 'CsTeams:', Custom Stocks
   
new FmTeams:team_1 fm_get_user_team(attacker);
   new 
FmTeams:team_2 fm_get_user_team(victim);
 
   if(
team_1 != team_2)
   {
    static 
weapon[MAX_LENGTH 1];
    
get_msg_arg_string(4weaponMAX_LENGTH);
 
    
ucfirst(weapon);
 
    if(
fm_get_user_vip(victim) && get_pcvar_num(ps_asa))
    {
     new 
status get_pcvar_num(ps_asa);
     
update_points(attackerstatus_1);
 
     
point_print(attacker"%L"attacker"POINT_RECEIVED""VIP Kill : "status);
    }
 
    else if(
equali(weapon"grenade") && get_pcvar_num(frag_kl[CSW_HEGRENADE]))
    {
     new 
status_1 get_pcvar_num(frag_kl[CSW_HEGRENADE]);
     new 
status_2 get_pcvar_num(frag_hs[CSW_HEGRENADE]);
 
     new 
headshot get_msg_arg_int(3);
 
     if(!
headshotadd(weaponMAX_LENGTH"-Kill : ");
     else 
add(weaponMAX_LENGTH"-HS : ");
 
     
update_points(attackerheadshot status_2 status_1_1);
     
point_print(attacker"%L"attacker"POINT_RECEIVED"weaponheadshot status_2 status_1);
    }
 
    else if(
equali(weapon"vehicle") || equali(weapon"tank") && get_pcvar_num(ps_vehicle_points))
    {
     new 
status_1 get_pcvar_num(ps_vehicle_points);
     new 
status_2 get_pcvar_num(ps_vehicle_hs);
 
     new 
headshot get_msg_arg_int(3);
 
     if(!
headshotadd(weaponMAX_LENGTH"-Kill : ");
     else 
add(weaponMAX_LENGTH"-HS : ");
 
     
update_points(attackerheadshot status_2 status_1_1);
     
point_print(attacker"%L"attacker"POINT_RECEIVED"weaponheadshot status_2 status_1);
    }
 
    else
    {
     new 
csw_wpn get_user_weapon(attacker);
 
     new 
status_1 get_pcvar_num(frag_hs[csw_wpn]);
     new 
status_2 get_pcvar_num(frag_kl[csw_wpn]);
 
     if(
status_2)
     {
      new 
headshot get_msg_arg_int(3);
 
      if(
status_1 && headshot)
      {
       
add(weaponMAX_LENGTH"-HS : ");
 
       
update_points(attackerstatus_1_1);
       
point_print(attacker"%L"attacker"POINT_RECEIVED"weaponstatus_1);
      }
 
      else if(
status_2)
      {
       
add(weaponMAX_LENGTH"-Kill : ");
 
       
update_points(attackerstatus_2_1);
       
point_print(attacker"%L"attacker"POINT_RECEIVED"weaponstatus_2);
            }
        }
     } 
 }
 
   else if(
get_pcvar_num(ps_tk) && attacker != victim)
   {
    new 
status get_pcvar_num(ps_tk_points);
 
    
point_print(attacker"%L"attacker"POINT_SUBTRACT"status);
    
update_points(attackerstatus01);
        }
     }
   }
}
 return 
0;


I added this, but don't work:
Can anyone help please ?

PHP Code:
 else if(team_2)
   {
    new 
headshot get_msg_arg_int(3);
 
    new 
status_1 get_pcvar_num(ps_death_hs);
    new 
status_2 get_pcvar_num(ps_death);
 
    if(
status_1 && headshot && victim)
    {
      
point_print(victim"%L"victim"POINT_LOSE_HS"status_1);
      
update_points(victimstatus_101);
    }
    else if(
status_2 && victim)
    {
     
point_print(victim"%L"victim"POINT_LOSE"status_2);
     
update_points(victimstatus_201);
    } 
The part i added only lose points if the client suicide grenade.

Last edited by pepe_thugs; 02-03-2012 at 08:48.
pepe_thugs is offline
Old 02-04-2012, 06:22
pepe_thugs
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 02-16-2012 , 16:03   Re: Help Function
Reply With Quote #2

Sorry for bump but i needed a big help for this thread.
I tried to add this function:

PHP Code:
public fwd_Client_Death()
{
 if(
is_ps_on())
 {
  new 
attacker get_msg_arg_int(1);
  new 
victim get_msg_arg_int(2);
  new 
headshot get_msg_arg_int(3);
 
  new 
status_1 get_pcvar_num(ps_death_hs);
  new 
status_2 get_pcvar_num(ps_death);
 
  if(
gb_user_connected[victim])
  {
   new 
FmTeams:team_1 fm_get_user_team(attacker);
   new 
FmTeams:team_2 fm_get_user_team(victim);
 
   if(
team_1 != team_2)
   {
    if(
status_1 && headshot)
    {
      
point_print(victim"%L"victim"POINT_LOSE_HS"status_1);
      
update_points(victimstatus_101);
    }
    else if(
status_2)
    {
     
point_print(victim"%L"victim"POINT_LOSE"status_2);
     
update_points(victimstatus_201);
    }
   }
  }
 }
 
 return 
0;

But do not works.
It's a big help i needed.
Please
pepe_thugs is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-16-2012 , 18:07   Re: Help Function
Reply With Quote #3

What did you add it to and what didn't work. If you want help you need to give more information instead of waiting for someone to reply asking for more info. You've been here long enough to learn this. It will make all our lives easier.
__________________
fysiks is offline
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 02-17-2012 , 07:52   Re: Help Function
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
What did you add it to and what didn't work. If you want help you need to give more information instead of waiting for someone to reply asking for more info.
I added this function to lose points if they die (normal or headshot).
You understand what i want?
Sorry it's my bad english.


Quote:
Originally Posted by fysiks View Post
You've been here long enough to learn this. It will make all our lives easier.

I'm tried to learn more in the tutorials.
But i use translator because my english is bad.
So i will learn very slowly.
I tried to ask help because i don't know what miss in the function to work.
And I've tried several ways
Please give me a small help.

Last edited by pepe_thugs; 02-17-2012 at 09:31.
pepe_thugs is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-17-2012 , 17:10   Re: Help Function
Reply With Quote #5

Well it's really hard to tell what in the world you are doing without the WHOLE code. You have posted two functions in this thread that are NOT the same but with similar code.
__________________
fysiks is offline
pepe_thugs
Senior Member
Join Date: Aug 2010
Location: Portugal , Braga
Old 02-18-2012 , 08:27   Re: Help Function
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Well it's really hard to tell what in the world you are doing without the WHOLE code. You have posted two functions in this thread that are NOT the same but with similar code.
Solved..
Thanks for attention

Last edited by pepe_thugs; 02-19-2012 at 16:19.
pepe_thugs 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 10:05.


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