10.08.2012, 23:29
Hello.
My server is having more that +10000 user accounts in volt host.Now the server is lagging like hell, i asked about this in volt support they told me i have to convert the script to MySQL cuz pawno cannot hold a large amount of user accounts and thats the main cause of lag.
I'm currently using ladmin system, i know how to script pawno but no idea about MySQL. I searched tutorials but i didnt understand anything. I really want to convert my script to MySQL otherwise i have to close my server forever.
Can anyone please tell me how can i convert my script to MySQL?
Register command
My server is having more that +10000 user accounts in volt host.Now the server is lagging like hell, i asked about this in volt support they told me i have to convert the script to MySQL cuz pawno cannot hold a large amount of user accounts and thats the main cause of lag.
I'm currently using ladmin system, i know how to script pawno but no idea about MySQL. I searched tutorials but i didnt understand anything. I really want to convert my script to MySQL otherwise i have to close my server forever.
Can anyone please tell me how can i convert my script to MySQL?
Register command
pawn Код:
CMD:register(playerid,params[]){
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: You are already registered and logged in.");
if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: This account already exists, please use '/login [password]'.");
if (strlen(params) == 0) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Correct usage: '/register [password]'");
if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Password length must be greater than three characters");
if (udb_Create(PlayerName2(playerid),params)){
new file[256],rname[MAX_PLAYER_NAME], tmp3[100];
new strdate[20], year,month,day;
getdate(year, month, day);
GetPlayerName(playerid,rname,sizeof(rname));
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(rname));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
dUserSetINT(PlayerName2(playerid)).("registered",1);
format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
dUserSetINT(PlayerName2(playerid)).("money",0);
dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("Bank",PlayerInfo[playerid][bank]);
dUserSetINT(PlayerName2(playerid)).("weed",PlayerInfo[playerid][weed]);
dUserSetINT(PlayerName2(playerid)).("Condoms",PlayerInfo[playerid][condoms]);
dUserSetINT(PlayerName2(playerid)).("inalcatraz",PlayerInfo[playerid][inalcatraz]);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
SavePlayer(playerid);
LoginPlayer(playerid);
LoadPlayer(playerid);