AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with my plugin pleas (https://forums.alliedmods.net/showthread.php?t=130146)

DaniDin 06-20-2010 17:42

help with my plugin pleas
 
hi some 1 can help me i it's not working ?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <file>

#define PLUGIN "My Plug"
#define VERSION "1.0"
#define AUTHOR "DaniDin"

new Handle:g_SqlTuple ,sql[512]


public 
plugin_init()
{
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
g_SqlTuple SQL_MakeDbTuple("localhost","amx","amxpass","amx")

}

// 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);

    return 
PLUGIN_CONTINUE
}
//


// "client_connect(id)" there SteamID might not be valid

public client_authorized(id)
{
    new 
AuthID[32],plName[32]
    
get_user_authid(id,AuthID,32);
    
get_user_name(id,plName,32);
    
set_task(20.0,"HelloMSG",id);
    
formatex(sql,511,"SELECT guser FROM users WHERE id='1'");
    
SQL_ThreadQuery(g_SqlTuple,"SelectHandle",sql);

    
//SQL_ThreadQuery(g_SqlTuple,"SelectHandle","SELECT guser FROM users  WHERE steamid='%d'",AuthID)
}
//

public kickpl(whotokick,whykick[],id)
{
new 
AuthID[32],plName[32]
get_user_authid(id,AuthID,32);
get_user_name(id,plName,32);
if(
whotokick ==  plName[31])
server_cmd("amx_tsay red yes %s = %s and ris is :  %s",whotokick,plName,whykick)
else
server_cmd("amx_tsay red no %s != %s and ris is :  %s",whotokick,plName,whykick)
    
//server_cmd("amx_kick ^"%d %d^"",whotokick,whykick)
}

//scan if user loged
public  SelectHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize,id)
{
    new 
AuthID[32],plName[32]
    
get_user_authid(id,AuthID,32);
    
get_user_name(id,plName,32);
    new 
txthim[101]

    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))
    {
    new 
DataNum
    DataNum 
SQL_ReadResult(Query,0,str,33)
    
//go and check if user name vaild
    
txthim "Change To Real Nick Name !";
    
kickpl(DataNum,txthim,id)
    
SQL_NextRow(Query)
    }
   
    return 
PLUGIN_CONTINUE
}     
//


public plugin_end()
    
// free the tuple - note that this does not close the connection,
    // since it wasn't connected in the first place
    
SQL_FreeHandle(g_SqlTuple

i the sql i have
id =1 guser = loli steamid = 123123

i want to do if player connect but not with his real nick so he get kick

in the log i get this
PHP Code:

L 06/21/2010 02:27:39: -------- Mapchange to de_dust2 --------
L 06/21/2010 02:28:07: [admin.amxxLogin:  "dvd<1><STEAM_0:1:11111111><>" became an admin  (account "STEAM_0:1:11111111") (access "abcdefghijklmnopqrstu") (address  "11.11.11.11")
L 06/21/2010 02:28:07: [adminchat.amxxChat"demo- CS  Server<0><><>" tsay "no `€loli != demo- CS Server and  ris is : Change To Real Nick Name !^" 


DaniDin 06-22-2010 04:07

Re: help with my plugin pleas
 
some 1 ?


All times are GMT -4. The time now is 14:42.

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