Hooking OnPlayerConnect - 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: Hooking OnPlayerConnect (
/showthread.php?tid=496893)
Hooking OnPlayerConnect -
dominik523 - 24.02.2014
Hey there. I tried to add something to be called under OnPlayerConnect in test include file, and I get some errors and warnings in my gamemode when I include the file. This is my code:
pawn Код:
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MyLib_OnPlayerConnect
public OnPlayerConnect(playerid)
{
#if defined MyLib_OnPlayerConnect
MyLib_OnPlayerConnect(playerid);
#endif
OldPos[playerid][0] = 0.0;
OldPos[playerid][1] = 0.0;
OldPos[playerid][2] = 0.0;
return 1;
}
#if defined MyLib_OnPlayerConnect
forward MyLib_OnPlayerConnect();
#endif
I got this errors and warnings:
Код:
warning 201: redefinition of constant/macro (symbol "OnGameModeInit")
error 021: symbol already defined: "OnPlayerConnect"
error 021: symbol already defined: "OnPlayerConnect"
error 017: undefined symbol "OnPlayerConnect"
error 010: invalid function or declaration
Can someone tell me why this hooking doesn't work?