/login lag - used Dini
#1

Hey, i have problem.
if somebody typ /login, the player have a big lag in the server ;\
Sorry for my english, im dutch. ;P


[code=/login]dcmd_login(playerid, params[])
{
if (gPlayerLogged[playerid] == 1){SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");return 1;}
if(!strlen(params)){SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /login [password]");return 1;}
OnPlayerLogin(playerid,params);
return 1;
}[/code]

[code=public OnPlayerLogin]public OnPlayerLogin(playerid,string[])
{
new string2[MAX_STRING];
new string3[128];
new playername2[MAX_PLAYER_NAME];
new tmp2[46];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "/RolePlayLS/Users/%s.ini", playername2);
if(dini_Exists(string2))
{
PlayerInfo[playerid][pPassword] = dini_Get(string2,"Password");
if(strcmp(PlayerInfo[playerid][pPassword], string, true) == 0) //if(adler32_hash(string) == PlayerInfo[playerid][pPassword])
{
PlayerInfo[playerid][pCash] = dini_Int(string2,"Cash");
PlayerInfo[playerid][pAccount] = dini_Int(string2,"Account");
PlayerInfo[playerid][pAdmin] = dini_Int(string2,"AdminLevel");
PlayerInfo[playerid][pRank] = dini_Int(string2,"Rank");
PlayerInfo[playerid][pJRank] = dini_Int(string2,"JRank");
PlayerInfo[playerid][pLevel] = dini_Int(string2,"Level");
PlayerInfo[playerid][pExp] = dini_Int(string2,"Exp");
PlayerInfo[playerid][gPupgrade] = dini_Int(string2,"UpgradePoints");
PlayerInfo[playerid][pKills] = dini_Int(string2,"Kills");
PlayerInfo[playerid][pDeaths]= dini_Int(string2,"Deaths");
PlayerInfo[playerid][pCB] = dini_Int(string2,"CB");
PlayerInfo[playerid][pHW] = dini_Int(string2,"HW");
PlayerInfo[playerid][pSR] = dini_Int(string2,"SR");
if(PlayerInfo[playerid][pKills] < 0){PlayerInfo[playerid][pKills] = 0;} //patch
if(PlayerInfo[playerid][pDeaths] < 0){PlayerInfo[playerid][pDeaths] = 0;} //patch
if(PlayerInfo[playerid][pCB] < 0){PlayerInfo[playerid][pCB] = 0;} //patch
if(PlayerInfo[playerid][pHW] < 0){PlayerInfo[playerid][pHW] = 0;} //patch
if(PlayerInfo[playerid][pSR] < 0){PlayerInfo[playerid][pSR] = 0;} //patch
PlayerInfo[playerid][pWA] = dini_Int(string2,"WA");
PlayerInfo[playerid][pPEN] = dini_Int(string2,"PEN");
PlayerInfo[playerid][pGun1] = dini_Int(string2,"Gun1");
PlayerInfo[playerid][pGun2] = dini_Int(string2,"Gun2");
PlayerInfo[playerid][pGun3] = dini_Int(string2,"Gun3");
PlayerInfo[playerid][pGun4] = dini_Int(string2,"Gun4");
PlayerInfo[playerid][pGun5] = dini_Int(string2,"Gun5");
PlayerInfo[playerid][pGun6] = dini_Int(string2,"Gun6");
PlayerInfo[playerid][pGun7] = dini_Int(string2,"Gun7");
PlayerInfo[playerid][pAmmo1] = dini_Int(string2,"Ammo1");
PlayerInfo[playerid][pAmmo2] = dini_Int(string2,"Ammo2");
PlayerInfo[playerid][pAmmo3] = dini_Int(string2,"Ammo3");
PlayerInfo[playerid][pAmmo4] = dini_Int(string2,"Ammo4");
PlayerInfo[playerid][pAmmo5] = dini_Int(string2,"Ammo5");
PlayerInfo[playerid][pAmmo6] = dini_Int(string2,"Ammo6");
PlayerInfo[playerid][pAmmo7] = dini_Int(string2,"Ammo7");
PlayerInfo[playerid][pSHealth] = dini_Float(string2,"SpawnHealth");
PlayerInfo[playerid][pHealth] = dini_Float(string2,"Health");
PlayerInfo[playerid][pPos_x] = dini_Float(string2,"Pos_x");
PlayerInfo[playerid][pPos_y] = dini_Float(string2,"Pos_y");
PlayerInfo[playerid][pPos_z] = dini_Float(string2,"Pos_z");
PlayerInfo[playerid][pLicenseA] = dini_Int(string2,"LicenseA");
PlayerInfo[playerid][pLicenseB] = dini_Int(string2,"LicenseB");
PlayerInfo[playerid][pLicenseC] = dini_Int(string2,"LicenseC");
PlayerInfo[playerid][pInt] = dini_Int(string2,"Int");
PlayerInfo[playerid][pLocal] = dini_Int(string2,"Local");
if(PlayerInfo[playerid][pModel] != 264){PlayerInfo[playerid][pTeam] = dini_Int(string2,"Team");}
if(PlayerInfo[playerid][pModel] != 264){PlayerInfo[playerid][pModel] = dini_Int(string2,"Model");}
PlayerInfo[playerid][pPnumber] = dini_Int(string2,"PhoneNumber");
PlayerInfo[playerid][pPhousekey] = dini_Int(string2,"HouseKey");
PlayerInfo[playerid][pPbiskey] = dini_Int(string2,"Pbiskey");
PlayerInfo[playerid][pDuty] = dini_Int(string2,"Duty");
PlayerInfo[playerid][pDrugs] = dini_Int(string2,"Drugs");
PlayerInfo[playerid][pSendContracts] = dini_Int(string2,"SendContracts");
PlayerInfo[playerid][pHaveContracts] = dini_Int(string2,"HaveContracts");
PlayerInfo[playerid][pWarnL] = dini_Int(string2,"Warnings");
PlayerInfo[playerid][pSArmour] = dini_Float(string2,"Armour");
PlayerInfo[playerid][pJailed] = dini_Int(string2,"Jailed");
PlayerInfo[playerid][pKicks] = dini_Int(string2,"Kicks");
PlayerInfo[playerid][pBans] = dini_Int(string2,"Bans");
PlayerInfo[playerid][pPhoneBook] = dini_Int(string2,"PhoneBook");
PlayerInfo[playerid][pDice] = dini_Int(string2,"Dice");
PlayerInfo[playerid][pSpeedo] = dini_Int(string2,"Speedo");
PlayerInfo[playerid][pPoliceRadio] = dini_Int(string2,"PoliceRadio");
PlayerInfo[playerid][pReactionWins] = dini_Int(string2,"ReactionWins");
if(PlayerInfo[playerid][pSArmour] > 100){PlayerInfo[playerid][pSArmour] = 100;} //patch
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
gTeam[playerid] = PlayerInfo[playerid][pTeam];

gPhoneBook[playerid] = PlayerInfo[playerid][pPhoneBook];
gDice[playerid] = PlayerInfo[playerid][pDice];
gSpeedo[playerid] = PlayerInfo[playerid][pSpeedo];
PoliceRadio[playerid] = PlayerInfo[playerid][pPoliceRadio];

if(PlayerInfo[playerid][pDuty] == 0)
{
gRadio[playerid] = PlayerInfo[playerid][pDuty];
}
if(PlayerInfo[playerid][pJailed] >= 1)
{
format(string3, sizeof(string3), "%s Has been logged in into a jailed account.",playername2);
SendClientMessageToAll(COLOR_RED,string3);
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,197.72,175.06,1003.02);
ResetPlayerWeapons(playerid);
jailed2[playerid] = 1;
ResetPlayerWeapons(playerid);
SetTimerEx("OnPlayerUnjail",60000,false,"d",player id);
}
if(PlayerInfo[playerid][pRank] >= 11)
{
PoliceRadio[playerid] = 1;
}
if(PlayerInfo[playerid][pRank] > 1)
{
PoliceRadio[playerid] = 1;
}
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < 133
{
format(string3, sizeof(string3), ">>> Admin %s logged in! Adminlevel: (%d) <<<",playername2,PlayerInfo[playerid][pAdmin]);
SendClientMessageToAll(COLOR_RED,string3);
}
SetPlayerWeapons(playerid);
SetSpawnInfo(playerid, gTeam[playerid], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
gPlayerLogged[playerid] = 1;
gRadio[playerid] = PlayerInfo[playerid][pDuty];
if(accountplay)
{
gPlayerSpawned[playerid] = 0;
}
SpawnPlayer(playerid);
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~b~ %s", playername2);
DateProp(playerid);
GameTextForPlayer(playerid, tmp2, 5000, 1);
}
else
{
SendClientMessage(playerid, COLOR_RED, "SERVER: Wrong Password!");
}
}
return 1;
}[/code]
Reply
#2

I had something similar... Check your function that saves info to players accounts...

I messed up on that in my gamemode and had data being written after the existing data..

so as an example..

Name = Outbreak
Password = Ob
Money = 5000000
Name = Outbreak
Password = Ob
Money = 5000000
Name = Outbreak
Password = Ob
Money = 5000000
Name = Outbreak
Password = Ob
Money = 5000000
Name = Outbreak
Password = Ob
Money = 5000000


THe same things being writting over and over rather than replacing the old data..

Check the user files, and the file saving function..

Good luck
Reply
#3

hmm, i cant find the problem in my saving file.
i think its good.

Here is my saving/registing scripts:

[code=/register]dcmd_register(playerid, params[])
{
if(!strlen(params)){SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /register [password]");return 1;}
if(gPlayerAccount[playerid] == 1){SendClientMessage(playerid, COLOR_GRAD1, "This nick is allready registered!");return 1;}
gPlayerAccount[playerid] = 1;
new playername[MAX_PLAYER_NAME],string[MAX_STRING];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "/RolePlayLS/Users/%s.ini", playername);
if(!dini_Exists(string))
{
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
LatestMember = playername;
dini_Create(string);
dini_Set(string,"Password",params);
dini_IntSet(string,"Cash",PlayerInfo[playerid][pCash]);
dini_IntSet(string,"Account",PlayerInfo[playerid][pAccount]);
dini_IntSet(string,"AdminLevel",PlayerInfo[playerid][pAdmin]);
dini_IntSet(string,"Rank",PlayerInfo[playerid][pRank]);
dini_IntSet(string,"JRank",PlayerInfo[playerid][pJRank]);
dini_IntSet(string,"Level",PlayerInfo[playerid][pLevel]);
dini_IntSet(string,"Exp",PlayerInfo[playerid][pExp]);
dini_IntSet(string,"UpgradePoints",PlayerInfo[playerid][gPupgrade]);
dini_IntSet(string,"Kills",PlayerInfo[playerid][pKills]);
dini_IntSet(string,"Deaths",PlayerInfo[playerid][pDeaths]);
dini_IntSet(string,"CB",PlayerInfo[playerid][pCB]);
dini_IntSet(string,"HW",PlayerInfo[playerid][pHW]);
dini_IntSet(string,"SR",PlayerInfo[playerid][pSR]);
dini_IntSet(string,"WA",PlayerInfo[playerid][pWA]);
dini_IntSet(string,"PEN",PlayerInfo[playerid][pPEN]);
dini_IntSet(string,"Gun1",PlayerInfo[playerid][pGun1]);
dini_IntSet(string,"Gun2",PlayerInfo[playerid][pGun2]);
dini_IntSet(string,"Gun3",PlayerInfo[playerid][pGun3]);
dini_IntSet(string,"Gun4",PlayerInfo[playerid][pGun4]);
dini_IntSet(string,"Gun5",PlayerInfo[playerid][pGun5]);
dini_IntSet(string,"Gun6",PlayerInfo[playerid][pGun6]);
dini_IntSet(string,"Gun7",PlayerInfo[playerid][pGun7]);
dini_IntSet(string,"Ammo1",PlayerInfo[playerid][pAmmo1]);
dini_IntSet(string,"Ammo2",PlayerInfo[playerid][pAmmo2]);
dini_IntSet(string,"Ammo3",PlayerInfo[playerid][pAmmo3]);
dini_IntSet(string,"Ammo4",PlayerInfo[playerid][pAmmo4]);
dini_IntSet(string,"Ammo5",PlayerInfo[playerid][pAmmo5]);
dini_IntSet(string,"Ammo6",PlayerInfo[playerid][pAmmo6]);
dini_IntSet(string,"Ammo7",PlayerInfo[playerid][pAmmo7]);
dini_FloatSet(string,"SpawnHealth",PlayerInfo[playerid][pSHealth]);
dini_FloatSet(string,"Health",PlayerInfo[playerid][pHealth]);
dini_FloatSet(string,"Pos_x",PlayerInfo[playerid][pPos_x]);
dini_FloatSet(string,"Pos_y",PlayerInfo[playerid][pPos_y]);
dini_FloatSet(string,"Pos_z",PlayerInfo[playerid][pPos_z]);
dini_IntSet(string,"LicenseA",PlayerInfo[playerid][pLicenseA]);
dini_IntSet(string,"LicenseB",PlayerInfo[playerid][pLicenseB]);
dini_IntSet(string,"LicenseC",PlayerInfo[playerid][pLicenseC]);
if(accountplay)
{
PlayerInfo[playerid][pInt] = 0;
}
gTeam[playerid] = 3;
PlayerInfo[playerid][pTeam] = gTeam[playerid];
dini_IntSet(string,"Int",PlayerInfo[playerid][pInt]);
dini_IntSet(string,"Local",PlayerInfo[playerid][pLocal]);
dini_IntSet(string,"Team",PlayerInfo[playerid][pTeam]);
dini_IntSet(string,"Model",PlayerInfo[playerid][pModel]);
dini_IntSet(string,"PhoneNumber",PlayerInfo[playerid][pPnumber]);
dini_IntSet(string,"HouseKey",PlayerInfo[playerid][pPhousekey]);
dini_IntSet(string,"Pbiskey",PlayerInfo[playerid][pPbiskey]);
dini_IntSet(string,"Duty",PlayerInfo[playerid][pDuty]);
dini_IntSet(string,"Drugs",PlayerInfo[playerid][pDrugs]);
dini_IntSet(string,"SendContracts",PlayerInfo[playerid][pSendContracts]);
dini_IntSet(string,"HaveContracts",PlayerInfo[playerid][pHaveContracts]);
dini_IntSet(string,"Warnings",PlayerInfo[playerid][pWarnL]);
dini_FloatSet(string,"Armour",PlayerInfo[playerid][pSArmour]);
dini_IntSet(string,"Jailed",PlayerInfo[playerid][pJailed]);
dini_IntSet(string,"Kicks",PlayerInfo[playerid][pKicks]);
dini_IntSet(string,"Bans",PlayerInfo[playerid][pBans]);
PlayerInfo[playerid][pPhoneBook] = gPhoneBook[playerid];
PlayerInfo[playerid][pDice] = gDice[playerid];
PlayerInfo[playerid][pSpeedo] = gSpeedo[playerid];
PlayerInfo[playerid][pPoliceRadio] = PoliceRadio[playerid];
dini_IntSet(string,"PhoneBook",PlayerInfo[playerid][pPhoneBook]);
dini_IntSet(string,"Dice",PlayerInfo[playerid][pDice]);
dini_IntSet(string,"Speedo",PlayerInfo[playerid][pSpeedo]);
dini_IntSet(string,"PoliceRadio",PlayerInfo[playerid][pPoliceRadio]);
dini_IntSet(string,"ReactionWins",PlayerInfo[playerid][pReactionWins]);
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Next time you connect, type /login <PASSWORD> to log in.");
OnPlayerLogin(playerid,params);
}
return 1;
}
[/code]

[code=public OnPlayerUpdate]public OnPlayerUpdate(playerid)
{
if (gPlayerLogged[playerid] != 0)
{
new playername[MAX_PLAYER_NAME],string[MAX_STRING];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "/RolePlayLS/Users/%s.ini", playername);
if(dini_Exists(string))
{
dini_Set(string,"Password",PlayerInfo[playerid][pPassword]);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
dini_IntSet(string,"Cash",PlayerInfo[playerid][pCash]);
dini_IntSet(string,"Account",PlayerInfo[playerid][pAccount]);
dini_IntSet(string,"AdminLevel",PlayerInfo[playerid][pAdmin]);
dini_IntSet(string,"Rank",PlayerInfo[playerid][pRank]);
dini_IntSet(string,"JRank",PlayerInfo[playerid][pJRank]);
dini_IntSet(string,"Level",PlayerInfo[playerid][pLevel]);
dini_IntSet(string,"Exp",PlayerInfo[playerid][pExp]);
dini_IntSet(string,"UpgradePoints",PlayerInfo[playerid][gPupgrade]);
dini_IntSet(string,"Kills",PlayerInfo[playerid][pKills]);
dini_IntSet(string,"Deaths",PlayerInfo[playerid][pDeaths]);
dini_IntSet(string,"CB",PlayerInfo[playerid][pCB]);
dini_IntSet(string,"HW",PlayerInfo[playerid][pHW]);
dini_IntSet(string,"SR",PlayerInfo[playerid][pSR]);
dini_IntSet(string,"WA",PlayerInfo[playerid][pWA]);
dini_IntSet(string,"PEN",PlayerInfo[playerid][pPEN]);
dini_IntSet(string,"Gun1",PlayerInfo[playerid][pGun1]);
dini_IntSet(string,"Gun2",PlayerInfo[playerid][pGun2]);
dini_IntSet(string,"Gun3",PlayerInfo[playerid][pGun3]);
dini_IntSet(string,"Gun4",PlayerInfo[playerid][pGun4]);
dini_IntSet(string,"Gun5",PlayerInfo[playerid][pGun5]);
dini_IntSet(string,"Gun6",PlayerInfo[playerid][pGun6]);
dini_IntSet(string,"Gun7",PlayerInfo[playerid][pGun7]);
dini_IntSet(string,"Ammo1",PlayerInfo[playerid][pAmmo1]);
dini_IntSet(string,"Ammo2",PlayerInfo[playerid][pAmmo2]);
dini_IntSet(string,"Ammo3",PlayerInfo[playerid][pAmmo3]);
dini_IntSet(string,"Ammo4",PlayerInfo[playerid][pAmmo4]);
dini_IntSet(string,"Ammo5",PlayerInfo[playerid][pAmmo5]);
dini_IntSet(string,"Ammo6",PlayerInfo[playerid][pAmmo6]);
dini_IntSet(string,"Ammo7",PlayerInfo[playerid][pAmmo7]);
dini_FloatSet(string,"SpawnHealth",PlayerInfo[playerid][pSHealth]);
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
dini_FloatSet(string,"Health",PlayerInfo[playerid][pHealth]);
GetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0) || (gPlayerFighter[playerid] != 0))
{
PlayerInfo[playerid][pPos_x] = 1684.9;
PlayerInfo[playerid][pPos_y] = -2244.5;
PlayerInfo[playerid][pPos_z] = 13.5;
}
if(Spectate[playerid] != 255)
{
PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
}
gTeam[playerid] = PlayerInfo[playerid][pTeam];
dini_FloatSet(string,"Pos_x",PlayerInfo[playerid][pPos_x]);
dini_FloatSet(string,"Pos_y",PlayerInfo[playerid][pPos_y]);
dini_FloatSet(string,"Pos_z",PlayerInfo[playerid][pPos_z]);
dini_IntSet(string,"LicenseA",PlayerInfo[playerid][pLicenseA]);
dini_IntSet(string,"LicenseB",PlayerInfo[playerid][pLicenseB]);
dini_IntSet(string,"LicenseC",PlayerInfo[playerid][pLicenseC]);
dini_IntSet(string,"Int",PlayerInfo[playerid][pInt]);
dini_IntSet(string,"Local",PlayerInfo[playerid][pLocal]);
dini_IntSet(string,"Team",PlayerInfo[playerid][pTeam]);
dini_IntSet(string,"Model",PlayerInfo[playerid][pModel]);
dini_IntSet(string,"PhoneNumber",PlayerInfo[playerid][pPnumber]);
dini_IntSet(string,"HouseKey",PlayerInfo[playerid][pPhousekey]);
dini_IntSet(string,"Pbiskey",PlayerInfo[playerid][pPbiskey]);
dini_IntSet(string,"Duty",PlayerInfo[playerid][pDuty]);
dini_IntSet(string,"Drugs",PlayerInfo[playerid][pDrugs]);
dini_IntSet(string,"SendContracts",PlayerInfo[playerid][pSendContracts]);
dini_IntSet(string,"HaveContracts",PlayerInfo[playerid][pHaveContracts]);
dini_IntSet(string,"Warnings",PlayerInfo[playerid][pWarnL]);
dini_FloatSet(string,"Armour",PlayerInfo[playerid][pSArmour]);
dini_IntSet(string,"Jailed",PlayerInfo[playerid][pJailed]);
dini_IntSet(string,"Kicks",PlayerInfo[playerid][pKicks]);
dini_IntSet(string,"Bans",PlayerInfo[playerid][pBans]);
PlayerInfo[playerid][pPhoneBook] = gPhoneBook[playerid];
PlayerInfo[playerid][pDice] = gDice[playerid];
PlayerInfo[playerid][pSpeedo] = gSpeedo[playerid];
PlayerInfo[playerid][pPoliceRadio] = PoliceRadio[playerid];
dini_IntSet(string,"PhoneBook",PlayerInfo[playerid][pPhoneBook]);
dini_IntSet(string,"Dice",PlayerInfo[playerid][pDice]);
dini_IntSet(string,"Speedo",PlayerInfo[playerid][pSpeedo]);
dini_IntSet(string,"PoliceRadio",PlayerInfo[playerid][pPoliceRadio]);
dini_IntSet(string,"ReactionWins",PlayerInfo[playerid][pReactionWins]);
}
}
return 1;
}
[/code]
Reply
#4

Fixed.
Reply
#5

Using dini that many times simultaneously is going to use a bit of CPU. I REALLY REALLY REALLY don't think you should be using saving ~60 things using dini OnPlayerUpdate. Do you realize that OnPlayerUpdate is called probably at least 10 times per second? I wouldn't be surprised if your script used 100% CPU with 10+ people
You should seriously reconsider using dini OnPlayerUpdate.
Reply
#6

That was called OnPlayerUpdate before 0.2.X came out. He should have replaced all OnPlayerUpdate with OnPlayerUpdateX like most people did. I bet his log is over a gig in size.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)