[Include] OnPlayerClickPlayer (Extended)
#7

@Dutheil: AttachDynamicObjectToPlayer requires YSF to work, because by default there's no AttachPlayerObjectToPlayer (internally, streamer's dynamic objects are player objects) and YSF added that function. For it to work without YSF, global objects would need to be used. This should be specified in the main post. Anyway, nice idea about this include.

Also:
Код:
#tryinclude <streamer>
#if !defined Streamer_IncludeFileVersion
    #error This include needs streamer plugin
#endif
wouldn't it be better to just use #include <streamer> and let the compiler warn by default if there's no streamer.inc file ? You just replaced its job.

Also, you may want to change this:
Код:
CallLocalFunction("OnPlayerClickPlayer", "ddd", playerid, targetid, CLICK_SOURCE_SKIN);
into this:
Код:
#if defined OnPlayerClickPlayer
    OnPlayerClickPlayer(playerid, targetid, CLICK_SOURCE_SKIN);
#endif
(this is a precompiler trick, if there's a OnPlayerClickPlayer defined anywhere in the current script (even after the include) then it will be called directly, as CallLocalFunction is slower) but shouldn't it be called in every script ? So you should probably use CallRemoteFunction. But the problem here is that CLICK_SOURCE_SKIN would be unknown in other scripts which aren't using this include.

Additionally, for every script that is using this include it looks like other dynamic objects will be created and attached to the player, which isn't fine. It's a mess to provide support for multiple scripts using an include like this, but they should work just fine without optimisation problems.

@Gammix: There's no limit with YSF+Streamer Plugin's AttachDynamicObjectToPlayer (well, the maximum VISIBLE [not the total amount of objects] objects for a player is still MAX_OBJECTS, but you can create an infinite amount of objects like that, or until your RAM is fully used). If using the regular CreateObject, then the limit would be MAX_OBJECTS. The limit of 10 you were talking about are the player attachable objects which are a special kind of objects, they aren't using the regular object pool.
Reply


Messages In This Thread
OnPlayerClickPlayer (Extended) - by Dutheil - 26.03.2018, 08:28
Re: OnPlayerClickPlayer (Extended) - by X337 - 26.03.2018, 08:36
Re: OnPlayerClickPlayer (Extended) - by Dutheil - 26.03.2018, 10:08
Re: OnPlayerClickPlayer (Extended) - by Gammix - 27.03.2018, 12:49
Re: OnPlayerClickPlayer (Extended) - by Ben666 - 27.03.2018, 13:01
Re: OnPlayerClickPlayer (Extended) - by Gammix - 27.03.2018, 13:03
Re: OnPlayerClickPlayer (Extended) - by IstuntmanI - 27.03.2018, 14:41
Re: OnPlayerClickPlayer (Extended) - by Gammix - 27.03.2018, 15:10
Re: OnPlayerClickPlayer (Extended) - by Chaprnks - 27.03.2018, 23:01
Re: OnPlayerClickPlayer (Extended) - by Abagail - 28.03.2018, 00:59
Re: OnPlayerClickPlayer (Extended) - by NaS - 28.03.2018, 08:45
Re: OnPlayerClickPlayer (Extended) - by Dayrion - 28.03.2018, 09:45
Re: OnPlayerClickPlayer (Extended) - by Romz - 28.03.2018, 10:42

Forum Jump:


Users browsing this thread: 3 Guest(s)