AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Info Message for Victim (https://forums.alliedmods.net/showthread.php?t=232154)

daNzEt 12-26-2013 11:13

Info Message for Victim
 
Hello,

I need some help scripting this part of plugin.

PHP Code:

public event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    if(
iKiller == iVictim)
    {
        return 
PLUGIN_HANDLED;
    }
    
    else
    {    
        new 
name[32]
        
get_user_name(iKillername31)
    
        new 
clipammoweapon get_user_weapon(iKiller,clip,ammo)
    
        new 
health get_user_health(iKiller);
    
        
chat_color(iVictim"!nJucatorul !t%s !nte-a ucis cu !g%s !nsi a ramas cu !g%s !nhp"nameweaponhealth)
    }
    
    return 
PLUGIN_HANDLED;


Not showing killer weapon and health to victim ...

YamiKaitou 12-26-2013 11:28

Re: Info Message for Victim
 
weapon and health are Integers, not Strings. Use %d or %i instead of %s

daNzEt 12-26-2013 11:45

Re: Info Message for Victim
 
Ok, i did, but look what's the message now:

Player x killed you with weapon 22 and he has "x" hp
Player x killed you with weapon 19 and he has "x" hp

Why not showing me weapon m4a1/ak47 or something like that and it's showing me (19,22)

PHP Code:

public event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    if(
iKiller == iVictim)
    {
        return 
PLUGIN_HANDLED;
    }
    
    else
    {    
        new 
name[32]
        
get_user_name(iKillername31)
    
        new 
clipammoweapon get_user_weapon(iKiller,clip,ammo)
    
        new 
health get_user_health(iKiller);
    
        
chat_color(iVictim"!nJucatorul !t%s !nte-a ucis cu !g%d !nsi a ramas cu !g%d !nhp"nameweaponhealth)
    }
    
    return 
PLUGIN_HANDLED;



YamiKaitou 12-26-2013 12:34

Re: Info Message for Victim
 
That is because get_user_weapon returns a weapon index, not a name. You need to translate that to the weapon name

daNzEt 12-26-2013 12:40

Re: Info Message for Victim
 
How can i do that? Can you help me?

CeDeee 12-27-2013 12:49

Re: Info Message for Victim
 
Hi, try this:
PHP Code:

public event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    if(
iKiller == iVictim)
    {
        return 
PLUGIN_HANDLED;
    }
    
    else
    {    
        new 
name[32], WeaponName[32
        
get_user_name(iKillername31)

        new 
clipammoweapon get_user_weapon(iKiller,clip,ammo)
        
        
get_weaponname (weaponWeaponName31)  
        
        new 
health get_user_health(iKiller);
        
        
chat_color(iVictim"!nJucatorul !t%s !nte-a ucis cu !g%d !nsi a ramas cu !g%d !nhp"nameWeaponNamehealth)
    }
    
    return 
PLUGIN_HANDLED;



daNzEt 12-27-2013 13:24

Re: Info Message for Victim
 
Same, not showing weapon nome only some figures:

[php]Player x killed with 119 and he has y hp

YamiKaitou 12-27-2013 16:13

Re: Info Message for Victim
 
That is because he is printing a String as an Integer. Change the %d back to %s

daNzEt 12-28-2013 03:21

Re: Info Message for Victim
 
Not working ... god damn .. no sanse you really know what are you doing?
First time was with %s and then %d and now you want again %s ...

Somebody help

DavidJr 12-28-2013 04:11

Re: Info Message for Victim
 
Weapon name:

PHP Code:

    new szWeaponName[32]
    
read_data(4szWeaponNamesizeof szWeaponName)

    
client_print(iVictimprint_chat"%s"szWeaponName



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

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