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

help for sql


Post New Thread Reply   
 
Thread Tools Display Modes
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
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-26-2014 , 02:49   Re: help for sql
Reply With Quote #2

remove the SQL_LockDatabase, I highly suggest you to read the wiki page about SQL.
Mathias. is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-26-2014 , 02:57   Re: help for sql
Reply With Quote #3

Double-lock anyway.
Read the wiki article.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
Miew
Member
Join Date: Jan 2014
Old 01-26-2014 , 05:12   Re: help for sql
Reply With Quote #4

ok i 'll do that , thanks for your reply
Miew is offline
Miew
Member
Join Date: Jan 2014
Old 01-26-2014 , 05:29   Re: help for sql
Reply With Quote #5

work perfectly thx all
Miew is offline
Reply


Thread Tools
Display Modes

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 20:09.


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