Modular Programming Help y_hooks
#1

Hi, everyone, im a newbie scripting, i wanna learn to using a modular programming.
first, im learn to convert a example login register from BlueG
BlueG Example Script Cache

i got error like this
Code:
core/player/core.pwn(3) : error 010: invalid function or declaration
core/player/core.pwn(6) : error 010: invalid function or declaration
core/player/core.pwn(8) : error 021: symbol already defined: "GetPlayerName"
core/player/core.pwn(11) : error 021: symbol already defined: "mysql_format"
core/player/core.pwn(13) : error 010: invalid function or declaration
core/player/core.pwn(16) : error 010: invalid function or declaration
... and much more like invalid function or declaration
code at core/player/core.pwn
Code:
#include <YSI\y_hooks>

hook OnPlayerConnect(playerid) { // this is line 3
    g_RaceCheck[playerid]++;
    static const empty_data[E_PLAYER_DATA];
    pinfo[playerid] = empty_data; // line 6

    GetPlayerName(playerid, pinfo[playerid][pName], MAX_PLAYER_NAME); // 8

    new query[110];
    mysql_format(g_SQL, query, sizeof query, "SELECT `id`, `username`, `password`, `salt` FROM `players` WHERE `username` = '%e' LIMIT 1", pinfo[playerid][pName]); // line 11
    mysql_tquery(g_SQL, query, "OnPlayerDataCheck", "dd", playerid, g_RaceCheck[playerid]);
    return 1; // line 13
}

hook OnPlayerDisconnect(playerid, reason) { // 16
    g_RaceCheck[playerid]++;
    OnPlayerDataSave(playerid, reason);

    if(cache_is_valid(pinfo[playerid][CacheID]) {
        cache_delete(pinfo[playerid][CacheID]);
        pinfo[playerid][CacheID] = MYSQL_INVALID_CACHE;
    }
    if(pinfo[playerid][pLoginTimer]) {
        KillTimer(pinfo[playerid][pLoginTimer]);
        pinfo[playerid][pLoginTimer] = 0;
    }
    pinfo[playerid][pIsLogged] = false;
    return 1;
}
so, the question.
1. why i got a error, how to fix this error.
2. what difference if am using a \ or / on #include "core\player\core.pwn" or ... "core/player/core.pwn"
Reply


Messages In This Thread
Modular Programming Help y_hooks - by kloning1 - 09.05.2020, 12:43
Re: Modular Programming Help y_hooks - by Calisthenics - 09.05.2020, 13:20
Re: Modular Programming Help y_hooks - by kloning1 - 09.05.2020, 14:48
Re: Modular Programming Help y_hooks - by Calisthenics - 09.05.2020, 14:51
Re: Modular Programming Help y_hooks - by kloning1 - 09.05.2020, 14:57
Re: Modular Programming Help y_hooks - by Calisthenics - 09.05.2020, 15:07

Forum Jump:


Users browsing this thread: 2 Guest(s)