AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect lasermine - incorrect code (https://forums.alliedmods.net/showthread.php?t=189474)

J4CK 07-07-2012 13:41

Detect lasermine - incorrect code
 
how it's possible, detect deaths with lasermine.
Quote:

Player1 killed Player2 with lasermine
my code is not working :crab: anybody know why?

PHP Code:

register_event("DeathMsg""eDeath""a");

public 
eDeath()
{
     new 
szWeapon10 ];
     
read_data4szWeaponcharsmaxszWeapon ) );

     if( 
equalszWeapon"lasermine" ) )
     {
          new 
iKiller read_data(1);
          new 
iVictim read_data(2);

          
//blablabla

     
}



Bugsy 07-07-2012 13:54

Re: Detect lasermine - incorrect code
 
do some debugging, try client_print( 0 , print_chat , "weapon=%s" , szWeapon ) and see why it doesn't match.

Neeeeeeeeeel.- 07-07-2012 16:07

Re: Detect lasermine - incorrect code
 
I use a forward to do it...

Here is an example:
PHP Code:

g_lm_forward;

public 
plugin_init( )
    
g_lm_forward CreateMultiForward"lasermine_kill"ET_IGNOREFP_CELLFP_CELL );

// if you are using the common lasermine/tripmine use this:
set_score(id,target,hitscore,HP){
    
// blablabla
    
new iReturn
    ExecuteForward
g_lm_forwardiReturnidtarget );
)

// you can use this in any other plugin you want
forward lasermine_killkillervictim )

public 
lasermine_killkillervictim )
{
     
// here what you want



J4CK 07-08-2012 15:15

Re: Detect lasermine - incorrect code
 
not working :cry:
i want use this code with this lasermine: https://forums.alliedmods.net/showthread.php?t=25819
i know how edit original code, but i need standalone code.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new g_lm_forward;

public 
plugin_init()
{
    
register_plugin("test""0.1""test");
    
g_lm_forward CreateMultiForward"lasermine_kill"ET_IGNOREFP_CELLFP_CELL );
}

public 
lasermine_killkillervictim )
{
// for example killer get grenade after kill enemy with laser
        
give_item(killer"weapon_hegrenade")



Neeeeeeeeeel.- 07-08-2012 23:46

Re: Detect lasermine - incorrect code
 
3 Attachment(s)
I made an example for you.


All times are GMT -4. The time now is 15:02.

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