31.01.2015, 19:35
- So my problem is when i enter my server and enter my password then the server restarts, without giving any error in the log files.
Creating an account is possible, but login in not, can't find the problem.
- on my localhost (linux ubuntu) i don't have this problem.
- on the Hosted server (linux, ubuntu) i have this error.
between LoadCharacters and OnLoadCharacters its going wrong i think but i can't find it.
Here is the code:
Creating an account is possible, but login in not, can't find the problem.
- on my localhost (linux ubuntu) i don't have this problem.
- on the Hosted server (linux, ubuntu) i have this error.
between LoadCharacters and OnLoadCharacters its going wrong i think but i can't find it.
Here is the code:
pawn Code:
public OnPlayerLogin(playerid) {
new msg[128],ip[16];
new acctotal = numPlayersOnAcc(playerid);
if(acctotal > 0) {
format(msg, sizeof(msg), "* AdmWarn: %s[%s] has logged in multiple times from the same account.",GetPlayerNameEx(playerid, ENameType_CharName),GetPlayerNameEx(playerid, ENameType_AccountName));
ABroadcast(X11_YELLOW, msg, EAdminFlags_All);
KickEx(playerid, "Logging in multiple times from the same IP");
DeletePVar(playerid, "LoggedIn");
sendMsgToAccID(GetPVarInt(playerid, "AccountID"), X11_TOMATO_2, "* Warning: Someone has successfully logged into your account while you were online. Consider changing your password.");
return 1;
}
new total;
GetPlayerIpEx(playerid, ip, sizeof(ip));
if((total = numPlayersOnIp(ip)) > 1) {
format(msg, sizeof(msg), "* AdmWarn: %s[%d] has logged in %d times from the same IP(%s).",GetPlayerNameEx(playerid, ENameType_CharName),playerid,total,ip);
ABroadcast(X11_YELLOW, msg, EAdminFlags_All);
}
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 998);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
SetPVarInt(playerid, "AccountLoginTime", gettime());
LoadCharacters(playerid, true);
format(msg, sizeof(msg), "Welcome %s!",GetPlayerNameEx(playerid, ENameType_AccountName));
SendClientMessage(playerid, X11_ORANGE, msg);
format(query, sizeof(query), "SELECT `flags`,`adminflags`,(`host`&`mask`)=(INET_ATON(\"%s\")&`mask`) FROM `loginflags` WHERE (`host`&`mask`)=(INET_ATON(\"%s\")&`mask`) OR (`accountid` = %d) order by 3 desc",ip,ip,GetPVarInt(playerid, "AccountID"));
mysql_function_query(g_mysql_handle, query, true, "OnLoadIPFlags", "dd", playerid,0);
return 1;
}
LoadCharacters(playerid, bool:showdialog) {
#pragma unused showdialog
query[0] = 0;//[128];
new accountid = GetPVarInt(playerid,"AccountID");
if(accountid == 0) {
return 0;
}
format(query, sizeof(query),"SELECT `username`,`id` FROM `characters` WHERE `accountid` = %d",accountid);
mysql_function_query(g_mysql_handle, query, true, "OnLoadCharacters", "d", playerid);
return 1;
}
public OnLoadCharacters(playerid) {
new rows,fields;
cache_get_data(rows,fields);
SetPVarInt(playerid, "NumCharacters", rows);
new pvarname[32];
new fielddata[64];
new charid;
for(new i=0;i<rows;i++) {
cache_get_row(i,0,fielddata);
format(pvarname,sizeof(pvarname),"CharUsername%d",i);
SetPVarString(playerid,pvarname,fielddata);
format(pvarname,sizeof(pvarname),"CharID%d",i);
cache_get_row(i,1,fielddata);
charid = strval(fielddata);
SetPVarInt(playerid,pvarname,charid);
}
ShowCharacterDialog(playerid);
return 1;
}
ShowCharacterDialog(playerid) {
dialogstr[0] = 0;
tempstr[0] = 0;
new charname[MAX_PLAYER_NAME];
new pvarname[32];
new numchars = GetPVarInt(playerid,"NumCharacters");
for(new i=0;i<numchars;i++) {
format(pvarname,sizeof(pvarname),"CharUsername%d",i);
GetPVarString(playerid,pvarname,charname,sizeof(charname));
format(tempstr,sizeof(tempstr),"%s\n",charname);
strcat(dialogstr,tempstr,sizeof(dialogstr));
}
if(numchars <= 5) {
strcat(dialogstr,"Create Character",sizeof(dialogstr));
}
ShowPlayerDialog(playerid, _:EAccountDialog_ChooseCharacter, DIALOG_STYLE_LIST, "Choose your character",dialogstr,"Select", "Quit");
return 0;
}