AlliedModders

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

kramesa 11-25-2011 11:30

Help
 
Hi!

How i get this the steamID and the name of client_disconnect for serverprint?

Look my plugin fails

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 

    
register_plugin("Client Test""1.0""krm"


public 
client_disconnect(id)
{
    new 
SteamID[32], Name[32]
    
    
get_user_authid(idSteamID31)
    
get_user_name(idName31)
    
    
set_task(5.0"ServerPrint"id)
}

public 
ServerPrint(SteamID[], Name[])
{
    
server_print("SteamID: %s"SteamID)
    
server_print("Name: %s"Name)



MyPc 11-25-2011 11:53

Re: Help
 
Quote:

Originally Posted by kramesa (Post 1602414)
Hi!

How i get this the steamID and the name of client_disconnect for serverprint?

Look my plugin fails

PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 

    
register_plugin("Client Test""1.0""krm"


public 
client_disconnect(id)
{
    new 
SteamID[32], Name[32]
    
    
get_user_authid(idSteamID31)
    
get_user_name(idName31)
    
    
set_task(5.0"ServerPrint"id)
}

public 
ServerPrint(SteamID[], Name[])
{
    
server_print("SteamID: %s"SteamID)
    
server_print("Name: %s"Name)




PHP Code:

#include < amxmodx >

public client_disconnectid )
{
    new 
steam35 ], name32 ]
    
get_user_authididsteamsizeof steam )
    
get_user_nameidnamesizeof name 1)
    
    
sprintsteamname )
}

public 
sprintsteam[], name[] )
{
    
server_print("SteamID: %s"steam)
    
server_print("Name: %s"name)


your code calls ServerPrint with the paramater id with no "SteamID" or "Name".

Nyuszy 11-27-2011 03:57

Re: Help
 
you can't get name and steamid on disconnect, but you may get it on connect, push to an array, and you can print it from the array on disconnect :)

fysiks 11-27-2011 14:12

Re: Help
 
Quote:

Originally Posted by kramesa (Post 1602414)
Hi!

How i get this the steamID and the name of client_disconnect for serverprint?

Look my plugin fails

If you would just debug your code then you would know that the issue has something to do with the set_task().

Quote:

Originally Posted by Nyuszy (Post 1603443)
you can't get name and steamid on disconnect, but you may get it on connect, push to an array, and you can print it from the array on disconnect :)

You are wrong. It works perfectly fine on client_disconnect(). His problem is stated above.

ConnorMcLeod 11-27-2011 16:27

Re: Help
 
You can pass steamid and name in parm argument in set_task, note that you have to specify the parms array len.
In the example i've used a pseudo-structure to make things easier and more clear.

PHP Code:

#include <amxmodx>
#include <amxmisc>

enum _:mPlayersDatas
{
    
m_szName[32],
    
m_szSteamId[32]
}

public 
plugin_init() 

    
register_plugin("Client Test""1.0""krm"


public 
client_disconnect(id)
{
    new 
Datas[mPlayersDatas]
    
    
get_user_authid(idDatas[m_szSteamId], charsmax(Datas[m_szSteamId]))
    
get_user_name(idDatas[m_szName], charsmax(Datas[m_szName]))
    
    
set_task(5.0"ServerPrint"idDatassizeof(Datas))
}

public 
ServerPrint(Params[], id)
{
    
server_print("SteamID: %s"Params[m_szSteamId])
    
server_print("Name: %s"Params[m_szName])




All times are GMT -4. The time now is 08:26.

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