weird bug / crash by native SendClientMessage
#1

weird? Look backtrace...


Quote:

[10/08/12 16:48:30] [debug] Server crashed while executing BSL2.amx

[10/08/12 16:48:30] [debug] Backtrace:

[10/08/12 16:48:30] [debug] #0 native SendClientMessage () from bsl

[10/08/12 16:48:30] [debug] #1 000ff214 in public ProxDetector (Float:radi=30.00000, playerid=9, string[]=@0x0008b018 "Easy_Job trocou a r", col1=-1029514497, col2=-1029514497, col3=-1029514497, col4=-1029514497, col5=-1029514497) at C:\BSL\BSL 2.1\gamemodes\BSL2.pwn:8473

[10/08/12 16:48:30] [debug] #2 00094098 in public QdoResponderDialogNikoRadio (playerid=9, dialogid=88, response=1, listitem=95, inputtext[]=@0x0095af50 "") at Radio_System.pwn:84

[10/08/12 16:48:30] [debug] #3 00329794 in public S@@_OnDialogResponse (playerid=9, dialogid=88, response=1, listitem=95, inputtext[]=@0x0095af50 "", ... <1 variable argument>) at C:\BSL\BSL 2.1\gamemodes\BSL2.pwn:42901

[10/08/12 16:48:30] [debug] #4 native CallLocalFunction () from bsl

[10/08/12 16:48:30] [debug] #5 0001b730 in public OnDialogResponse (playerid=9, dialogid=88, response=1, listitem=95, inputtext[]=@0x0095aea0 "") at C:\sampserver\pawno\include\YSI\internal\y_dohooks .inc:3349

my ProxDetector:
PHP Code:
public ProxDetector(Float:radiplayeridstring[],col1,col2,col3,col4,col5)
{
    if(
IsPlayerConnected(playerid) && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
    {
        new 
Float:posxFloat:posyFloat:posz;
        new 
Float:oldposxFloat:oldposyFloat:oldposz;
        new 
Float:tempposxFloat:tempposyFloat:tempposz;
        
GetPlayerPos(playeridoldposxoldposyoldposz);
        
//radi = 2.0; //Trigger Radius
        
foreach(Playeri)
            if(
GetPlayerInterior(playerid) == GetPlayerInterior(i))
                if(!
BigEar[i])
                {
                    
GetPlayerPos(iposxposyposz);
                    
tempposx = (oldposx -posx);
                    
tempposy = (oldposy -posy);
                    
tempposz = (oldposz -posz);
                    if(((
tempposx floatdiv(radi,16)) && (tempposx > -floatdiv(radi,16))) && ((tempposy floatdiv(radi,16)) && (tempposy > -floatdiv(radi,16))) && ((tempposz floatdiv(radi,16)) && (tempposz > -floatdiv(radi,16))))
                    {
                        
SendClientMessage(icol1string); // <- this line makes the crash
                    
}
                    else if(((
tempposx floatdiv(radi,8)) && (tempposx > -floatdiv(radi,8))) && ((tempposy floatdiv(radi,8)) && (tempposy > -floatdiv(radi,8))) && ((tempposz floatdiv(radi,8)) && (tempposz > -floatdiv(radi,8))))
                    {
                        
SendClientMessage(icol2string);
                    }
                    else if(((
tempposx floatdiv(radi,4)) && (tempposx > -floatdiv(radi,4))) && ((tempposy floatdiv(radi,4)) && (tempposy > -floatdiv(radi,4))) && ((tempposz floatdiv(radi,4)) && (tempposz > -floatdiv(radi,4))))
                    {
                        
SendClientMessage(icol3string);
                    }
                    else if(((
tempposx floatdiv(radi,2)) && (tempposx > -floatdiv(radi,2))) && ((tempposy floatdiv(radi,2)) && (tempposy > -floatdiv(radi,2))) && ((tempposz floatdiv(radi,2)) && (tempposz > -floatdiv(radi,2))))
                    {
                        
SendClientMessage(icol4string);
                    }
                    else if(((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
                    {
                        
SendClientMessage(icol5string);
                    }
                }
                else
                {
                    
SendClientMessage(icol1string);
                }
    }
    return 
1;

when and how it has been called:
PHP Code:
        format(thestringsizeof(thestring), "%s trocou a rбdio do veнculo para a %s"Player[playerid][pName], DOF2_GetString(arquivo,endereco));
        
ProxDetector(30.0playeridthestringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); 
anyone has any idea how to fix?
Is it really a bug from sa:mp ?
I'm using centOS, 64bits, dedicated server, samp 0.3e R2
thank you
Reply
#2

Yet another godfather edit, why am I not surprised? If the code size message comes up when compiling your GM then that may be the cause.
Reply
#3

Try

pawn Code:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid) && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        new result[128];format(result, 128, "%s", string);
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        //radi = 2.0; //Trigger Radius
        foreach(Player, i)
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i))
                if(!BigEar[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    if(((tempposx < floatdiv(radi,16)) && (tempposx > -floatdiv(radi,16))) && ((tempposy < floatdiv(radi,16)) && (tempposy > -floatdiv(radi,16))) && ((tempposz < floatdiv(radi,16)) && (tempposz > -floatdiv(radi,16))))
                    {
                        SendClientMessage(i, col1, result); // <- this line makes the crash
                    }
                    else if(((tempposx < floatdiv(radi,8)) && (tempposx > -floatdiv(radi,8))) && ((tempposy < floatdiv(radi,8)) && (tempposy > -floatdiv(radi,8))) && ((tempposz < floatdiv(radi,8)) && (tempposz > -floatdiv(radi,8))))
                    {
                        SendClientMessage(i, col2, result);
                    }
                    else if(((tempposx < floatdiv(radi,4)) && (tempposx > -floatdiv(radi,4))) && ((tempposy < floatdiv(radi,4)) && (tempposy > -floatdiv(radi,4))) && ((tempposz < floatdiv(radi,4)) && (tempposz > -floatdiv(radi,4))))
                    {
                        SendClientMessage(i, col3, result);
                    }
                    else if(((tempposx < floatdiv(radi,2)) && (tempposx > -floatdiv(radi,2))) && ((tempposy < floatdiv(radi,2)) && (tempposy > -floatdiv(radi,2))) && ((tempposz < floatdiv(radi,2)) && (tempposz > -floatdiv(radi,2))))
                    {
                        SendClientMessage(i, col4, result);
                    }
                    else if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, result);
                    }
                }
                else
                {
                    SendClientMessage(i, col1, result);
                }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Vince
View Post
Yet another godfather edit, why am I not surprised? If the code size message comes up when compiling your GM then that may be the cause.
You should know, doesn't matter if it is a godfather edit or anything else, the samp native should work the same way
Btw I didn't understand what u meant




Quote:
Originally Posted by Makaveli93
View Post
Try

pawn Code:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid) && GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        new result[128];format(result, 128, "%s", string);
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        //radi = 2.0; //Trigger Radius
        foreach(Player, i)
            if(GetPlayerInterior(playerid) == GetPlayerInterior(i))
                if(!BigEar[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    if(((tempposx < floatdiv(radi,16)) && (tempposx > -floatdiv(radi,16))) && ((tempposy < floatdiv(radi,16)) && (tempposy > -floatdiv(radi,16))) && ((tempposz < floatdiv(radi,16)) && (tempposz > -floatdiv(radi,16))))
                    {
                        SendClientMessage(i, col1, result); // <- this line makes the crash
                    }
                    else if(((tempposx < floatdiv(radi,8)) && (tempposx > -floatdiv(radi,8))) && ((tempposy < floatdiv(radi,8)) && (tempposy > -floatdiv(radi,8))) && ((tempposz < floatdiv(radi,8)) && (tempposz > -floatdiv(radi,8))))
                    {
                        SendClientMessage(i, col2, result);
                    }
                    else if(((tempposx < floatdiv(radi,4)) && (tempposx > -floatdiv(radi,4))) && ((tempposy < floatdiv(radi,4)) && (tempposy > -floatdiv(radi,4))) && ((tempposz < floatdiv(radi,4)) && (tempposz > -floatdiv(radi,4))))
                    {
                        SendClientMessage(i, col3, result);
                    }
                    else if(((tempposx < floatdiv(radi,2)) && (tempposx > -floatdiv(radi,2))) && ((tempposy < floatdiv(radi,2)) && (tempposy > -floatdiv(radi,2))) && ((tempposz < floatdiv(radi,2)) && (tempposz > -floatdiv(radi,2))))
                    {
                        SendClientMessage(i, col4, result);
                    }
                    else if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, result);
                    }
                }
                else
                {
                    SendClientMessage(i, col1, result);
                }
    }
    return 1;
}
Hum, shouldn't better 144 instead of 128 ?

but do you really think a long string could crash a server?
Reply
#5

Quote:
Originally Posted by dudaefj
View Post
You should know, doesn't matter if it is a godfather edit or anything else, the samp native should work the same way
Btw I didn't understand what u meant
I mean this:



If that comes up and you didn't compile with the -v flag (like I did to demonstrate) then your server may randomly crash at undetermined points in code.
Reply
#6

Quote:
Originally Posted by Vince
View Post
I mean this:



If that comes up and you didn't compile with the -v flag (like I did to demonstrate) then your server may randomly crash at undetermined points in code.
HUMMMMM....

I'm compiling with those flags:
-d3 -r
-;+ -(+


if I use the "-d3" those informations are showed all the time I compile it
-d3 is necessary since I use crashdetect plugin

so, should I use:
-d3 -r
-;+ -(+v
right ?



@Edit
I tried to compile that way
but the size of .amx was exatelly the same
and those informations was still bein showed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)