open.mp forum
[Pawn] [Help] I need bit help - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] [Help] I need bit help (/showthread.php?tid=2362)



[Help] I need bit help - angelopereira.vzla - 2023-03-01

Hello, I don't know if you can help me with this, it is the following:

When I create a Dealership with the /adddealership command, a few seconds pass and the server crashes.

This is the command:

Code:
CMD:adddealership(playerid, params[])
{
if(IsAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
for(new i=1; i < MAX_DEALERSHIPS; i++)
{
if(!DealershipCreated[i])
{
new msg[128];
DealershipCreated[i] = 1;
GetPlayerPos(playerid, DealershipPos[i][0], DealershipPos[i][1], DealershipPos[i][2]);
UpdateDealership(i, 0);
SaveDealership(i);
format(msg, sizeof(msg), "Added dealership id %d", i);
SendClientMessage(playerid, COLOR_WHITE, msg);
return 1;
}
}
SendClientMessage(playerid, COLOR_RED, "Can't add any more dealerships!");
return 1;
}



RE: [Help] I need bit help - Yugen - 2023-03-02

What is the value o "MAX_DEALERSHIPS"?

Maybe you are trying to send too many messages to the client inside the loop and crashing the server.

Look in the server_log file for any of these errors: https://www.open.mp/docs/server/CommonServerIssues


RE: [Help] I need bit help - Radical - 2023-03-05

(2023-03-01, 12:11 PM)angelopereira.vzla Wrote: Hello, I don't know if you can help me with this, it is the following:

When I create a Dealership with the /adddealership command, a few seconds pass and the server crashes.

This is the command:

Code:
CMD:adddealership(playerid, params[])
{
if(IsAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid, COLOR_RED, "You can't use this command now!");
for(new i=1; i < MAX_DEALERSHIPS; i++)
{
if(!DealershipCreated[i])
{
new msg[128];
DealershipCreated[i] = 1;
GetPlayerPos(playerid, DealershipPos[i][0], DealershipPos[i][1], DealershipPos[i][2]);
UpdateDealership(i, 0);
SaveDealership(i);
format(msg, sizeof(msg), "Added dealership id %d", i);
SendClientMessage(playerid, COLOR_WHITE, msg);
return 1;
}
}
SendClientMessage(playerid, COLOR_RED, "Can't add any more dealerships!");
return 1;
}

UseĀ crashdetect
Provides more details about what cause the server crash.