Problem hook OnPlayerEnterRaceCheckpoint
#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

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

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

Use 'Hook Method 7' by ipsBruno.

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)