YSI\y_hooks doesn`t work.
#1

Hi, everyone, I've got a simple pawno file with this code:
Код:
hook OnPlayerConnect(playerid) {
	GetPlayerName(playerid, names[playerid], MAX_PLAYER_NAME);
	if(!_HasPlayedBefore(playerid)) {
		// registration
	} else {
		// login
	}
	return SUCCESS;
}
The compiler says everything is correct, unless the y_hooks unique name:
Quote:

player.pwn:150 (error) symbol already defined: "@yH_OnPlayerConnect@005"

And it is weird that there isn't public's with name "OnPlayerConnect", there isn't even any hook, with the same type.
I've also got an #if !defined check. Though it still doesn't work.
And I don't know how to fix it. Any ideas?
Reply
#2

Did you write this function in the same file?
Reply
#3

Quote:
Originally Posted by VVWVV
Посмотреть сообщение
Did you write this function in the same file?
Not even sure, what do you mean. But I've got two main files, gamemode.pwn (contains OnGameModeInit hook that just disables stunt bonuses, default pickups etc) and players.pwn file. I've got only one OnPlayerConnect hook in player.pwn. So there is no reason for two functions have same name.
Reply
#4

Hm... Try to include the library before the function definition.

pawn Код:
#include <YSI\y_hooks>
hook OnPlayerConnect(playerid)
{
    // code..
}
Reply
#5

Quote:
Originally Posted by VVWVV
Посмотреть сообщение
Hm... Try to include the library before the function definition.

pawn Код:
#include <YSI\y_hooks>
hook OnPlayerConnect(playerid)
{
    // code..
}
I don't know how, but it works now, thanks a lot!
Reply
#6

Quote:
Originally Posted by Weline
Посмотреть сообщение
I don't know how, but it works now, thanks a lot!
The library updates the unique number for all functions when you include it again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)