Raised This Month: $ Target: $400
 0% 

Info Message for Victim


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-26-2013 , 11:13   Info Message for Victim
Reply With Quote #1

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 ...
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-26-2013 , 11:28   Re: Info Message for Victim
Reply With Quote #2

weapon and health are Integers, not Strings. Use %d or %i instead of %s
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-26-2013 , 11:45   Re: Info Message for Victim
Reply With Quote #3

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;


Last edited by daNzEt; 12-26-2013 at 11:59.
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-26-2013 , 12:34   Re: Info Message for Victim
Reply With Quote #4

That is because get_user_weapon returns a weapon index, not a name. You need to translate that to the weapon name
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-26-2013 , 12:40   Re: Info Message for Victim
Reply With Quote #5

How can i do that? Can you help me?

Last edited by daNzEt; 12-26-2013 at 12:42.
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
CeDeee
Member
Join Date: Dec 2011
Old 12-27-2013 , 12:49   Re: Info Message for Victim
Reply With Quote #6

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;

CeDeee is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-27-2013 , 13:24   Re: Info Message for Victim
Reply With Quote #7

Same, not showing weapon nome only some figures:

[php]Player x killed with 119 and he has y hp
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-27-2013 , 16:13   Re: Info Message for Victim
Reply With Quote #8

That is because he is printing a String as an Integer. Change the %d back to %s
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 12-28-2013 , 03:21   Re: Info Message for Victim
Reply With Quote #9

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
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
DavidJr
Senior Member
Join Date: Apr 2012
Old 12-28-2013 , 04:11   Re: Info Message for Victim
Reply With Quote #10

Weapon name:

PHP Code:
    new szWeaponName[32]
    
read_data(4szWeaponNamesizeof szWeaponName)

    
client_print(iVictimprint_chat"%s"szWeaponName
__________________
What are you looking for here?

Last edited by DavidJr; 12-28-2013 at 04:12.
DavidJr 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 20:24.


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