Why this command crash the gamemode? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why this command crash the gamemode? (
/showthread.php?tid=457246)
Why this command crash the gamemode? -
alanhutch - 10.08.2013
Hello to everyone. I wanted to ask why this command does crash my gamemode! Thanks in advance.
pawn Код:
if(strcmp(cmd, "/vme", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You're not logged in.!");
return 1;
}
GetPlayerRPName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[96];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USO: /vme [visual action]");
return 1;
}
if(PlayerInfo[playerid][pMask] == 1)
{
format(string, sizeof(string), "> %s", result);
}
else
{
format(string, sizeof(string), "> %s", result);
}
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 15000);
SendClientMessage(playerid, COLOR_PURPLE, "> %s %s", sendername, result);
}
return 1;
}
Re: Why this command crash the gamemode? -
BullseyeHawk - 10.08.2013
Use this plugin:
https://sampforum.blast.hk/showthread.php?tid=262796
Go into-game and use the command, when it crashes. Send the last log created by crashdetect to us here.
It'd be quicker and easier to us find the error.
Re: Why this command crash the gamemode? -
alanhutch - 10.08.2013
Ok! Here's the error...
Код:
[22:32:56] [debug] Server crashed while executing PLRP.amx
[22:32:56] [debug] AMX backtrace:
[22:32:56] [debug] #0 native SendClientMessage () [0046fba0] from samp-server.exe
[22:32:56] [debug] #1 0042c638 in public OnPlayerCommandText (0x00000002, 0x0120d62c) from PLRP.amx
[22:32:56] [debug] Native backtrace:
[22:32:56] [debug] #0 004975fc in ?? () from C:\Windows.old.000\Users\Crasn\Downloads\Ubuntu 2.4 iso\Ubuntu Install\ubuntu2.4.iso\readme\samp-server.exe
Re: Why this command crash the gamemode? -
BullseyeHawk - 10.08.2013
Oooh, how didn't I see that! I'm sorry!
Replace this:
pawn Код:
SendClientMessage(playerid, COLOR_PURPLE, "> %s %s", sendername, result);
With this:
pawn Код:
new _string[128]; format(_string, sizeof(_string), "> %s %s", sendername, result);
SendClientMessage(playerid, COLOR_PURPLE, _string);
This should work now.
Re: Why this command crash the gamemode? -
alanhutch - 10.08.2013
Thank you very much! REP+!