SA-MP Forums Archive
How to make an include? - 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: How to make an include? (/showthread.php?tid=673663)



How to make an include? - Calinut200 - 01.04.2020

Helo! i make an simple include to test something and i have a error
PHP Code:
#if defined _admin_included
    #endinput
#endif
#define _admin_included
 
#tryinclude <a_samp>
public OnPlayerConnect(playerid)
{
    
SendClientMessage(playerid, -1"Helo bro");
    return 
1;

I get this error in my gamemode, the include is included with #include <admin>
PHP Code:
C:\Users\Calinacho\Desktop\server  samp\gamemodes\test.pwn(244) : error 021symbol already defined"SSCANF_OnPlayerConnect" 



Re: How to make an include? - DRIFT_HUNTER - 01.04.2020

You need to hook OnPlayerConnect function.


Re: How to make an include? - Calinut200 - 01.04.2020

Quote:
Originally Posted by DRIFT_HUNTER
View Post
You need to hook OnPlayerConnect function.
How to make that? I'm new in this include


Re: How to make an include? - rzrusu - 01.04.2020

Quote:
Originally Posted by Calinut200
View Post
How to make that? I'm new in this include
Take a look here:
https://sampforum.blast.hk/showthread.php?tid=574534

Here's a simple example of a callback hook:

PHP Code:
public OnPlayerConnect(playerid)
{
    
#if defined MyLib_OnPlayerConnect
        
MyLib_OnPlayerConnect(playerid);
    
#endif
    
return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MyLib_OnPlayerConnect
#if defined MyLib_OnPlayerConnect
    
forward MyLib_OnPlayerConnect(playerid);
#endif