Crashing on SendClientMessage? -
thimo - 10.08.2013
Okay im having a weird problem that makes the server crash when someone tried to use /convoy
The error:
Код:
[10:51:38] [debug] Server crashed while executing ET.amx
[10:51:38] [debug] AMX backtrace:
[10:51:38] [debug] #0 native SendClientMessage () [080cd4b0] from samp03svr
[10:51:38] [debug] System backtrace:
[10:51:38] [debug] #0 b67d4f41 in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[10:51:38] [debug] #1 b67cb41f in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[10:51:38] [debug] #2 b67c9963 in _ZN11crashdetect15SystemExceptionEPv () from plugins/crashdetect.so
[10:51:38] [debug] #3 b67d43c1 in ?? () from plugins/crashdetect.so
[10:51:38] [debug] #4 b77d2600 in ?? ()
[10:51:38] [debug] #5 b750fe29 in _IO_vfprintf () from /lib/i386-linux-gnu/libc.so.6
[10:51:38] [debug] #6 b7533234 in vsprintf () from /lib/i386-linux-gnu/libc.so.6
[10:51:38] [debug] #7 080b4311 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #8 080cd559 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #9 08093c94 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #10 b74835f2 in ?? () from plugins/streamer.so
[10:51:38] [debug] #11 b67ca5a2 in _ZN11crashdetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[10:51:38] [debug] #12 b67d265e in ?? () from plugins/crashdetect.so
[10:51:38] [debug] #13 08095735 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #14 b7483bc0 in ?? () from plugins/streamer.so
[10:51:38] [debug] #15 080ae33f in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #16 080b97da in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #17 08071ae8 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #18 08071be2 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #19 0807ba00 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #20 080b59ad in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #21 080b5b42 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #22 080b1453 in ?? () from /root/samp03/samp03svr
[10:51:38] [debug] #23 b74e44d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
The convoy CMD code:
pawn Код:
CMD:convoy(playerid, params[])
{
// Setup local variables
new ConvoyList[2048], pName[24], NumMembers, ConvoyStatus[10], zone[MAX_ZONE_NAME];
// Create the list of convoys with all their data
for (new i; i < MAX_CONVOYS; i++)
{
// Check if this is an empty convoy (not created yet by a player)
if (AConvoys[i][Status2] == CONVOY_EMPTY)
{
// Setup data for an empty convoy (one which hasn't been chosen yet)
NumMembers = 0;
format(pName, 24, "None");
format(ConvoyStatus, 10, "Empty");
format(zone, MAX_ZONE_NAME, "None");
}
else
{
// Get the name of the convoy-leader
GetPlayerName(AConvoys[i][Members][0], pName, sizeof(pName));
GetPlayer2DZone(AConvoys[i][Members][0], zone, sizeof(zone));
// Calculate the members in the convoy
NumMembers = Convoy_CountMembers(i);
// Set the status of the convoy
switch (AConvoys[i][Status2])
{
case CONVOY_OPEN: format(ConvoyStatus, 10, "Open");
case CONVOY_FULL: format(ConvoyStatus, 10, "Full");
case CONVOY_CLOSED: format(ConvoyStatus, 10, "Closed");
}
}
// Put all data together to form the content of the entire dialog
format(ConvoyList, sizeof(ConvoyList), "%sLeader: {00FF00}%s{FFFFFF}, members: {FF0000}%i{FFFFFF}, Status: {00FF00}%s{FFFFFF} Location: %s\n", ConvoyList, pName, NumMembers, ConvoyStatus, zone);
}
// Show the dialog
ShowPlayerDialog(playerid, DialogSelectConvoy, DIALOG_STYLE_LIST, "Select convoy:", ConvoyList, "Select", "Cancel");
// Let the server know that this was a valid command
return 1;
}
The weird thing is that there is no sendclientmessage so it might be in the dialog select convoy
pawn Код:
Dialog_SelectConvoy(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response) return 1;
// Setup local variables
new Convoy;
// The convoy-id is automatically the listitem
Convoy = listitem;
// Check the status of the selected convoy to determine what to do
switch (AConvoys[Convoy][Status2])
{
case CONVOY_EMPTY: // Convoy isn't started yet, this is a free convoy
{
Convoy_Create(playerid, Convoy); // Try to create the convoy
}
case CONVOY_OPEN: // Convoy has been created but still open for new members to join
{
Convoy_Join(playerid, Convoy); // Try to join the convoy
}
case CONVOY_FULL: // Convoy is full (10 members)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Convoy is full!");
}
case CONVOY_CLOSED: // Convoy has started already (the leader already chose a job, causing the convoy to close)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Convoy is already on en-route to it's destination");
}
}
return 1;
}
Re: Crashing on SendClientMessage? -
PT - 10.08.2013
something like this, try if works
pawn Код:
Dialog_SelectConvoy(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response) return 1;
// Setup local variables
new Convoy;
// The convoy-id is automatically the listitem
Convoy = listitem;
// Check the status of the selected convoy to determine what to do
switch (AConvoys[Convoy][Status2])
{
case CONVOY_EMPTY: Convoy_Create(playerid, Convoy);
case CONVOY_OPEN: Convoy_Join(playerid, Convoy);
case CONVOY_FULL: SendClientMessage(playerid, 0xFFFFFFFF, "Convoy is full!");
case CONVOY_CLOSED: SendClientMessage(playerid, 0xFFFFFFFF, "Convoy is already on en-route to it's destination");
}
return 1;
}
Re: Crashing on SendClientMessage? -
dEcooR - 10.08.2013
Its not dat huge string in dat SCM ?
Re: Crashing on SendClientMessage? -
thimo - 11.08.2013
Found out what the crash was about. Crashdetect doesnt output as much as on Windows. On windows when i tried out the glitch it said something about dialog response. The bug is when you have a job started and you are trying to create a convoy it crashes. adding if(APlayerData[playerid][JobStarted] == false) to it fixed it
Re: Crashing on SendClientMessage? -
-Prodigy- - 11.08.2013
Just a tip: When you want to set a string to something, I recommend something like:
pawn Код:
pName = "None";
//instead of
//format(pName, 24, "None");