AlliedModders

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

DaniDin 01-25-2009 17:41

printing hello message ?
 
hi
i want wan user connect the server it will kick him and type this message
"Hi , *username* your steamid is : *SteamID* ."
*username* = the username in the game
*steamid* = the steam id of this user
pleas how i do this ?

DaniDin 01-25-2009 18:00

Re: printing hello message ?
 
some 1?
pleaaaaas

Drak 01-25-2009 18:01

Re: printing hello message ?
 
Code:
#include <amxmodx> public plugin_init()     register_plugin("KickU","0.1a","Drak"); // "client_connect(id)" there SteamID might not be valid public client_authorized(id) {     new AuthID[36],plName[33]     get_user_authid(id,AuthID,35);     get_user_name(id,plName,32);         server_cmd("kick #%d ^"Hi, %s Your SteamID is: %s^"",get_user_userid(id),plName,AuthID);     server_exec(); }

DaniDin 01-25-2009 18:05

Re: printing hello message ?
 
thanks
try it ...

DaniDin 01-25-2009 18:30

Re: printing hello message ?
 
hi
way it's not working ?
i do this :
PHP Code:

public plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
set_task(30.0,"HelloMSG",0,_,_,"",0)

}

// Say Hello To The User
public HelloMSG(id)
{
    new 
AuthID[32],plName[32]
    
get_user_authid(id,AuthID,32);
    
get_user_name(id,plName,32);
    
    
server_cmd("say ^"Hi, %s Your SteamID is: %s^"",plName,AuthID);


it's type the name of the server and bo steam id :\

Drak 01-25-2009 18:55

Re: printing hello message ?
 
Your setting a task, with no ID given. It's gonna do nothing.
What exactly do you want.

DaniDin 01-25-2009 20:02

Re: printing hello message ?
 
the server will type hello with the user steamid and the nick and ip :\

Drak 01-25-2009 20:34

Re: printing hello message ?
 
Code:
#include <amxmodx> public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR) } public client_authorized(id)     set_task(20.0,"HelloMSG",id); // Say Hello To The User public HelloMSG(id) {     new AuthID[32],plName[32]     get_user_authid(id,AuthID,32);     get_user_name(id,plName,32);         server_cmd("say ^"Hi, %s Your SteamID is: %s^"",plName,AuthID); }

You should catch the "ResetHUD" event, and send the message when they spawn. But the above will work still.

DaniDin 01-25-2009 20:44

Re: printing hello message ?
 
thanks now i do this and it now working you can help with this ?
PHP Code:

public client_authorized(id)
{
    new 
AuthID[32],plName[32]
    
get_user_authid(id,AuthID,32);
    
get_user_name(id,plName,32);
        
SQL_ThreadQuery(g_SqlTuple,"SelectHandle","SELECT logged FROM users WHERE nick='%s'",plName);
}

public 
SelectHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize,id)
{
    new 
name[32], authid[32]
    if(
FailState == TQUERY_CONNECT_FAILED)
        return 
set_fail_state("Could not connect to SQL database.")
    else if(
FailState == TQUERY_QUERY_FAILED)
        return 
set_fail_state("Query failed.")
   
    if(
Errcode)
        return 
log_amx("Error on query: %s",Error)
   
    new 
str[33]
    while(
SQL_MoreResults(Query))
    {
        
SQL_ReadResult(Query,0,str,33)
        
get_user_name(id,name,31
        
get_user_authid(id,authid,31)

        
server_cmd("amx_say ^"my: %s^"",str)
    
    
        
SQL_NextRow(Query)
    }
   
    return 
PLUGIN_CONTINUE



Drak 01-25-2009 21:14

Re: printing hello message ?
 
What you have make's no sense. But you didn't even pass an ID. Which I did here.
Code:
#include <amxmodx> #include <sqlx> public client_authorized(id) {     new AuthID[36],plName[33],Data[1]     get_user_authid(id,AuthID,35);     get_user_name(id,plName,32);         Data[0] = id     SQL_ThreadQuery(g_SqlTuple,"SelectHandle","SELECT logged FROM users WHERE nick='%s'",plName,Data,1); } public SelectHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize,id) {     if(FailState == TQUERY_CONNECT_FAILED)         return set_fail_state("Could not connect to SQL database.")     else if(FailState == TQUERY_QUERY_FAILED)         return set_fail_state("Query failed.")         if(Errcode)         return log_amx("Error on query: %s",Error)         new id = Data[0],plName[33],AuthID[36],String[128]     while(SQL_MoreResults(Query))     {         SQL_ReadResult(Query,0,String,127);                 get_user_name(id,plName,32);         get_user_authid(id,AuthID,35);                 server_cmd("amx_say ^"my: %s^"",String);                 SQL_NextRow(Query);     }         return PLUGIN_CONTINUE }
I'm not sure what's saved in the SQL, so I don't know what it's even going to display. or what "amx_say" does


All times are GMT -4. The time now is 01:44.

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