AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook message help (getting player name) (https://forums.alliedmods.net/showthread.php?t=105925)

turshija 10-09-2009 21:34

Hook message help (getting player name)
 
I'm developing private anti IP spam in chat that logs messages (in SQL) when someone tries to type IP address in his message and blocks that message from going into chat + optionally kick or ban player...
It logs Name, IP, date and message that player tried to send IP ...
For example, someone types:
"Great server! Join and get admin: 212.200.163.182:27025"
and it changes his message to something like: "I like to spam crap!" ...
So far I've managed to do everything with checking + changing message, but I just CAN'T find a way to get players name ... :S
If I try using get_user_name on (target), I just get current server name ... :S
help plox :)


PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("SayText"),"hook_message")
    (...)
}

public 
hook_message(target)
{
    if(
get_msg_argtype(4) != ARG_STRING)
    {
        return 
PLUGIN_CONTINUE
    
}
    
    new 
message[192]
    
get_msg_arg_string(4,message,sizeof message 1)
    (...)
    



Bugsy 10-09-2009 21:40

Re: Hook message help (getting player name)
 
See http://wiki.tcwonline.org/Half-Life_...Events#SayText

PHP Code:

static szName33 ];
get_user_nameget_msg_arg_int) , szName 32 ); 


turshija 10-10-2009 09:36

Re: Hook message help (getting player name)
 
thanks K+ :)


All times are GMT -4. The time now is 22:43.

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