AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   help for sql (https://forums.alliedmods.net/showthread.php?t=234127)

Miew 01-25-2014 17:41

help for sql
 
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);



Mathias. 01-26-2014 02:49

Re: help for sql
 
remove the SQL_LockDatabase, I highly suggest you to read the wiki page about SQL.

Dr. Greg House 01-26-2014 02:57

Re: help for sql
 
Double-lock anyway.
Read the wiki article.

Miew 01-26-2014 05:12

Re: help for sql
 
ok i 'll do that , thanks for your reply

Miew 01-26-2014 05:29

Re: help for sql
 
work perfectly thx all


All times are GMT -4. The time now is 07:15.

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