Zeex / sampgdk

Write SA-MP gamemodes in C/C++
http://zeex.github.io/sampgdk
Apache License 2.0
153 stars 83 forks source link

Have not NPC callbacks #198

Closed MeFFoS closed 6 years ago

MeFFoS commented 6 years ago

Have not NPC callbacks: NPC:OnClientMessage NPC:OnPlayerDeath NPC:OnPlayerStreamIn NPC:OnPlayerStreamOut NPC:OnPlayerText NPC:OnRecordingPlaybackEnd NPC:OnVehicleStreamIn NPC:OnVehicleStreamOut http://wiki.sa-mp.com/wiki/Category:Scripting_Callbacks

IstuntmanI commented 6 years ago

As far as I know, those callbacks are called only in scripts placed in npcmodes. sampGDK catches only callbacks that are called in the gamemode, not sure. But yeah, this should be addressed somehow, maybe an overload for every callback to also include the AMX pointer as an argument before the rest of callback's arguments, if possible. Maybe this plugin should also register some AMX native to help us to identify each script's pointer if overloads like those would be made.

An example using OnPlayerConnect, sampGDK should declare two callbacks: The regular

int OnPlayerConnect( int playerid );

and an overload

int OnPlayerConnect( AMX * amx, int playerid );

or maybe have this available only in OnPublicCall ? :man_shrugging:

Also, the function to be called from every script could look like

native GDK_PingScript( name[ ] );

which could be used like

// in GM:
public OnGameModeInit( )
{
    GDK_PingScript( "gamemode" );
}

// in some FS:
public OnFilterScriptInit( )
{
    GDK_PingScript( "my_first_fs" );
}

and some

void OnScriptPing( AMX * amx, const char name[ ] );

could be called by the sampGDK in the plugin.