Raised This Month: $ Target: $400
 0% 

Returning Server's name instead of Player name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 08-14-2012 , 10:02   Returning Server's name instead of Player name
Reply With Quote #1

Hey Guys, I am back after few months, I was working in PHP. I forgot allot of things in SMALL. Here I am trying to get the name of the player who has died. But There is some problem in it. In game, When I kill somebody or get killed I should get the message "somebody has been shot to death!", But in game I am getting "My-Server has been shot to death".
I dont know how to get the name properly. It is returning the server name.

Code:
#include <amxmodx> #include <amxmisc> public  plugin_init() {     register_plugin("Gameplay1","1.0","Waleed");     register_event("DeathMsg", "hook_death", "a", "1>0") } public  hook_death(id) {     new name[32]     get_user_name(id, name, charsmax(name))     client_print(id, print_chat, " %s has been shot to death!", name) }

I have new ideas but stuck at the starting xD
Sorry for asking such a newbie question
Thnx
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]

Last edited by Waleed; 08-14-2012 at 10:03.
Waleed is offline
Send a message via Skype™ to Waleed
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2012 , 10:04   Re: Returning Server's name instead of Player name
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php?...vent&go=search
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 08-14-2012 , 10:53   Re: Returning Server's name instead of Player name
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Can you tell me what's wrong So I can look at func wiki knowing my mistake.
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]
Waleed is offline
Send a message via Skype™ to Waleed
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 08-14-2012 , 10:54   Re: Returning Server's name instead of Player name
Reply With Quote #4

Well read the example part in the link he posted and you'll know whats wrong
EpicMonkey is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-14-2012 , 12:04   Re: Returning Server's name instead of Player name
Reply With Quote #5

First, DeathMsg doesnt have params , if you want to get killer/victim use read_data , see Connor's post.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-14-2012 , 21:16   Re: Returning Server's name instead of Player name
Reply With Quote #6

to get the name of the killing player, use read_data(1).
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2012 , 22:49   Re: Returning Server's name instead of Player name
Reply With Quote #7

Quote:
Originally Posted by Napoleon_be View Post
to get the name of the killing player, use read_data(1).
Really? Why do people need to answer a question that has already been answered?

Give a man a fish . . . .
__________________

Last edited by fysiks; 08-14-2012 at 22:49.
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-15-2012 , 00:21   Re: Returning Server's name instead of Player name
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post

Give a man a fish . . . .
LOL. Some people just get confused with a raw fish if it hasn't already been battered, deep fried, shoved in plastic wrap, and printed directions on how to microwave it. (me included in certain states of mind)
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 08-15-2012 , 04:08   Re: Returning Server's name instead of Player name
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Really? Why do people need to answer a question that has already been answered?

Give a man a fish . . . .
We got crabs ... , couldnt find any fishes
EpicMonkey is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2012 , 05:07   Re: Returning Server's name instead of Player name
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Really? Why do people need to answer a question that has already been answered?

Give a man a fish . . . .
Don't blame him, he started his post before me, but it took him roughly 11 hours and 15 min to answer, so few people had already answered when he hit the submit button.


About the question, use read_data(1) to get killer index so you can use get_user_name with that index.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-15-2012 at 05:08.
ConnorMcLeod 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 05:48.


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