Strange problem
#1

Hello everyone, I've noticed some weird things in my chatlogs I'll display it for better understanding.

This is what comes up in the logs:

Код:
[31/05/2017 15:21:24]  leveled up (level 282)
It looks like it levels up an ID that is not connected, I kill the timers upon disconnect. There are more of these random level up logs, I just can't find the source of it.

And this is the code:

pawn Код:
forward UpdatePlayer(playerid);
public UpdatePlayer(playerid)
{
    if(!IsPlayerConnected(playerid)) return 1;
    UpdateBars(playerid);
    UpdatePlayingTime(playerid);
    if(PlayerInfo[playerid][pExp] >= 100)
    {
        new string[128];
        PlayerInfo[playerid][pExp] = 0;
        PlayerInfo[playerid][pLevel] ++;
        SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
        SetProgressBarValue(Exp[playerid], 0);
        UpdateProgressBar(Exp[playerid], playerid);
        SendClientMessage(playerid, COLOR_ORANGE, "** {FFFFFF}Congratulations, you leveled up!{FF8000} **");
        format(string, sizeof(string), "%s leveled up (level %d)", GPN(playerid), PlayerInfo[playerid][pLevel]);
        ChatLog(string, "chatlog.txt");
    }
    return 1;
}
Reply
#2

Do you have any NPC? Show us the GPN function.
Reply
#3

pawn Код:
GPN(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
I only use actors, no NPC's yet but I'm considering on adding them one day.

In the game nobody made it up to level 100+ yet
Reply
#4

You have this if-then in the function "if(!IsPlayerConnected(playerid)) return 1;". So the player is obviously connected to the server.

The issue is indeed weird, there's probably an issue with you GPN function (an underscore only name?). Include the player ID passed to the function and report back...
Reply
#5

Hmm, change
Код:
if(!IsPlayerConnected(playerid)) return 1;
for
Код:
if(!IsPlayerConnected(playerid)) return KillTimer(the handler of that function's timer[playerid]);
And test for changes.
Reply
#6

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Hmm, change
Код:
if(!IsPlayerConnected(playerid)) return 1;
for
Код:
if(!IsPlayerConnected(playerid)) return KillTimer(the handler of that function's timer[playerid]);
And test for changes.
The function should not continue if the player isn't connected either way, so that's no his issue.
Reply
#7

Tried displaying the actual ID but it doesn't display that either. I tried returning it with the killtimer as well.

Код:
[31/05/2017 21:58:39]  leveled up (level 284) 
[31/05/2017 22:02:35] ****_**** joined 
[31/05/2017 22:03:16] Tony(0) leveled up (level 28)
Reply
#8

Quote:
Originally Posted by TonyII
Посмотреть сообщение
Tried displaying the actual ID but it doesn't display that either. I tried returning it with the killtimer as well.

Код:
[31/05/2017 21:58:39]  leveled up (level 284) 
[31/05/2017 22:02:35] ****_**** joined 
[31/05/2017 22:03:16] Tony(0) leveled up (level 28)
The parenthesis should show regardless of the id not showing (though it should also show - at least a zero), so the actual issue is not even coming from the timer "UpdatePlayer".

Search for other chat logs that say "leveled up".
Reply
#9

It seems an invisible player joined with a blank name, it's totally weird, as of it bypasses the player connected check. BTW, try restarting the server and check if the problem still persists.
Reply
#10

Quote:
Originally Posted by ShihabSoft
Посмотреть сообщение
It seems an invisible player joined with a blank name, it's totally weird, as of it bypasses the player connected check. BTW, try restarting the server and check if the problem still persists.
No... Like I said, the text format is different.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)