MySQL Get Entry and query it
Hi,
i have a question how to Query a simpler int in a MySQL database (0,1) and then query it in an If-loop ob it is 1? I tryed it but it give a lot of Args errors. Can you pla help me? Regards Fireflasch7 |
Re: MySQL Get Entry and query it
Could you reformulate your question ? an "If-loop" sound strange to me. Also why don't you show us the code you have until this point ? That might clarify your question.
|
Re: MySQL Get Entry and query it
Perhaps he meant a "while" loop?...
@ OP: Here is a basis for starting with SQL: https://wiki.alliedmods.net/SQL_(SourceMod_Scripting) |
Re: MySQL Get Entry and query it
here this is my code
but it doent Work https://forums.alliedmods.net/data:i...ooooAKKKKAP//Z #include <sourcemod> #include <cstrike> new Handle:DB = INVALID_HANDLE; Handle query = INVALID_HANDLE; //new String:sAuth[20]; #define PLUGIN_VERSION "1.1.2.0" public Plugin:myinfo = { name = "VIP Tag", author = "Goof", description = "Vip Tag", version = PLUGIN_VERSION, url = "" } public OnPluginStart() { new String:Error[70]; DB = SQL_Connect("VIP", true, Error, sizeof(Error)); if(DB == INVALID_HANDLE) { PrintToServer("Cannot connect to MySQL Database %s", Error); CloseHandle(DB); } else { PrintToServer("Successfuly Connected to VIP"); } } public OnClientConnected(client) { query = SQL_Query(DB, "SELECT Enable FROM Tag WHERE steamid = 'STEAM_1:0:60899418'"); if (query == INVALID_HANDLE) { new String:error[255]; SQL_GetError(DB, error, sizeof(error)); PrintToServer("Failed to query (error: %s)", error) } else if(query == 1) { CS_SetClientClanTag(client, "✰VIP✰"); } } |
Re: MySQL Get Entry and query it
here this is my code
but it doent Work https://forums.alliedmods.net/data:i...ooooAKKKKAP//Z #include <sourcemod> #include <cstrike> new Handle:DB = INVALID_HANDLE; Handle query = INVALID_HANDLE; //new String:sAuth[20]; #define PLUGIN_VERSION "1.1.2.0" public Plugin:myinfo = { name = "VIP Tag", author = "Goof", description = "Vip Tag", version = PLUGIN_VERSION, url = "" } public OnPluginStart() { new String:Error[70]; DB = SQL_Connect("VIP", true, Error, sizeof(Error)); if(DB == INVALID_HANDLE) { PrintToServer("Cannot connect to MySQL Database %s", Error); CloseHandle(DB); } else { PrintToServer("Successfuly Connected to VIP"); } } public OnClientConnected(client) { query = SQL_Query(DB, "SELECT Enable FROM Tag WHERE steamid = 'STEAM_1:0:60899418'"); if (query == INVALID_HANDLE) { new String:error[255]; SQL_GetError(DB, error, sizeof(error)); PrintToServer("Failed to query (error: %s)", error) } else if(query == 1) { CS_SetClientClanTag(client, "✰VIP✰"); } } |
Re: MySQL Get Entry and query it
PHP Code:
|
Re: MySQL Get Entry and query it
Thank you for you help but i get the following Error:
Native "ReadPackCell" reported: Invalid data pack handle 2 (error 7) L 07/15/2015 - 13:07:25: [SM] Displaying call stack trace for plugin "VIPTag.smx": L 07/15/2015 - 13:07:25: [SM] [0] Line 52, C:\Users\Max\Desktop\csgo\sourcemod-1.7.2-windows\addons\sourcemod\scripting\VIPTag.sp: :SQL_LoadClient() |
Re: MySQL Get Entry and query it
|
All times are GMT -4. The time now is 11:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.