AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_death (https://forums.alliedmods.net/showthread.php?t=143815)

ProIcons 11-25-2010 09:36

client_death
 
PHP Code:

public client_death(killervictimwpnindexhitplaceTK)
{
    new 
headshot = (hitplace == HIT_HEAD);
    
msg("Kill Status: Killer: %s / Victim: %s / Weapon: %d / Hitplace: %s / TK: %d / HeadShot %d",killervictimwpnindexhitplaceTKheadshot);


when i am killing someone with headshot the msg is showing to me that i've killed him with headshot... from the var:
new headshot = (hitplace == HIT_HEAD);
but when i am echoing the hitplace is appearing like a number and not like a string :/

Arkshine 11-25-2010 09:52

Re: client_death
 
Hitplace: %s

should be %d or %i

%s = string
%d = decimal
%i = integer

Bugsy 11-25-2010 09:52

Re: client_death
 
That function gets passed all integers, no strings. If you are expecting player names for killer\victim, you will need to use get_user_name with killer\victim as player id (check first if they are players by (1<=id<=maxplayers)).
PHP Code:

public client_death(killervictimwpnindexhitplaceTK)
{
    
/* from amxconst.inc
    #define HIT_GENERIC        0
    #define HIT_HEAD        1
    #define HIT_CHEST        2
    #define HIT_STOMACH        3
    #define HIT_LEFTARM        4
    #define HIT_RIGHTARM        5
    #define HIT_LEFTLEG        6
    #define HIT_RIGHTLEG        7 */
    
    
new const HitPlaceStrings[][] = 
    {
        
"Generic",
        
"Head",
        
"Chest",
        
"Stomach",
        
"LeftArm",
        
"RightArm",
        
"LeftLeg",
        
"RightLeg"
    
};

    
msg("Kill Status: Killer: %d / Victim: %d / Weapon: %d / Hitplace: %s / TK: %d / HeadShot %s",killervictimwpnindexHitPlaceStringshitplace ] , TK, ( hitplace == HIT_HEAD ) : "yes" "no" );




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

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