Major error need help please
#1

There is a error i get when i use crashdetect i dont know why and i dont know what causes it but i compile the GM with debug mode and it tells me the error is unber player disconnect, now to my knowledge i dont see any thing wrong with my OnPlayerDisconnect callback but i will still post both the error i get from crash detect and the OnPlayerDisconnect callback below.

This is the error
PHP код:
[debugRun time error 6"Invalid instruction"
[debug]  Unknown opcode 0x1064330 at address 0x00000039
[debugAMX backtrace:
[
debug#0 00000039 in public OnPlayerDisconnect () at <unknown file>:0 
PHP код:
    SaveChar(playerid);
//    for(new a = 0; a < 10; a++)    if(IsPlayerAttachedObjectSlotUsed(playerid, a)) RemovePlayerAttachedObject(playerid, a);
    
    
new l[56];
    if(
reason == 0) { "TIMED OUT"; }
    if(
reason == 1) { "DISCONNECTED"; }
    if(
reason == 2) { "KICKED / BANNED"; }
    new 
lstr[256];
    
format(lstrsizeof(lstr), "%s has left the server. {F81414}(%s)"GetName(playerid), l);
    
SendClientMessageToAll(0xD4D4D4FF,lstr);
       foreach(
Playeri)
    {
        if (
Specid[i] == playerid && pInfo[i][Spec] == 1)
        {
            
SpecNext(playerid);
            
GameTextForPlayerEx(playerid,"~R~Player ~R~Disconnected",2000,3);
        }
    }
    if(
Duel[playerid] >=2)
    {
        if(
Maderequest[playerid] == 1)
        {
            new 
PID Duelopponent[playerid];
            
SpawnPlayer(PID);
            
KillTimer(UnDuelend[playerid]);
            
KillTimer(UnDuelend[PID]);
            
Duel[PID] = 0;
            
Duelrounds[PID] = 0;
        }
        else if(
Gotrequest[playerid] == 1)
        {
            new 
PID Duelmaker[playerid];
            
SpawnPlayer(PID);
            
KillTimer(UnDuelend[playerid]);
            
KillTimer(UnDuelend[PID]);
            
Duel[PID] = 0;
            
Duelrounds[PID] = 0;
        }
    }
    
ResetVariables(playerid);
       return 
1;

Reply
#2

Recompile your script with debug flags so we can figure out where the error occurs.
Reply
#3

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Recompile your script with debug flags so we can figure out where the error occurs.
It is already compiled in debug mode and it doesn't tell me which line this error is in, thats why i posted incase someone had gotten this issue already and think they know whats the fix for it..
Reply
#4

Quote:

One of possible reasons is a a buffer overflow somewhere in OnPlayerDisconnect callback which overrides the callback return address. Make sure your strings have enough size to hold the data

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
I had this happen to me lol.
It's usually just a missing bracket:
and more...

Multiple reasons for your problem. Can you post the whole callback here?
Reply
#5

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
and more...

Multiple reasons for your problem. Can you post the whole callback here?


Onplayerdisconnect
PHP код:
    SaveChar(playerid);
//    for(new a = 0; a < 10; a++)    if(IsPlayerAttachedObjectSlotUsed(playerid, a)) RemovePlayerAttachedObject(playerid, a);
    
    
new l[56];
    if(
reason == 0) { "TIMED OUT"; }
    if(
reason == 1) { "DISCONNECTED"; }
    if(
reason == 2) { "KICKED / BANNED"; }
    new 
lstr[256];
    
format(lstrsizeof(lstr), "%s has left the server. {F81414}(%s)"GetName(playerid), l);
    
SendClientMessageToAll(0xD4D4D4FF,lstr);
       foreach(
Playeri)
    {
        if (
Specid[i] == playerid && pInfo[i][Spec] == 1)
        {
            
SpecNext(playerid);
            
GameTextForPlayerEx(playerid,"~R~Player ~R~Disconnected",2000,3);
        }
    }
    if(
Duel[playerid] >=2)
    {
        if(
Maderequest[playerid] == 1)
        {
            new 
PID Duelopponent[playerid];
            
SpawnPlayer(PID);
            
KillTimer(UnDuelend[playerid]);
            
KillTimer(UnDuelend[PID]);
            
Duel[PID] = 0;
            
Duelrounds[PID] = 0;
        }
        else if(
Gotrequest[playerid] == 1)
        {
            new 
PID Duelmaker[playerid];
            
SpawnPlayer(PID);
            
KillTimer(UnDuelend[playerid]);
            
KillTimer(UnDuelend[PID]);
            
Duel[PID] = 0;
            
Duelrounds[PID] = 0;
        }
    }
    
ResetVariables(playerid);
       return 
1;

Reply
#6

Try this, I changed few things to improve your script.
Also, can you post GameTextForPlayerEx?

PHP код:
SaveChar(playerid); 
//    for(new a = 0; a < 10; a++)    if(IsPlayerAttachedObjectSlotUsed(playerid, a)) RemovePlayerAttachedObject(playerid, a); 
     
    
new lstr[60]; 
    switch(
reason)
    {
        case 
0format(lstrsizeof(lstr), "%s has left the server. {F81414}(TIMED OUT)"GetName(playerid));
        case 
1format(lstrsizeof(lstr), "%s has left the server. {F81414}(DISCONNECTED)"GetName(playerid));
        case 
2format(lstrsizeof(lstr), "%s has left the server. {F81414}(KICKED / BANNED)"GetName(playerid));
    }
    
SendClientMessageToAll(0xD4D4D4FF,lstr); 
    foreach(
Playeri
    { 
        if (
Specid[i] == playerid && pInfo[i][Spec] == 1
        { 
            
SpecNext(playerid); 
            
GameTextForPlayerEx(playerid,"~R~Player Disconnected",2000,3); 
        } 
    } 
    if(
Duel[playerid] >=2
    { 
        if(
Maderequest[playerid] == 1
        { 
            new 
PID Duelopponent[playerid]; 
            
SpawnPlayer(PID); 
            
KillTimer(UnDuelend[playerid]); 
            
KillTimer(UnDuelend[PID]); 
            
Duel[PID] = 0
            
Duelrounds[PID] = 0
        } 
        else if(
Gotrequest[playerid] == 1
        { 
            new 
PID Duelmaker[playerid]; 
            
SpawnPlayer(PID); 
            
KillTimer(UnDuelend[playerid]); 
            
KillTimer(UnDuelend[PID]); 
            
Duel[PID] = 0
            
Duelrounds[PID] = 0
        } 
    } 
    
ResetVariables(playerid); 
       return 
1

Reply
#7

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Try this, I changed few things to improve your script.
Also, can you post GameTextForPlayerEx?

PHP код:
SaveChar(playerid); 
//    for(new a = 0; a < 10; a++)    if(IsPlayerAttachedObjectSlotUsed(playerid, a)) RemovePlayerAttachedObject(playerid, a); 
     
    
new lstr[60]; 
    switch(
reason)
    {
        case 
0format(lstrsizeof(lstr), "%s has left the server. {F81414}(TIMED OUT)"GetName(playerid));
        case 
1format(lstrsizeof(lstr), "%s has left the server. {F81414}(DISCONNECTED)"GetName(playerid));
        case 
2format(lstrsizeof(lstr), "%s has left the server. {F81414}(KICKED / BANNED)"GetName(playerid));
    }
    
SendClientMessageToAll(0xD4D4D4FF,lstr); 
    foreach(
Playeri
    { 
        if (
Specid[i] == playerid && pInfo[i][Spec] == 1
        { 
            
SpecNext(playerid); 
            
GameTextForPlayerEx(playerid,"~R~Player Disconnected",2000,3); 
        } 
    } 
    if(
Duel[playerid] >=2
    { 
        if(
Maderequest[playerid] == 1
        { 
            new 
PID Duelopponent[playerid]; 
            
SpawnPlayer(PID); 
            
KillTimer(UnDuelend[playerid]); 
            
KillTimer(UnDuelend[PID]); 
            
Duel[PID] = 0
            
Duelrounds[PID] = 0
        } 
        else if(
Gotrequest[playerid] == 1
        { 
            new 
PID Duelmaker[playerid]; 
            
SpawnPlayer(PID); 
            
KillTimer(UnDuelend[playerid]); 
            
KillTimer(UnDuelend[PID]); 
            
Duel[PID] = 0
            
Duelrounds[PID] = 0
        } 
    } 
    
ResetVariables(playerid); 
       return 
1

PHP код:
stock GameTextForPlayerEx(playeridtext[], timestyle)
{
    new 
0len;
    while (
text[i])
    {
        if((
len strfind(text[i],"~",true)) != -1)
        {
           if(
text[i] == '~' && IsValidTag(text[i+1]) && text[i+2] == '~')
           
i+2;
           else
           if(
text[i] == '~')
           {
           
strdel(text[i],len,len+1);
           continue;
           }
        }
        
i++;
    }
    return 
GameTextForPlayer(playeridtexttimestyle);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)