Thread: help for sql
View Single Post
Author Message
Miew
Member
Join Date: Jan 2014
Old 01-25-2014 , 17:41   help for sql
Reply With Quote #1

some one can help me for fix this plugin , cause he crash my server ...
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <smlib>

new Handle:DB INVALID_HANDLE;
new 
String:Error[100];

public 
Plugin:myinfo = {
name "MySQL",
author "Skuzy",
description "",
url ""
};

public 
OnPluginStart()
{
   
DB SQL_Connect("test"trueErrorsizeof(Error));
   if(
DB == INVALID_HANDLE)
   {
      
PrintToServer("Cannot connect to MySQL Server: %s"Error);
      
CloseHandle(DB);
   } else {
      
PrintToServer("Connection Successful");
   }

   
RegConsoleCmd("sm_clantag",CallBack_clantag);
}

GetClientPrefix(clientString:prefix[32])
{
   new 
String:steamid[32];
   
GetClientAuthString(clientsteamid32);
   
   new 
String:query[150];
   
Format(querysizeof(query), "SELECT prefix FROM chatcolor WHERE steamid='%s'"steamid);

   
SQL_LockDatabase(DB);

   new 
Handle:queryH SQL_Query(DBquery);
   
SQL_LockDatabase(DB);
   
SQL_FetchRow(queryH);

   
SQL_FetchString(queryH0prefixsizeof(prefix));

   
CloseHandle(queryH);

}

public 
Action:CallBack_clantag(client,args)
{
   new 
String:NewPrefix[32];
   
GetClientPrefix(clientNewPrefix);
   
CS_SetClientClanTag(clientNewPrefix);

Miew is offline