[Tool/Web/Other] [HTML] Online _ALS Generator [Callback and Function]
#1

Download
Pastebin: http://pastebin.com/1x7b6Hxr

Sample Website
http://pds2k12.ml/ALS_Generator/

Credits
DanDRT - Creator
pds2k12 - Updater
Y_Less - Tutorial
ipsBruno - Technique

Callback Hooking
Input
pawn Code:
Callback: OnPlayerConnect
Params: playerid
Prefix: pds
Output
pawn Code:
public OnPlayerConnect(playerid)
{
    //Your code here
    //Call the new version and check if the definition does exist.
    #if defined pds_OnPlayerConnect
        pds_OnPlayerConnect(playerid);
    #endif
    return true;
}

//Has this been hooked already?
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect  
#else
    #define _ALS_OnPlayerConnect
#endif

//Reroute future calls to our function.
#define OnPlayerConnect pds_OnPlayerConnect

//To make sure there is no undefined error. we check if its defined.
#if defined pds_OnPlayerConnect
    forward pds_OnPlayerConnect(playerid);
#endif
Function Hooking
Input
pawn Code:
Function: GivePlayerMoney
Params: playerid, amount
Prefix: pds
Output
pawn Code:
stock pds_GivePlayerMoney(playerid, amount)
{
    //Your code here
    //Call the old version, no need to check if it exists.
    GivePlayerMoney(playerid, amount);
    return true;
}

//Has this been hooked already?
#if defined _ALS_GivePlayerMoney
    #undef GivePlayerMoney  
#else
    #define _ALS_GivePlayerMoney
#endif
//Reroute future calls to our function.
#define GivePlayerMoney pds_GivePlayerMoney
Reply
#2

Hmm, good generator Great job.
Reply
#3

Great Update
Reply
#4

Quote:
Originally Posted by WopsS
View Post
Hmm, good generator Great job.
Quote:
Originally Posted by DanDRT
View Post
Great Update
Thanks!
Reply
#5

nice generator !!
and your domain from freenom.com right ? :3
.ml = making love
HAHAHAH JUST KIDDING
Reply
#6

What is the "pds" thing for if you don't mind me asking?
Reply
#7

Quote:
Originally Posted by Luis-
View Post
What is the "pds" thing for if you don't mind me asking?
pds is an example prefix on the website, anyways you can change it to what ever you want.

PDS = My full name in shortcut.
Reply
#8

Quote:
Originally Posted by Y_Less
View Post
pawn Code:
//codes
Should be:

pawn Code:
//code
The current version will get stuck in a loop.
Oh-shit!, on the website the code is fine but I forgot to update the code in the download link, thanks for pointing that out! also updated my example code.
Reply
#9

Quote:
Originally Posted by Y_Less
View Post
In that case:

pawn Code:
//code
That doesn't actually call the old version.
Fuck, #Fail forgot to add GivePlayerMoney(...), once again thank you for pointing that out.

UPDATED
  • Fixed the download link.
  • Fixed the function hooking, it does call the old version now.
  • Fixed the callback hooking, it does get stuck on the loop anymore.
  • Sample website has been updated to its newest.
Reply
#10

Sorry, I should report these all at once:

pawn Код:
public Hooked_OnPlayerText(playerid, text[])
{
    //Your code here
    //Call the new version and check if the definition does exist.
    #if defined Hooked_OnPlayerText
        OnPlayerText(playerid, text[]);
    #endif
    return true;
}

//Has this been hooked already?
#if defined _ALS_OnPlayerText
    #undef OnPlayerText  
#else
    #define _ALS_OnPlayerText
#endif

//Reroute future calls to our function.
#define OnPlayerText Hooked_OnPlayerText

//To make sure there is no undefined error. we check if its defined.
#if defined Hooked_OnPlayerText
    forward Hooked_OnPlayerText(playerid, text[]);
#endif
Syntax error on the next call line. Same if you do "const text[]".

Also:

pawn Код:
stock Hooked_strcat(dest[], source[], maxlength = sizeof (dest))
{
    //Your code here
    //Call the old version, no need to check if it exists.
    strcat(dest[], source[], maxlength = sizeof (dest));
    return true;
}

//Has this been hooked already?
#if defined _ALS_strcat
    #undef strcat  
#else
    #define _ALS_strcat
#endif
//Reroute future calls to our function.
#define strcat Hooked_strcat
I do hope you can fix these issues! It looks like a useful tool.
Reply
#11

Quote:
Originally Posted by pds2k12
View Post
pds is an example prefix on the website, anyways you can change it to what ever you want.

PDS = My full name in shortcut.
Ah, I see. Anyway, thanks
Reply
#12

For you sublime users, grab my snippet for functions - gist link. Feel free to fork and update
Reply
#13

Quote:
Originally Posted by Misiur
Посмотреть сообщение
For you sublime users, grab my snippet for functions - gist link. Feel free to fork and update
That has the same problem I mentioned in my last post.
Reply
#14

I'm aware of that, but if you like tabbing a little more: updated
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)