SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/05/2017, 01:45 AM   #361
TheRealSphinx
Little Clucker
 
TheRealSphinx's Avatar
 
Join Date: Nov 2016
Posts: 21
Reputation: 12
Default Re: Gamemode SDK for C/C++ (GDK)

Quote:
Originally Posted by WopsS View Post
Hello,

I want to leave a response here about Streamer with SAMPGDK. You can use it as xeeZ said here, but you don't need to invoke Streamer_CallbackHook since it is deprecated in version 2.7.8.

Why?
Because Incognito decided to use SAMPGDK for OnPlayerConnect and OnPlayerDisconnect.

All you need to do is to invoke CreateDynamicObject as xeeZ do in his gist.
Code:
int CreateDynamicObject(int modelid, float x, float y, float z, float rx, float ry, float rz, int worldid = -1, int interiorid = -1, int playerid = -1, float streamdistance = 200.0, float drawdistance = 0.0)
{
  static AMX_NATIVE native = sampgdk::FindNative("CreateDynamicObject");
  return sampgdk::InvokeNative(native, "iffffffiiiff", modelid, x, y, z, rx, ry, rz, worldid, interiorid, playerid, streamdistance, drawdistance);
}
And then call it.

Now, I want to know your opinion. If we want to use Streamer with SAMPGDK it is better to invoke a native (like the method above) or to combine streamer plugin with our project (which will be a pain in the a** with plugin updates and with the combination)?

By the way, can we register a Streamer's callback in our plugins?
I tried this
Code:
SAMPGDK_CALLBACK(bool, OnPlayerEditDynamicObject(int playerid, int  objectid, int  response, float x, float y, float z, float rx, float ry, float rz));
SAMPGDK_CALLBACK(bool, OnPlayerSelectDynamicObject(int playerid, int objectid, int modelid, float x, float y, float z));

PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerEditDynamicObject(int playerid, int  objectid, int  response, float x, float y, float z, float rx, float ry, float rz)
{
	sampgdk::logprintf("OnPlayerEditDynamicObject: %i | %f | %f | %f", objectid, x, y, z);
	return true;
}

PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerSelectDynamicObject(int playerid, int objectid, int modelid, float x, float y, float z)
{
	sampgdk::logprintf("OnPlayerSelectDynamicObject: %i | %f | %f | %f", objectid, x, y, z);
	return true;
}
And this functions aren't called, instead OnPlayerEditObject is called. If I edit an object.
Hi,

you can use this streamer version that supports direct implementation of the streamer in the gamemode.
Then you just need to call the events in your gamemode.

All needed events are listed in the header file.
https://github.com/Sphinxila/samp-pl...r/streamer.hpp

I think its self explanatory.
Feel free to use it or just ignore it ^^.

I rewrote this just for my usage cause "InvokeNative"...
It's not the point of using the SampGDK.

Kind regards
Sphinx
TheRealSphinx is offline   Reply With Quote
Old 17/07/2018, 05:07 PM   #362
ChronosX
Little Clucker
 
ChronosX's Avatar
 
Join Date: Dec 2017
Location: Russia, Volgograd
Posts: 1
Reputation: 0
Default Re: Gamemode SDK for C/C++ (GDK)

Zeex, I have one question. I really want to write my gamemode using SampGDK. But, as I understand, third-party plug-ins (such as Streamer, sscanf, mxINI, etc.) Can not be inserted into the GM simply #include "*plugin*", because the syntax of header files is incompatible with C++. How can I port it then?
__________________
SAMP 4EVER!!!
ChronosX is offline   Reply With Quote
Old 17/07/2018, 05:42 PM   #363
J0sh...
High-roller
 
J0sh...'s Avatar
 
Join Date: Aug 2014
Location: Hamburger
Posts: 1,274
Reputation: 389
Default Re: Gamemode SDK for C/C++ (GDK)

https://github.com/IstuntmanI/samp-s...sampgdk-invoke for streamer (or just port it).
sscanf is already supplied in C.
mxINI... create your own INI parser or find one on github, there's tons.
__________________
🍔🍔🍔🍔🍔🍔🍔🍔🍔🍔🍔🍔
Yes I know my name has 3 dots.
Thanks for noticing, it was meant to signify a pause in the personal message asking to be named J0sh but they got included.
J0sh... is offline   Reply With Quote
Old 17/07/2018, 06:40 PM   #364
BigETI
High-roller
 
BigETI's Avatar
 
Join Date: Mar 2010
Location: Germany
Posts: 999
Reputation: 322
Default Re: Gamemode SDK for C/C++ (GDK)

Quote:
Originally Posted by Freshncool View Post
https://github.com/IstuntmanI/samp-s...sampgdk-invoke for streamer (or just port it).
sscanf is already supplied in C.
mxINI... create your own INI parser or find one on github, there's tons.
There should be ways to link streamer function with your library.
In C++ there are better ways to interpret command arguments, without ever touching sscanf from the standard C library.
BigETI is offline   Reply With Quote
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


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 05:57 AM.


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