Raised This Month: $51 Target: $400
 12% 

MySQL Problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CyToTV
New Member
Join Date: Jan 2017
Old 01-25-2017 , 11:15   MySQL Problems
Reply With Quote #1

Help me pls.
My Code don't work. (Function - CheckSteamID)

PHP Code:

public OnPluginStart() 

    
match_id CreateConVar("mgsl_matchid""0");
    if (!
SQL_CheckConfig("MGSL_Controller")) 
    { 
        
SetFailState("Секция \"MGSL_Controller\" не найдена в databases.cfg"); 
        return; 
    } 
    
decl String:error[256]; 
    
db SQL_Connect("MGSL_Controller"trueerror256); 
    if (
db == INVALID_HANDLE
    { 
        
LogError(error); 
        
SetFailState("Не удалось установить SQL соединение"); 
        return; 
    } 


public 
OnClientPostAdminCheck(client

    
decl String:auth[32]; 
    
GetClientAuthId(clientAuthId_SteamID64authsizeof(auth));
    
CheckSteamID(clientauth); 
}

CheckSteamID(any:client, const String:auth[]) 

    if (!
IsClientConnected(client)) 
    { 
        return; 
    }
    new 
tmid;
    new 
tteam;
    
decl String:query[255];
    
LogMessage("Авторизация игрока: %s"auth);
    
FormatEx(querysizeof(query), "SELECT `match_id`, `side_id` FROM `users` WHERE `steam64` = '%s'"auth);
    new 
Handle:result SQL_Query(dbquery);
    if (
result == INVALID_HANDLE
    {
        
KickClient(client"Авторизация провалена, пожалуйста обратитесь к Администратору");
        return;
    }
    if (
SQL_FetchRow(result)){ 
        
tmid SQL_FetchInt(result0);
        
tteam SQL_FetchInt(result1);
        
tban SQL_FetchInt(result2);
        
LogMessage("Match_id: %s"tmid);
        
LogMessage("Team: %s"tteam);
        if(
tmid == match_id){
            
CS_SwitchTeam(client,tteam);
        }
        else{
            
KickClient(client"Вы не учавствуйте в этом матче");
            return;
        }
    }
    else
    { 
        
KickClient(client"Для игры на сервере вы должны пройти регистрацию и ввести SteamID64 на MGSL");
    }
    
CloseHandle(result);


Console Log:
L 01/25/2017 - 19:06:58: [mgsl.smx] Авторизация игрока: 76561198171630885
L 01/25/2017 - 19:06:58: [mgsl.smx] Match_id: 
L 01/25/2017 - 19:06:58: [mgsl.smx] Team: 
L 01/25/2017 - 19:06:58: [mgsl.smx] Ban: 
CyToTV is offline
Squallkins
AlliedModders Donor
Join Date: Mar 2005
Old 01-25-2017 , 12:27   Re: MySQL Problems
Reply With Quote #2

Quote:
Originally Posted by CyToTV View Post
Help me pls.
My Code don't work. (Function - CheckSteamID)

PHP Code:

        LogMessage
("Match_id: %s"tmid);
        
LogMessage("Team: %s"tteam); 
Console Log:
L 01/25/2017 - 19:06:58: [mgsl.smx] Авторизация игрока: 76561198171630885
L 01/25/2017 - 19:06:58: [mgsl.smx] Match_id: 
L 01/25/2017 - 19:06:58: [mgsl.smx] Team: 
L 01/25/2017 - 19:06:58: [mgsl.smx] Ban: 
Use

PHP Code:
LogMessage("Match_id: %d"tmid);
LogMessage("Team: %d"tteam); 
Squallkins is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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