Raised This Month: $51 Target: $400
 12% 

[SOLVED] get_user_name() returning Server Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flaming
Member
Join Date: Aug 2012
Location: India
Old 05-27-2014 , 11:26   [SOLVED] get_user_name() returning Server Name
Reply With Quote #1

Hey guys, I ran into a scripting problem(again). Here are the details:

Events:
PHP Code:
register_logevent("SpawnBomb"3"2=Spawned_With_The_Bomb")
register_logevent("DropBomb"3"2=Dropped_The_Bomb")
register_logevent("GetBomb"3"2=Got_The_Bomb"
Methods:
PHP Code:
public SpawnBomb(index)
{
    new 
szName[32
    
get_user_name(index,szName,charsmax(szName)) 
    
    
g_iFrags[index] += 2
    client_print
(0print_chat"%s got 2 points for Spawn with the Bomb."szName)
    
}

public 
GetBomb(index)
{
    new 
szName[32
    
get_user_name(index,szName,charsmax(szName)) 
    
    
g_iFrags[index] += 4
    client_print
(0print_chat"%s got 4 points for Pickup the Bomb!."szName)
}

public 
DropBomb(index)
{
    new 
szName[32
    
get_user_name(index,szName,charsmax(szName)) 
    
    
g_iFrags[index] -= 2
    client_print
(0print_chat"%s lost 2 points for Drop the Bomb."szName)

Everytime the above events are called, the "server name" gets printed instead of "client name"! I have no idea why... What am I doing wrong here?

[edit] PS: I was the only player when I tested the plugin(solitary Terrorist). Is that the problem or what?[/edit]

Last edited by Flaming; 05-28-2014 at 00:15.
Flaming is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-27-2014 , 11:31   Re: get_user_name() returning Server Name
Reply With Quote #2

LogEvents do not pass the User Index in that manner, use read_logarg* to obtain the index
__________________
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
Flaming
Member
Join Date: Aug 2012
Location: India
Old 05-27-2014 , 11:44   Re: get_user_name() returning Server Name
Reply With Quote #3

Can I get a brief "How-To" on it please?
Flaming is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-27-2014 , 11:46   Re: get_user_name() returning Server Name
Reply With Quote #4

They are used in the same manner as the read_arg* natives
__________________
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
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-27-2014 , 12:20   Re: get_user_name() returning Server Name
Reply With Quote #5

Quote:
Originally Posted by Flaming View Post
Can I get a brief "How-To" on it please?
search for VEN cs bomb scripting tutorial.
swapped is offline
Flaming
Member
Join Date: Aug 2012
Location: India
Old 05-28-2014 , 00:13   Re: get_user_name() returning Server Name
Reply With Quote #6

Thanks Yami & Swapped. This really helped me alot

And for others, here is the solution:
https://forums.alliedmods.net/showth...=40164?t=40164
Flaming 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 14:33.


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