Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <fakemeta_util>
- #include <hamsandwich>
- #include <engine>
- #include <cstrike>
- #include <sqlx>
- #define PLUGIN "Weapon DB"
- #define VERSION "#1.0"
- #define AUTHOR "ko2"
- #define MYTASK 100
- #define ID_MYTASK (taskid - MYTASK)
- #define is_valid_weapon(%1,%2) ((pev(%1, pev_impulse)) == %2)
- new Handle:g_hDBTuple;
- new cvar_dbHost, cvar_dbUser, cvar_dbPass, cvar_dbName, cvar_roundActive;
- new const g_wModel[30][] =
- {
- "p228",
- "shield",
- "scout",
- "hegren",
- "xm1014",
- "c4",
- "mac10",
- "aug",
- "sgren",
- "elites",
- "fn57",
- "ump45",
- "sg550",
- "galil",
- "famas",
- "usp",
- "glock",
- "awp",
- "mp5",
- "m249",
- "m3",
- "m4a1",
- "tmp",
- "g3sg1",
- "flash",
- "deagle",
- "sg552",
- "ak47",
- "knife",
- "p90"
- }
- new const g_wName[30][] =
- {
- "weapon_p228",
- "weapon_shield",
- "weapon_scout",
- "weapon_hegrenade",
- "weapon_xm1014",
- "weapon_c4",
- "weapon_mac10",
- "weapon_aug",
- "weapon_smokegrenade",
- "weapon_elite",
- "weapon_fiveseven",
- "weapon_ump45",
- "weapon_sg550",
- "weapon_galil",
- "weapon_famas",
- "weapon_usp",
- "weapon_glock18",
- "weapon_awp",
- "weapon_mp5navy",
- "weapon_m249",
- "weapon_m3",
- "weapon_m4a1",
- "weapon_tmp",
- "weapon_g3sg1",
- "weapon_flashbang",
- "weapon_deagle",
- "weapon_sg552",
- "weapon_ak47",
- "weapon_knife",
- "weapon_p90"
- };
- stock const g_MaxAmmo[CSW_P90+1] = {
- -1, 52, -1, 90, -1, 32, 0, 100, 90, 0, 120,
- 100, 100, 90, 90, 90, 100, 120, 30, 120, 200,
- 32, 90, 120, 90, -1, 35, 90, 90, -1, 100}
- enum Data
- {
- ID_REL,
- WEAPON_NAME[32],
- MODEL_ID,
- WEAPON_ID,
- POWER,
- KEY,
- MESSAGE[128]
- }
- enum Model
- {
- ID,
- MODEL_P[32],
- MODEL_V[32],
- MODEL_W[32],
- }
- new g_weaponRelationCount;
- new g_weaponRelation[1024][Data];
- new g_weaponModelCount;
- new g_weaponModel[1024][Model];
- enum User
- {
- NAME[32],
- ID_WR,
- HP,
- ARMOR
- }
- new g_User[32][User]
- new Array:weapon_id;
- new Array:model_id;
- new g_maxUser;
- new countRound;
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- new item;
- g_maxUser = get_maxplayers();
- register_forward(FM_SetModel, "Fakemeta_SetModel");
- for(new i = 0; i < sizeof(weapon_id); i++)
- {
- item = ArrayGetCell(weapon_id, i);
- RegisterHam(Ham_Item_Deploy, g_wName[item-1], "ham_item_deploy_post", 1);
- RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
- }
- RegisterHam(Ham_Spawn, "player", "player_respawn", 1)
- register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
- register_clcmd("say /get", "cmdGive")
- }
- public event_new_round()
- {
- countRound++;
- }
- public player_respawn(id)
- {
- if(g_User[id - 1][HP] != 0) fm_set_user_health(id, g_User[id - 1][HP])
- if(g_User[id - 1][ARMOR] != 0) cs_set_user_armor(id, g_User[id - 1][ARMOR], CS_ARMOR_KEVLAR);
- }
- public cmdGive(id)
- {
- if(countRound < get_pcvar_num(cvar_roundActive))
- {
- client_print(id, print_chat, "Команда будет доступна через %d раунда(-ов)", get_pcvar_num(cvar_roundActive) - countRound);
- return PLUGIN_HANDLED;
- }
- new name[32];
- get_user_name(id, name, 31)
- for(new i = 0; i < g_maxUser; i++)
- {
- if(is_user_alive(i + 1))
- if(equal(g_User[i][NAME], name))
- if(g_User[i][ID_WR])
- for(new j = 0; j < g_weaponRelationCount; j++)
- {
- if(g_User[i][ID_WR] == g_weaponRelation[j][ID_REL])
- {
- static item;
- item = g_weaponRelation[j][WEAPON_ID];
- give_weapon(id, g_weaponRelation[j][KEY], g_wName[item-1]);
- cs_set_user_bpammo(id, item, g_MaxAmmo[item]);
- if(g_weaponRelation[j][MESSAGE][0]) client_print(id, print_chat, "%s", g_weaponRelation[j][MESSAGE]);
- }
- }
- }
- return PLUGIN_HANDLED
- }
- public fw_TakeDamage ( victim, weapon, attacker, Float:damage, damagebits )
- {
- if (!is_user_alive(attacker) || !is_user_alive(victim)) return HAM_IGNORED;
- static weapon_ent;
- weapon_ent = get_pdata_cbase(attacker, 373, 5);
- for(new w = 0; w < g_weaponRelationCount; w++)
- {
- if(is_valid_weapon(weapon_ent, g_weaponRelation[w][KEY]))
- {
- SetHamParamFloat(4, damage * g_weaponRelation[w][POWER] / 100)
- return HAM_IGNORED;
- }
- }
- return HAM_IGNORED;
- }
- // модель в руках у человека
- public ham_item_deploy_post(weapon_ent)
- {
- if(!pev_valid(weapon_ent)) return;
- static id;
- id = get_pdata_cbase(weapon_ent, 41, 4);
- if(!is_user_connected(id)) return;
- new name[32];
- get_user_name(id, name, 31);
- for(new w = 0; w < g_weaponRelationCount; w++)
- {
- if(is_valid_weapon(weapon_ent, g_weaponRelation[w][KEY]))
- for(new z = 0; z < g_maxUser; z++)
- {
- if(is_user_alive(z + 1))
- if(g_User[z][ID_WR])
- if(equal(g_User[z][NAME], name))
- {
- if(g_weaponRelation[w][ID_REL] == g_User[z][ID_WR])
- {
- for(new j = 0; j < g_weaponModelCount; j++)
- {
- if(g_weaponModel[j][ID] == g_weaponRelation[w][MODEL_ID])
- {
- set_pev(id, pev_viewmodel2, g_weaponModel[j][MODEL_V]);
- set_pev(id, pev_weaponmodel2, g_weaponModel[j][MODEL_P]);
- }
- }
- }
- }
- }
- if(is_valid_weapon(weapon_ent, g_weaponRelation[w][KEY]))
- {
- for(new j = 0; j < g_weaponModelCount; j++)
- {
- if(g_weaponModel[j][ID] == g_weaponRelation[w][MODEL_ID])
- {
- set_pev(id, pev_viewmodel2, g_weaponModel[j][MODEL_V]);
- set_pev(id, pev_weaponmodel2, g_weaponModel[j][MODEL_P]);
- }
- }
- }
- }
- }
- public plugin_precache()
- {
- new file[128];
- new szError[64];
- new iErrorCode;
- new szHost[32], szUser[32], szPass[32], szDBname[32];
- cvar_dbHost = register_cvar("weapon_dbHost", "localhost");
- cvar_dbUser = register_cvar("weapon_dbUser", "root");
- cvar_dbPass = register_cvar("weapon_dbPass", "");
- cvar_dbName = register_cvar("weapon_dbName", "weapon_db");
- cvar_roundActive = register_cvar("weapon_roundActive", "4");
- get_configsdir(file, charsmax(file));
- format(file, 127, "%s/weapon_db.cfg", file);
- if(file_exists(file)) server_cmd("exec %s", file);
- else set_fail_state("Конфигурационный файл БД weapon_db не загружен.")
- get_pcvar_string(cvar_dbHost, szHost, 31);
- get_pcvar_string(cvar_dbUser, szUser, 31);
- get_pcvar_string(cvar_dbPass, szPass, 31);
- get_pcvar_string(cvar_dbName, szDBname, 31);
- g_hDBTuple = SQL_MakeDbTuple(szHost, szUser, szPass, szDBname);
- // Проверка соединения с БД
- new Handle:hConnection = SQL_Connect(g_hDBTuple, iErrorCode, szError, 63);
- if( hConnection == Empty_Handle ) set_fail_state(szError);
- // Create table if not exist
- new Handle:hQuery = SQL_PrepareQuery(hConnection, "CREATE TABLE IF NOT EXISTS weapon_name(id INT(11), name varchar(32))");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- hQuery = SQL_PrepareQuery(hConnection, "SELECT * FROM weapon_name");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- new rows = SQL_NumResults(hQuery);
- if(!rows)
- {
- for (new i = 0; i < sizeof g_wName; i++)
- {
- hQuery = SQL_PrepareQuery(hConnection,"INSERT INTO weapon_name(id, name) VALUES('%d','%s')", i+1, g_wName[i])
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- }
- }
- hQuery = SQL_PrepareQuery(hConnection, "CREATE TABLE IF NOT EXISTS weapon_model(id INT(11), model_p varchar(32), model_v varchar(32), model_w varchar(32))");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- hQuery = SQL_PrepareQuery(hConnection, "CREATE TABLE IF NOT EXISTS weapon_relation(name varchar(32), id_model INT(11), id_weapon INT(11), power INT(11)), message varchar(128)");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- hQuery = SQL_PrepareQuery(hConnection, "CREATE TABLE IF NOT EXISTS user_weapon(name varchar(32), id_weapon_relation INT(11))");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- hQuery = SQL_PrepareQuery(hConnection, "CREATE TABLE IF NOT EXISTS user_hparm(name varchar(32), hp INT(11), armor INT(11))");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- hQuery = SQL_PrepareQuery(hConnection, "SELECT * FROM weapon_relation");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- new szData[32];
- new count;
- while(SQL_MoreResults(hQuery))
- {
- g_weaponRelation[count][ID_REL] = SQL_ReadResult(hQuery, 0);
- SQL_ReadResult(hQuery, 1, szData, 31)
- copy(g_weaponRelation[count][WEAPON_NAME], 31, szData);
- g_weaponRelation[count][MODEL_ID] = SQL_ReadResult(hQuery, 2);
- g_weaponRelation[count][WEAPON_ID] = SQL_ReadResult(hQuery, 3);
- g_weaponRelation[count][POWER] = SQL_ReadResult(hQuery, 4);
- g_weaponRelation[count][KEY] = engfunc(EngFunc_AllocString, g_weaponRelation[count][WEAPON_NAME]);
- SQL_ReadResult(hQuery, 5, szData, 31)
- copy(g_weaponRelation[count][MESSAGE], 127, szData);
- SQL_NextRow(hQuery)
- count++;
- }
- g_weaponRelationCount = count;
- new item;
- count = 0;
- new bool:empty;
- model_id = ArrayCreate(1);
- for(new i = 0; i < g_weaponRelationCount; i++)
- {
- empty = true;
- for(new j = 0; j < ArraySize(model_id); j++)
- {
- empty = false;
- //item = ArrayGetCell(model_id, j);
- if(item == g_weaponRelation[i][MODEL_ID])
- {
- break;
- }
- if(j == sizeof(model_id))
- {
- ArrayPushCell(model_id, g_weaponRelation[i][MODEL_ID]);
- }
- }
- if(empty)
- {
- ArrayPushCell(model_id, g_weaponRelation[i][MODEL_ID]);
- }
- // во время перехода регистрируем коды оружий
- //g_keyWeapon[i][KEY] = engfunc(EngFunc_AllocString, g_weaponRelation[i][WEAPON_NAME])
- //copy(g_keyWeapon[i][W_NAME], 31, g_weaponRelation[i][WEAPON_NAME]);
- //formatex(tmp, charsmax(tmp), "sprites/%s.txt", g_weaponRelation[i][WEAPON_NAME]);
- //precache_generic(tmp);
- //register_message(78, "message_weaponlist") // get_user_msgid("WeaponList") не проканает
- }
- count = 0;
- weapon_id = ArrayCreate(1);
- for(new i = 0; i < g_weaponRelationCount; i++)
- {
- empty = true;
- for(new j = 0; j < ArraySize(weapon_id); j++)
- {
- empty = false;
- item = ArrayGetCell(weapon_id, j);
- if(item == g_weaponRelation[i][WEAPON_ID]) break;
- if(j == sizeof(weapon_id) - 1)
- {
- ArrayPushCell(weapon_id, g_weaponRelation[i][WEAPON_ID]);
- count++;
- }
- }
- if(empty)
- {
- ArrayPushCell(weapon_id, g_weaponRelation[i][WEAPON_ID]);
- count++;
- }
- }
- count = 0;
- hQuery = SQL_PrepareQuery(hConnection, "SELECT * FROM weapon_model");
- if( !SQL_Execute(hQuery) )
- {
- SQL_QueryError(hQuery, szError, 63);
- set_fail_state(szError);
- }
- new num;
- while(SQL_MoreResults(hQuery))
- {
- num = SQL_ReadResult(hQuery, 0)
- for(new i = 0; i < sizeof model_id; i++)
- {
- if (num == ArrayGetCell(model_id, i))
- {
- g_weaponModel[count][ID] = num;
- SQL_ReadResult(hQuery, 1, szData, 31);
- copy(g_weaponModel[count][MODEL_P], 31, szData);
- SQL_ReadResult(hQuery, 2, szData, 31);
- copy(g_weaponModel[count][MODEL_V], 31, szData);
- SQL_ReadResult(hQuery, 3, szData, 31);
- copy(g_weaponModel[count][MODEL_W], 31, szData);
- SQL_NextRow(hQuery);
- count++;
- }
- }
- }
- g_weaponModelCount = count;
- for(new i = 0; i < g_weaponModelCount; i++)
- {
- precache_model(g_weaponModel[i][MODEL_P]);
- precache_model(g_weaponModel[i][MODEL_V]);
- precache_model(g_weaponModel[i][MODEL_W]);
- }
- SQL_FreeHandle(hQuery);
- SQL_FreeHandle(hConnection);
- }
- public plugin_end()
- {
- SQL_FreeHandle(g_hDBTuple);
- }
- // утснавливает модель оружия со стороны и в выбрашенном состоянии
- public Fakemeta_SetModel(ent, const ModelStr[])
- {
- if(!pev_valid(ent)) return FMRES_IGNORED;
- new tmp[32];
- for(new j = 0; j < g_weaponRelationCount; j++)
- {
- static weapon_id;
- weapon_id = g_weaponRelation[j][WEAPON_ID];
- format(tmp, 31, "models/w_%s.mdl", g_wModel[weapon_id - 1]);
- if(equal(ModelStr, tmp))
- {
- static entity;
- entity = -1;
- while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", g_wName[weapon_id - 1])))
- {
- if(is_valid_weapon(entity, g_weaponRelation[j][KEY]))
- {
- for(new z = 0; z < g_weaponModelCount; z++)
- {
- if(g_weaponModel[z][ID] == g_weaponRelation[j][MODEL_ID])
- {
- engfunc(EngFunc_SetModel, ent, g_weaponModel[z][MODEL_W]);
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- }
- }
- return FMRES_IGNORED;
- }
- public give_weapon(id, key, name[])
- {
- new Float:Origin[3];
- pev(id, pev_origin, Origin)
- //new wName[32];
- /*new iItem1 = get_pdata_cbase(id, 367 + 2, 5);
- while (pev_valid(iItem1) == 2)
- {
- pev(iItem, pev_classname, wName, 31)
- engclient_cmd(id, "drop", wName)
- iItem1 = get_pdata_cbase(id, 367 + 2, 5);
- }*/
- /*new iItem = get_pdata_cbase(id, 367 + 1, 5); // первый слот оружия
- while (pev_valid(iItem) == 2)
- {
- pev(iItem, pev_classname, wName, 31)
- engclient_cmd(id, "drop", wName)
- iItem = get_pdata_cbase(id, 367 + 1, 5);
- }*/
- new iWeapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, name))
- if(!pev_valid(iWeapon)) return PLUGIN_HANDLED
- dllfunc(DLLFunc_Spawn, iWeapon)
- engfunc(EngFunc_SetOrigin, iWeapon, Origin)
- set_pev(iWeapon, pev_impulse, key)
- new save = pev(iWeapon, pev_solid)
- dllfunc(DLLFunc_Touch, iWeapon, id)
- if( pev(iWeapon, pev_solid) != save )
- return iWeapon;
- engfunc(EngFunc_RemoveEntity, iWeapon)
- return PLUGIN_HANDLED;
- }
- /*
- public client_disconnected(id)
- {
- if (g_loadPlayer[id])
- {
- new szSteamId[ 32 ];
- get_user_authid( id, szSteamId, charsmax( szSteamId ) );
- new szTemp[ 512 ];
- format(szTemp, charsmax(szTemp), "UPDATE `ZPCustumSave` SET `NightVision` = '%i', `PosStats` = '%f', `PosStats2` = '%f', `ColorHud` = '%d', `ZombieSurvive` = '%i', `HumanKills` = '%i', `SurvivorKills` = '%i', `Infections` = '%i', `HumanSurvive` = '%i', `ZombieKills` = '%i', `NemesisKills` = '%i', `NumPack` = '%i' WHERE (`ZPCustumSave`.`steamid` = '%s');",
- g_iColorNightVision[id], g_flShiftHud[id][0], g_flShiftHud[id][1], g_iColorHud[id], g_iZombieSurvive[id], g_iHumanKills[id], g_iSurvivorKills[id], g_iInfections[id], g_iHumanSurvive[id], g_iZombieKills[id], g_iNemesisKills[id], g_numPack[id], szSteamId );
- new arg[1];
- arg[0] = id;
- SQL_ThreadQuery( g_hDBTuple,"SQL_QueryCloseConnection", szTemp, arg, sizeof arg );
- }
- }
- */
- public client_putinserver(id)
- {
- if( is_user_bot(id) || is_user_hltv(id) ) return;
- set_task(1.0, "loadFromDb", MYTASK + id);
- }
- public loadFromDb(taskid)
- {
- new id = ID_MYTASK;
- new name[32];
- new szTemp[512];
- new arg[1];
- arg[0] = id;
- get_user_name(id, name, 31);
- g_User[id - 1][NAME][0] = 0;
- g_User[id - 1][ID_WR] = 0;
- format(szTemp, 511, "SELECT * FROM user_weapon WHERE (`user_weapon`.`name` = '%s')", name);
- SQL_ThreadQuery(g_hDBTuple, "SQL_QueryConnection", szTemp, arg, 1);
- g_User[id - 1][HP] = 0;
- g_User[id - 1][ARMOR] = 0;
- format(szTemp, 511, "SELECT * FROM user_hparm WHERE (`user_hparm`.`name` = '%s')", name);
- SQL_ThreadQuery(g_hDBTuple, "SQL_QueryConnectionHPArmor", szTemp, arg, 1);
- }
- public SQL_QueryConnectionHPArmor( iState, Handle:hQuery, szError[ ], iErrcode, pParameters[], pParametersSize )
- {
- switch( iState )
- {
- case TQUERY_CONNECT_FAILED: log_amx("Load - Could not connect to SQL database. [ %d ] %s", iErrcode, szError );
- case TQUERY_QUERY_FAILED: log_amx(" Load Query failed. [ %d ] %s", iErrcode, szError );
- }
- if( iErrcode )
- {
- log_amx("Error on query: %s",szError);
- return PLUGIN_CONTINUE;
- }
- new pPlayer = pParameters[0];
- new Name[32];
- get_user_name(pPlayer, Name, 31);
- //new szTemp[512];
- new szSteamId[32];
- get_user_authid(pPlayer, szSteamId, 31);
- // if doesn't exist
- if( SQL_NumResults(hQuery) < 1 )
- {
- // create something
- /*
- format(szTemp, charsmax(szTemp), "INSERT INTO `ZPCustumSave`( `steamid`, `NightVision`, `PosStats`, `PosStats2`, `ColorHud`, `ZombieSurvive`, `HumanKills`, `SurvivorKills`, `Infections`, `HumanSurvive`, `ZombieKills`, `NemesisKills`, `NumPack`) VALUES('%s','0','0','0','-1','0','0','0','0','0','0','0','1');", szSteamId );
- g_iColorHud[pPlayer] = -1;
- g_numPack[pPlayer] = 1;
- SQL_FreeHandle(hQuery);
- g_loadPlayer[pPlayer] = 1;
- SQL_ThreadQuery(g_hDBTuple,"SQL_QueryCloseConnection", szTemp, pParameters, 1);
- return PLUGIN_CONTINUE;
- */
- }
- else
- {
- SQL_ReadResult(hQuery, 0, g_User[pPlayer - 1][NAME], 31)
- g_User[pPlayer - 1][HP] = SQL_ReadResult(hQuery, 1)
- g_User[pPlayer - 1][ARMOR] = SQL_ReadResult(hQuery, 2)
- }
- SQL_FreeHandle(hQuery);
- return PLUGIN_CONTINUE;
- }
- public SQL_QueryConnection( iState, Handle:hQuery, szError[ ], iErrcode, pParameters[], pParametersSize )
- {
- switch( iState )
- {
- case TQUERY_CONNECT_FAILED: log_amx("Load - Could not connect to SQL database. [ %d ] %s", iErrcode, szError );
- case TQUERY_QUERY_FAILED: log_amx(" Load Query failed. [ %d ] %s", iErrcode, szError );
- }
- if( iErrcode )
- {
- log_amx("Error on query: %s",szError);
- return PLUGIN_CONTINUE;
- }
- new pPlayer = pParameters[0];
- new Name[32];
- get_user_name(pPlayer, Name, 31);
- //new szTemp[512];
- new szSteamId[32];
- get_user_authid(pPlayer, szSteamId, 31);
- // if doesn't exist
- if( SQL_NumResults(hQuery) < 1 )
- {
- // create something
- /*
- format(szTemp, charsmax(szTemp), "INSERT INTO `ZPCustumSave`( `steamid`, `NightVision`, `PosStats`, `PosStats2`, `ColorHud`, `ZombieSurvive`, `HumanKills`, `SurvivorKills`, `Infections`, `HumanSurvive`, `ZombieKills`, `NemesisKills`, `NumPack`) VALUES('%s','0','0','0','-1','0','0','0','0','0','0','0','1');", szSteamId );
- g_iColorHud[pPlayer] = -1;
- g_numPack[pPlayer] = 1;
- SQL_FreeHandle(hQuery);
- g_loadPlayer[pPlayer] = 1;
- SQL_ThreadQuery(g_hDBTuple,"SQL_QueryCloseConnection", szTemp, pParameters, 1);
- return PLUGIN_CONTINUE;
- */
- }
- else
- {
- //g_iColorNightVision[pPlayer] = SQL_ReadResult(hQuery, 1);
- //SQL_ReadResult(hQuery, 2, g_flShiftHud[pPlayer][0]);
- SQL_ReadResult(hQuery, 0, g_User[pPlayer - 1][NAME], 31)
- g_User[pPlayer - 1][ID_WR] = SQL_ReadResult(hQuery, 1);
- }
- SQL_FreeHandle(hQuery);
- return PLUGIN_CONTINUE;
- }
- public SQL_QueryCloseConnection(iState, Handle:hQuery, szError[], iErrcode, pParameters[], pParametersSize)
- {
- new id = pParameters[0];
- new Name[32];
- get_user_name(id, Name, charsmax(Name));
- switch( iState )
- {
- case TQUERY_CONNECT_FAILED: log_amx("Load - Could not connect to SQL database. [%d] %s", iErrcode, szError);
- case TQUERY_QUERY_FAILED: log_amx("Load Query failed. [ %d ] %s", iErrcode, szError );
- }
- if( iErrcode )
- {
- log_amx("Error on query: %s", szError);
- return PLUGIN_CONTINUE;
- }
- SQL_FreeHandle(hQuery);
- return PLUGIN_CONTINUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement