AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] get_user_name() returning Server Name (https://forums.alliedmods.net/showthread.php?t=241075)

Flaming 05-27-2014 11:26

[SOLVED] get_user_name() returning Server Name
 
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]

YamiKaitou 05-27-2014 11:31

Re: get_user_name() returning Server Name
 
LogEvents do not pass the User Index in that manner, use read_logarg* to obtain the index

Flaming 05-27-2014 11:44

Re: get_user_name() returning Server Name
 
Can I get a brief "How-To" on it please? :)

YamiKaitou 05-27-2014 11:46

Re: get_user_name() returning Server Name
 
They are used in the same manner as the read_arg* natives

swapped 05-27-2014 12:20

Re: get_user_name() returning Server Name
 
Quote:

Originally Posted by Flaming (Post 2143097)
Can I get a brief "How-To" on it please? :)

search for VEN cs bomb scripting tutorial.

Flaming 05-28-2014 00:13

Re: get_user_name() returning Server Name
 
Thanks Yami & Swapped. This really helped me alot :)

And for others, here is the solution:
https://forums.alliedmods.net/showth...=40164?t=40164


All times are GMT -4. The time now is 18:07.

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