mysql_pquery question on callback being called.
#1

Hey,

Would the callback remotely be called? because my bans and login system both are in different scripts.

Код:
mysql_pquery(BAN_SQL, string, "OnPlayerDataLoaded", "dd", playerid, g_MysqlRaceCheck[playerid]);
But the callback OnPlayerDataLoaded is another file so would it work remotely or should I call another function here and then call remote function from there.

or should I add this in bans fs.
Код:
native OnPlayerDataLoaded(playerid, race_check);
Reply
#2

Didn't work.
Reply
#3

Try doing this:
Код:
mysql_pquery(BAN_SQL, string, "OnPlayerDataLoaded", "dd", playerid, g_MysqlRaceCheck[playerid]);

forward OnPlayerDataLoaded(playerid, race_check);
public OnPlayerDataLoaded(playerid, race_check)
{
    CallRemoteFunction("OnPlayerDataLoaded", "ii", playerid, race_check);
}
This will theoretically work, but it actually depends on what OnPlayerDataLoaded does in your other script.
Reply
#4

I don't understand why can't you just execute the appropriate queries to that script and need to do it remotely.
If for whatever reason you have, you want to load data to another script than the one you executed the query, you can save the result in memory and pass it to the other script, retrieve data and delete it. I just tested it with different connection handles and different selected databases and there's no problem.

pawn Код:
// gamemode:
mysql_tquery(connection_handle, query, "OnLoadSomething", "");

forward OnLoadSomething();
public OnLoadSomething()
{
    CallRemoteFunction("fs_OnLoadSomething", "i", _: cache_save());
}
pawn Код:
// filterscript:
forward fs_OnLoadSomething(Cache: cache_id);
public fs_OnLoadSomething(Cache: cache_id)
{
    if (!cache_is_valid(cache_id)) return;
   
    cache_set_active(cache_id);

    // cache functions to retrieve..
   
    cache_set_active(Cache: 0);
    cache_delete(cache_id);
}
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I don't understand why can't you just execute the appropriate queries to that script and need to do it remotely.
If for whatever reason you have, you want to load data to another script than the one you executed the query, you can save the result in memory and pass it to the other script, retrieve data and delete it. I just tested it with different connection handles and different selected databases and there's no problem.

pawn Код:
// gamemode:
mysql_tquery(connection_handle, query, "OnLoadSomething", "");

forward OnLoadSomething();
public OnLoadSomething()
{
    CallRemoteFunction("fs_OnLoadSomething", "i", _: cache_save());
}
pawn Код:
// filterscript:
forward fs_OnLoadSomething(Cache: cache_id);
public fs_OnLoadSomething(Cache: cache_id)
{
    if (!cache_is_valid(cache_id)) return;
   
    cache_set_active(cache_id);

    // cache functions to retrieve..
   
    cache_set_active(Cache: 0);
    cache_delete(cache_id);
}
Yep I used that way when I said didn't work. Because I was trying to avoid another public function; this is called when player tries to login and I have a system to keep player logged in if same nick and ip so it shouldn't check after that.

This made me notice i was missing something that would let player rejoin and play again. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)