SA-MP Forums Archive
Problem hook OnPlayerEnterRaceCheckpoint - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem hook OnPlayerEnterRaceCheckpoint (/showthread.php?tid=644028)



Problem hook OnPlayerEnterRaceCheckpoint - 28days - 02.11.2017

Hello, i want use public OnPlayerEnterRaceCheckpoint in file include, i get warning

Код:
warning 200: symbol "_ALS_OnPlayerEnterRaceCheckpoin" is truncated to 31 characters
warning 201: redefinition of constant/macro (symbol "OnPlayerEnterRaceCheckpoint")
I understand that the size of the characters in the name of the function is accustomed to the allowable size.
Here is my code

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
           
//Here inside function code
           #if defined t_OnPlayerEnterRaceCheckpoint
    
return t_OnPlayerEnterRaceCheckpoint(playerid);
    
#else
    
return 1;
    
#endif
}
#if defined t_OnPlayerEnterRaceCheckpoint
    
forward t_OnPlayerEnterRaceCheckpoint(playerid);
#endif
#if defined _ALS_OnPlayerEnterRaceCheckpoint
    #undef OnPlayerEnterRaceCheckpoint
#else
    #define _ALS_OnPlayerEnterRaceCheckpoint
#endif
#define OnPlayerEnterRaceCheckpoint t_OnPlayerEnterRaceCheckpoint 
Do you have any idea how I can intercept?


Re: Problem hook OnPlayerEnterRaceCheckpoint - 10MIN - 02.11.2017

I suggest you to use y_hooks, it is better, easier. (Included in YSI, official and latest version here: https://github.com/Misiur/YSI-Includes)
How a hook looks like:
PHP код:
//top of file
#include <a_samp>
#include <YSI\y_hooks>

//somewhere
hook OnPlayerConnect(playerid)
{
 
//code

The only "downside" is that it needs to be included in every file if you have a modular gamemode.


Re: Problem hook OnPlayerEnterRaceCheckpoint - 28days - 02.11.2017

Quote:
Originally Posted by 10MIN
Посмотреть сообщение
I suggest you to use y_hooks, it is better, easier.
Thanks for the idea, I already thought about using the interception from YSI, if there are no other ways to solve my problem, then I probably have to use this include.


Re: Problem hook OnPlayerEnterRaceCheckpoint - ISmokezU - 02.11.2017

I think you cannot go beyond 31 Chars. Maybe Shortening it could work.

Things like: Player - Ply; Vehicle - Veh; Checkpoint - CP.


Re: Problem hook OnPlayerEnterRaceCheckpoint - BykiLler - 02.11.2017

Use 'Hook Method 7' by ipsBruno.

https://sampforum.blast.hk/showthread.php?tid=570910.


Re: Problem hook OnPlayerEnterRaceCheckpoint - Gammix - 03.11.2017

Replace "RaceCheckpoint" in hooking to "RaceCP" because you cannot have function names bigger than 31 chars.