AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dead even get weapon bug...... (https://forums.alliedmods.net/showthread.php?t=144560)

0920357689 12-05-2010 09:45

dead even get weapon bug......
 
PHP Code:

register_event("DeathMsg""player_death""a");
 
public 
player_death(id)
{
 new 
weapon[32];
 new 
Killer read_data(1)
 new 
Victim read_data(2
 
read_data(3weapon31)
 
 if(!
is_user_connected(Killer))
  return 
PLUGIN_CONTINUE;
 if(
player_team[Killer] == player_team[Victim])
  return 
PLUGIN_CONTINUE;
 if(
Killer == Victim)
  return 
PLUGIN_CONTINUE;
 if(
containi(weapon,"knife") == -1)
 
//if(!equal(weapon, "knife"))
 
{
  
NO KNIFE KILL WILL DO
 }
 return 
PLUGIN_CONTINUE;


if knife kill also will do....where have bug?
i can't find.......

i need if knife kill will "return PLUGIN_CONTINUE"

drekes 12-05-2010 10:12

Re: dead even get weapon bug......
 
I think it would be easier if you told us what you're trying to do.

0920357689 12-05-2010 10:31

Re: dead even get weapon bug......
 
Quote:

Originally Posted by drekes (Post 1363762)
I think it would be easier if you told us what you're trying to do.

give exp to player if he doesn't use knife

drekes 12-05-2010 11:30

Re: dead even get weapon bug......
 
PHP Code:

 register_event("DeathMsg""Event_DeathMsg""a""1>0");
 
 public 
Event_DeathMsg()
 {
    new 
weapon[20];
    new 
Killer read_data(1);
    new 
Victim read_data(2) ;
    
read_data(4weaponcharsmax(weapon));
 
    if(
player_team[Killer] == player_team[Victim] || Killer == Victim || !(<= Victim <= 32))
        return 
PLUGIN_HANDLED;
        
    if(!
equal(weapon"knife"))
    {
        
// Player killed without knife
    
}


Try to do it like this.

0920357689 12-05-2010 11:53

Re: dead even get weapon bug......
 
ok, this is work,thank you!

drekes 12-05-2010 13:03

Re: dead even get weapon bug......
 
No problem.

If you ever need to read_data from an event again, you can check it here to see all the info about the events here: http://wiki.alliedmods.net/Half-Life_1_Game_Events

abdul-rehman 12-05-2010 13:14

Re: dead even get weapon bug......
 
Quote:

Originally Posted by drekes (Post 1363903)
No problem.

If you ever need to read_data from an event again, you can check it here to see all the info about the events here: http://wiki.alliedmods.net/Half-Life_1_Game_Events

Regarding da code u posted above, in da death MSG event, the victim is always a player entity but the attacker can be or can not be a plyer entity so it would be better to add the check in the above code (1 <= attacker <= 32)

drekes 12-05-2010 13:21

Re: dead even get weapon bug......
 
Quote:

Originally Posted by abdul-rehman (Post 1363906)
Regarding da code u posted above, in da death MSG event, the victim is always a player entity but the attacker can be or can not be a plyer entity so it would be better to add the check in the above code (1 <= attacker <= 32)

Didn't think about that victim thing.
The function is only called when attacker > 0. because i registered it with "1>0"


All times are GMT -4. The time now is 11:26.

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