Posts: 561
Threads: 27
Joined: Sep 2012
Hello guys,
I have a problem,
So, the fact is I use OnPLayerUpdate in an include,
So when i define it in the Gamemode as well,
It shows : "OnPlayerUpdate Already defined"
So what should i do ? I can't delete the include..
Can i have an other name of OnPlayerUpdate with same abilities?
Posts: 152
Threads: 6
Joined: Apr 2013
Reputation:
0
remove it from either of them.
I recommend to remove it from include
Posts: 561
Threads: 27
Joined: Sep 2012
C:\Users\acer\Desktop\MAJ CRTFC2 - Copie\gamemodes\GMRPGV1.0.pwn(1606) : error 021: symbol already defined: "HC_OnPlayerUpdate"
?
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
Only once in the include file, not in the gamemode too.
Posts: 561
Threads: 27
Joined: Sep 2012
This what i did in the include :
PHP код:
/* =============================
Limex's Swimming Include
Made by Limex / A
New function:
IsPlayerSwimming(playerid)
New callbacks:
OnPlayerStartSwimming(playerid)
OnPlayerStopSwimming(playerid)
Enjoy!
============================= */
#include <a_samp>
#if defined _ALS_OnPlayerUpdate
#undef OnPlayerUpdate
#else
#define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate HC_OnPlayerUpdate
#if defined HC_OnPlayerUpdate
forward HC_OnPlayerUpdate(playerid);
#endif
new bool:swimming[MAX_PLAYERS];
forward OnPlayerStartSwimming(playerid);
forward OnPlayerStopSwimming(playerid);
forward IsPlayerSwimming(playerid);
#define PUBLIC:%0(%1) forward %0(%1); \
public %0(%1)
public IsPlayerSwimming(playerid)
{
if(swimming[playerid]) return 1;
return 0;
}
PUBLIC:OnPlayerUpdate(playerid)
{
if(GetPlayerAnimationIndex(playerid))
{
new animlib[32];
new animname[32];
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
if(strcmp(animlib, "SWIM", true) == 0 && !swimming[playerid])
{
swimming[playerid] = true;
OnPlayerStartSwimming(playerid);
}
else if(strcmp(animlib, "SWIM", true) != 0 && swimming[playerid] && strfind(animname, "jump", true) == -1)
{
swimming[playerid] = false;
OnPlayerStopSwimming(playerid);
}
}
else if(swimming[playerid])
{
swimming[playerid] = false;
OnPlayerStopSwimming(playerid);
}
#if defined HC_OnPlayerUpdate
return HC_OnPlayerUpdate(playerid);
#else
return 1;
#endif
}
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
Use it exactly as I showed you. ALS must be AFTER the callback not before.
Posts: 561
Threads: 27
Joined: Sep 2012
Could you write me correct my code please ?
Posts: 561
Threads: 27
Joined: Sep 2012
Resolved !
Thanks anyway.