[HELP] Crashes,time outs
#1

Hello, my server is suffering of people crashing, it mostly happens when someone connects, then some other players crash, same for ondisconnect. I've been thinkin that this is caused by my registering system. This is what i have at onplayerconnect and disconnect:

Quote:

public OnPlayerConnect(playerid)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,200);
SendClientMessage(playerid,COLOR_RED, "If you don't have an account yet, use /register to create one.");
//rules--------------------------------------------------------------------------
TextDrawShowForPlayer(playerid, rules0);
TextDrawShowForPlayer(playerid, rules1);
TextDrawShowForPlayer(playerid, rules2);
//-------------------------------------------------------------------------------
TextDrawShowForPlayer(playerid, Clock);
SetPlayerColor(playerid, COLOR_GREY); // Set the player's color to inactive

pInfo[playerid][pAdmin] = 0;
pInfo[playerid][pDeaths] = 0;
pInfo[playerid][pKills] = 0;
LoggedIn[playerid] = 0;
IsPlayerMuted[playerid] = 0;
Bounty[playerid] = 0;
BountyKills[playerid] = 0;

new PName[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, PName, MAX_PLAYER_NAME);

if(!udb_Exists(PName))
{
Registered[playerid] = 0;
SystemMsg(playerid,"Type /register <password> to create an account");
}
else
{
Registered[playerid] = 1;
SystemMsg(playerid,"This nickname is registed! If you haven't registered this nickname please choose a different one!");
SystemMsg(playerid,"Please login by typing /login <password>");
}

new second, minute, hour, day, month, year;
if(fsearch("KickedNames.txt", PName, true))
{
SystemMessage(playerid, "Your name has been banned on this server.");
gettime(hour, minute, second);
getdate(year, month, day);
format(str, sizeof(str), "Player %s tried to join server with banned name on %d/%d/%d at %d:%d:%d.", PName, month, day, year, hour, minute, second);
KickPlayer(playerid, "");
}
else if(IsServerLocked == true)
{
SystemMessage(playerid, " Server is currently locked down by Administrator.");
SystemMessage(playerid, " Please try connecting later.");
KickPlayer(playerid, "");
}

return 1;

}

public OnPlayerDisconnect(playerid, reason)
{
SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
if(reason == 0)
{
new str[128];
GetName(playerid, playername);
format(str, sizeof(str), "Player %s (%d) game crashed", playername, playerid);
SendMessageToAdmins(str);
}
if(Registered[playerid])
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
dUserSetINT(playername).("Money",GetPlayerMoney(pl ayerid));
dUserSetINT(playername).("Kills",pInfo[playerid][pKills]);
dUserSetINT(playername).("Deaths",pInfo[playerid][pDeaths]);
dUserSetINT(playername).("Admin",pInfo[playerid][pAdmin]);
dUserSetINT(playername).("Wantedlvl",GetPlayerWant edLevel(playerid));
}
return 1;
}

I would be so gratefull if someone helps me fixing these huge crashes..
Reply
#2

Come on...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)