SA-MP Forums Archive
[Tool/Web/Other] [HTML] Online _ALS Generator [Callback and Function] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] [HTML] Online _ALS Generator [Callback and Function] (/showthread.php?tid=487290)



[HTML] Online _ALS Generator [Callback and Function] - Patrick - 12.01.2014

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



Re: [HTML] Online _ALS Generator [Callback and Function] - WopsS - 12.01.2014

Hmm, good generator Great job.


Respuesta: [HTML] Online _ALS Generator [Callback and Function] - DanDRT - 12.01.2014

Great Update


Re: [HTML] Online _ALS Generator [Callback and Function] - Patrick - 12.01.2014

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


Re: [HTML] Online _ALS Generator [Callback and Function] - Krisna - 18.01.2014

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


Re: [HTML] Online _ALS Generator [Callback and Function] - Luis- - 21.01.2014

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


Re: [HTML] Online _ALS Generator [Callback and Function] - Patrick - 21.01.2014

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.


Re: [HTML] Online _ALS Generator [Callback and Function] - Patrick - 21.01.2014

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.


Re: [HTML] Online _ALS Generator [Callback and Function] - Patrick - 21.01.2014

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



Re: [HTML] Online _ALS Generator [Callback and Function] - Y_Less - 21.01.2014

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.


Re: [HTML] Online _ALS Generator [Callback and Function] - Luis- - 21.01.2014

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


Re: [HTML] Online _ALS Generator [Callback and Function] - Misiur - 27.01.2014

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


Re: [HTML] Online _ALS Generator [Callback and Function] - Y_Less - 27.01.2014

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.


Re: [HTML] Online _ALS Generator [Callback and Function] - Misiur - 27.01.2014

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