23.04.2009, 15:02
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]
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]