Raised This Month: $ Target: $400
 0% 

get_user_name help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-03-2010 , 17:11   get_user_name help
Reply With Quote #1

I wrote out this thing and for some reason when id use it, itd say the killer of the victim has died, and not the person thats died him/herself. So i added victim and killer, and it doesnt compile..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <csx>


public plugin_precache()
{
    
precache_sound("misc/chucky1.wav")
}

public 
plugin_init()
{
    
register_plugin("move","r4nDoMz","1.0")
    
register_event("client_death","client_death","a")
}

public 
client_death(id)
{    
    new 
weapon get_user_weapon(id)
    new 
Killer read_data(1)
    new 
Victim read_data(2)

    if(
weapon == CSW_KNIFE)
    {
        
get_user_name(Victim)
        
get_user_name(Killer)
        
client_print(0print_center"%s killed %s with a knife!!!"KillerVictim)     
        
client_cmd(0,"spk sound/misc/chucky1.wav")
    }
    else
    {
        
get_user_name(Killer)
        
get_user_name(Victim)
        
client_print(0print_chat"Player %s was killed by %s!!!"VictimKiller
    }

PHP Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// knifelol.sma
// C:\Documents and Settings\nick\Desktop\compiler1\knifelol.sma(28) : error 088
number of arguments does not match definition
// C:\Documents and Settings\nick\Desktop\compiler1\knifelol.sma(29) : error 088
number of arguments does not match definition
// C:\Documents and Settings\nick\Desktop\compiler1\knifelol.sma(35) : error 088
number of arguments does not match definition
// C:\Documents and Settings\nick\Desktop\compiler1\knifelol.sma(36) : error 088
number of arguments does not match definition
//
// 4 Errors.
// Could not locate output file C:\Documents and Settings\nick\Desktop\compiler1
\compiled\knifelol.amx (compile failed).
//
// Compilation Time: 0.42 sec
// ----------------------------------------

Press enter to exit ... 
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-03-2010 , 17:13   Re: get_user_name help
Reply With Quote #2

PHP Code:
new szName[32]
get_user_name(idszNamecharsmax(szName))
client_print(0print_chat"Player name is: %s"szName
__________________
fysiks is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-03-2010 , 19:40   Re: get_user_name help
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
PHP Code:
new szName[32]
get_user_name(idszNamecharsmax(szName))
client_print(0print_chat"Player name is: %s"szName
for that would i need to put Killer and Victim for id? or no?

EDIT:
ok i tried it, compiles fine...now to test!

EDIT:EDIT:
hmm...tested it out, and i hear the sound, i see the text, but the players names arent appearing. Just says " killed with a knife!!!"
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 02-03-2010 at 19:48.
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 02-03-2010 , 19:55   Re: get_user_name help
Reply With Quote #4

Killer and Victim are 2 id's.
You must put 2 arrays that will contain the killers & victims name.
As fysiks said, you have to put:
Quote:
Originally Posted by fysiks View Post
PHP Code:
new szName[32]
get_user_name(idszNamecharsmax(szName))
client_print(0print_chat"Player name is: %s"szName
In get_user_name, instead of id you have to put Killer to get the Killer's name and put again the stuff but instead of Killer, put Victim.
Stuff will be this:
PHP Code:
new szVictimName[32], szKillerName[32]
get_user_name(VictimszVictimNamecharsmax(szVictimName))
get_user_name(KillerszKillerNamecharsmax(szKillerName))
client_print(0print_chat"Killer : %s, Victim: %s"szKillerNameszVictimName
Mxnn is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-03-2010 , 20:41   Re: get_user_name help
Reply With Quote #5

Quote:
Originally Posted by Mxnn View Post
Killer and Victim are 2 id's.
You must put 2 arrays that will contain the killers & victims name.
As fysiks said, you have to put:


In get_user_name, instead of id you have to put Killer to get the Killer's name and put again the stuff but instead of Killer, put Victim.
Stuff will be this:
PHP Code:
new szVictimName[32], szKillerName[32]
get_user_name(VictimszVictimNamecharsmax(szVictimName))
get_user_name(KillerszKillerNamecharsmax(szKillerName))
client_print(0print_chat"Killer : %s, Victim: %s"szKillerNameszVictimName
Ok so i tried that, and now it shows:
>cNs< HideNseek *Is Back* killed >cNs< HideNseek *Is Back
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 02-03-2010 , 22:35   Re: get_user_name help
Reply With Quote #6

?
If you put that i put, the server will show "Killer: KILLER_NAME, Victim: VICTIM_NAME" and no more else.
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-03-2010 , 23:42   Re: get_user_name help
Reply With Quote #7

PHP Code:
register_event("DeathMsg", . . . 
__________________
fysiks is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 02-04-2010 , 02:17   Re: get_user_name help
Reply With Quote #8

you can check player weapon in deathmessage with read_data( 4, ... );

and you have a bad code right there
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 02-04-2010 , 06:59   Re: get_user_name help
Reply With Quote #9

Quote:
Originally Posted by Mxnn View Post
?
If you put that i put, the server will show "Killer: KILLER_NAME, Victim: VICTIM_NAME" and no more else.
PHP Code:
client_print(0print_center"%s has killed %s with a KNIFE!!"szKillerNameszVictimName
Thats whats there. Looks the same or its only possible to do it if you do that?
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-04-2010 , 07:13   Re: get_user_name help
Reply With Quote #10

PHP Code:
public plugin_init()
{
    
register_plugin("move","r4nDoMz","1.0")
    
register_event("DeathMsg""client_death""a""1>0")
}

public 
client_death()
{    
    new 
Killer[32],Victim[32]
    new 
Killernum read_data(1)
    new 
Victimnum read_data(2)
    static 
weapon_name[24];
    
read_data(4,weapon_name,23);
    
get_user_name(Killernum,Killer,31);
    
get_user_name(Victimnum,Victim,31);
    if (
equal(weapon_name,"knife"))
    {
        
client_print(0print_center"%s killed %s with a knife!!!"KillerVictim)     
        
client_cmd(0,"spk sound/misc/chucky1.wav")
    }
    else
    {
        
client_print(0print_chat"Player %s was killed by %s!!!"VictimKiller
    }

EDITED Change this two Codes
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 02-04-2010 at 07:16. Reason: EDITED
ProIcons 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 07:28.


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