SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 05/04/2017, 05:35 PM   #36
maddinat0r's Avatar
Join Date: Jun 2010
Location: Germany
Posts: 895
Reputation: 479
Default Re: Gamemode SDK for C/C++ (GDK)

Doing the change Wopss wrote is okay, here's the commit that introduced this.

However I'd suggest you incorporate the source of the MySQL plugin R40 or higher directly into your C++ gamemode. I've redesigned the internal API with the potential usage in a sampgdk gamemode back in my mind. Creating a connection, sending a query and processing the result is as easy as this:
CError<CHandle> handle_error;
Handle_t handle = CHandleManager::Get()->Create(
	"localhost", "root", "pass", "database",
	options, handle_error);

if (handle_error)
	// some error happened
	return 0;

Query_t query = CQuery::Create("SELECT * FROM stuff");
query->OnExecutionFinished([callback](ResultSet_t resultset)
	Result_t result = resultset->GetActiveResult();
	std::string stuff;
	result->GetRowDataByName(0, "fieldname", stuff);
	printf("stuff is %s\n", stuff.c_str());
handle->Execute(CHandle::ExecutionType::PARALLEL, query);
You basically just have to copy over (almost) all plugin source files into your project and link it with the MySQL C connector library. Oh, and your compiler should be C++11-compliant.
maddinat0r is offline   Reply With Quote

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Gamemode is unknown. When i connect theres no gamemode. Shannon_Brown Server Support 11 09/09/2012 08:49 AM
[GameMode] Brasil Drift Show [BDS] - Primeiro GameMode vitorzero3um Português/Portuguese 3 29/02/2012 06:48 PM
[ENG] Ideas for new GameMode [NL] Ideeen voor nieuwe Gamemode Xtreme-Nicole Everything and Nothing 10 10/07/2011 11:20 AM
[ENG] Ideas for new GameMode [NL] Ideeen voor nieuwe GameMode Xtreme-Nicole Help Archive 2 09/07/2011 11:24 AM

All times are GMT. The time now is 01:04 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.