Redefining functions
#1

Hey, im wondering... is it possible to redefine functions ?
Something like this:

pawn Код:
#include <a_samp>

//Renaming Ban to _INCLUDE_ban
#define _INCLUDE_ban Ban
//redefining Ban to another function
#define Ban(%0) CallLocalFunction("OnPlayerGetBanned","i",%0);_INCLUDE_ban(%0)

public OnPlayerConnect(playerid)
{
    Ban(playerid); //testing
    return 1;
}

forward OnPlayerGetBanned(playerid);
public OnPlayerGetBanned(playerid)
{
    return 1;
}
Only this seems to freeze the pawn compiler since it is doing a infinite loop (_INCLUDE_ban probably calls the function Ban again instead of the real one making it calling himself infinite times...)
Reply
#2

It's possible to hook functions. Take a look at this post.
Reply
#3

Quote:
Originally Posted by YJIET
Посмотреть сообщение
It's possible to hook functions. Take a look at this post.
Hmm never knew that trick was also possible with functions... thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)