Callback "OnPlayerSpawn" NOT calling
#1

Hey!


I've ran into a serious, and very weird issue in my SA-MP code, for some reason, when I join the server, and spawn, the callback doesn't fire properly, or I don't even know what, the code placed under the callback isn't firing.


However, sometimes when I spawn after logging in (It's an automatic login system, using IP comparisons), the callback will fire for me, and me only, but for anybody else who joins the server, it will NOT work for them, I have printed debug information to the console, including In-Game messages as-well, below is the code that is executed under OnPlayerSpawn.

This issue is URGENT, and I need help fixing it, not to be offensive, but please respond with great detail and if anybody else has experienced this, I'd love to hear your workarounds for the issue!

pawn Код:
public OnPlayerSpawn(playerid)
{
    printf("[DEBUG] OnPlayerSpawn: Firing Callback now!");
    new count = GetTickCount();
    pInfo[playerid][pSpawned] = 1;
    if(pInfo[playerid][pLogged] == 1)
    {
        format(msg, sizeof(msg), "{FFFFFF}[{FF0000} AdmWarn {FFFFFF}] {A8DBFF}»  {%06x}%s(%i) {FFFFFF}has spawned!", pInfo[playerid][pColor], GetName(playerid), playerid);
        SendMessageToAdmins(COLOR_RED, msg);
        if(UseMySQLSaving == false)
        {
            SCM(playerid, COLOR_RED, "{FFFFFF}[ {FF0000}AdmWarn {FFFFFF}] {A8DBFF}» {ADADAD}The server is currently using it's backup account saving system");
        }
        else
        {
            SCM(playerid, COLOR_RED, "{FFFFFF}[ {FF0000}AdmWarn {FFFFFF}] {A8DBFF}» {ADADAD}The server is currently using the main account saving system.");
        }
    }
    printf("[DEBUG] OnPlayeSpawn: Firing callback tood %d milliseconds", GetTickCount() - count);
    return 1;
}
Reply
#2

It might be your %s in your format msg, do you have a stock for GetName(playerid)? because way back in the day i was messing around with with scripting and i used %s for the first time without getting the players name and all that stuff and my gamemode crashed as soon as i connected to it.

if you do not have it, add this to the bottom of your script:
pawn Код:
stock GetName(playerid)
{
    new ppName[24];
    GetPlayerName(playerid, ppName, 24);
    return ppName;
}
Otherwise I wouldn't know, good luck man!
Reply
#3

It isn't that, I actually just found the issue, it was a problem with my code syntax/setup under the callback "OnPlayerRequestSpawn".


I had placed a function to load the player's skin from my MySQL database, and I realized that the skin loading, half of the time, was either a blank selection(NULL), or if there was a saved skin, it would glitch out during the passage to the next callback, I would assume. I might have fixed the issue, I'll go further into testing it once I have people around to help me.

As for your suggestion, I do have a stock for that, and it's used almost globally, I do know that using it in the way specified, which is exactly like mine is, isn't very efficient, and I will soon replace that method with a better one, when I get the time, and patience to revamp the rest of my code to support the updated method.
Reply
#4

Quote:
Originally Posted by Sgt.TheDarkness
Посмотреть сообщение
It isn't that, I actually just found the issue, it was a problem with my code syntax/setup under the callback "OnPlayerRequestSpawn".


I had placed a function to load the player's skin from my MySQL database, and I realized that the skin loading, half of the time, was either a blank selection(NULL), or if there was a saved skin, it would glitch out during the passage to the next callback, I would assume. I might have fixed the issue, I'll go further into testing it once I have people around to help me.

As for your suggestion, I do have a stock for that, and it's used almost globally, I do know that using it in the way specified, which is exactly like mine is, isn't very efficient, and I will soon replace that method with a better one, when I get the time, and patience to revamp the rest of my code to support the updated method.
Good to hear! good luck in the future !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)