Raised This Month: $ Target: $400
 0% 

MySQL plugin not work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wach12
New Member
Join Date: Dec 2015
Old 01-29-2016 , 08:55   MySQL plugin not work
Reply With Quote #1

Hello !
I'm creating a plugin who will update records in the database.
This plugin is not working.
Someone help me fix it?

Code:
#include <amxmodx>
#include <sqlx>
#include <colorchat>
#include <core>

new Handle:MySQL;
new ReportReason[32][50];
new Host, User, Pass, Base;
new GetHost[32], GetUser[32], GetPass[32], GetBase[32];

public plugin_init() 
{

	register_plugin("AddPoints", "6.0", "noname");
	
	
	Host = register_cvar("punkty_host", "", FCVAR_PROTECTED|FCVAR_SPONLY);
	User = register_cvar("punkty_user", "", FCVAR_PROTECTED|FCVAR_SPONLY);
	Pass = register_cvar("punkty_pass", "", FCVAR_PROTECTED|FCVAR_SPONLY);
	Base = register_cvar("punkty_base", "", FCVAR_PROTECTED|FCVAR_SPONLY);
	
	
	register_clcmd("say /punkty", "PlayerReasonMenu");
	register_clcmd("say_team /punkty", "PlayerReasonMenu");
	
}

public plugin_cfg()
{

	get_pcvar_string(Host, GetHost, 31);
	get_pcvar_string(User, GetUser, 31);
	get_pcvar_string(Pass, GetPass, 31);
	get_pcvar_string(Base, GetBase, 31);


	MySQL = SQL_MakeDbTuple(GetHost, GetUser, GetPass, GetBase);
	

}



public PlayerReasonMenu(id)
{

	new Menu = menu_create("Ile chcesz wymienic", "PlayerReasonHandle");
	
	menu_additem(Menu, "100 Monet - 1$");
	menu_additem(Menu, "500 Monet - 5$");
	menu_additem(Menu, "1000 Monet - 10$");
	menu_additem(Menu, "2500 Monet - 25$");
	menu_additem(Menu, "5000 Monet - 50$");
	menu_additem(Menu, "10000 Monet - 100$");
	
	menu_setprop(Menu, MPROP_BACKNAME, "Wroc");
	menu_setprop(Menu, MPROP_NEXTNAME, "Dalej");
	menu_setprop(Menu, MPROP_EXITNAME, "Wyjscie");
	
	menu_display(id, Menu);
	
	return PLUGIN_HANDLED;

}

public PlayerReasonHandle(id, Menu, Item)
{
	
	if(Item == MENU_EXIT) 
	{
		
		menu_destroy(Menu);
	
		return PLUGIN_HANDLED;
	
	}
	
	switch(Item)
	{
	
		case 0: ReportReason[id] = "1";
		case 1: ReportReason[id] = "5";
		case 2: ReportReason[id] = "10";
		case 3: ReportReason[id] = "25";
		case 4: ReportReason[id] = "50";
		case 5: ReportReason[id] = "100";
	
	}
	
	menu_destroy(Menu);
	

	AddReportPlayerIframe(id);
	
	return PLUGIN_HANDLED;
	
}


public AddReportPlayerIframe(id)
{

	static Query[512];
	
	new Name[32];


	get_user_name(id, Name, 31);
	
	formatex(Query, 511, "UPDATE report_player WHERE name='%s' SET punkty=punkty + '%s'", Name, ReportReason[id]);
	
	ColorChat(id, GREEN, "SUKCESS.");
	
	
	SQL_ThreadQuery(MySQL, "Query", Query);
	
}


public Query(iFailState, Handle:hQuery, szError[], iError, iData[], iDataSize, Float:fQueueTime) 
{ 

	if(iFailState == TQUERY_CONNECT_FAILED || iFailState == TQUERY_QUERY_FAILED) 
	{
	
		log_amx("%s", szError); 
		
		return;
		
	}
	
}

stock explode(const string[], const character, output[][], const maxs, const maxlen)
{

	new iDo = 0, len = strlen(string), oLen = 0;

	do
	{
	
		oLen += (1+copyc(output[iDo++],maxlen,string[oLen],character));
		
	} while(oLen < len && iDo < maxs);
	
}
__________________
Help Me

Last edited by wach12; 01-29-2016 at 08:59.
wach12 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 09:30.


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