12.04.2014, 19:34
Hello everyone....
ERROR:
Code:
Admin login ::
Thank you for your time and your time..
With best regards Scrillex.
ERROR:
pawn Код:
#5 002a7410 in ?? ()
[21:31:57] [debug] #4 002c0cec in ?? () from plugins/crashdetect.so
[21:31:57] [debug] #3 002bd366 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[21:31:57] [debug] #2 002bcebc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[21:31:57] [debug] #1 002bc2d2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[21:31:57] [debug] #0 002c109b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[21:31:57] [debug] Native backtrace:
[21:31:57] [debug] #1 00083350 in public OnLoginAttempt (0x00000000) from UnitedStreet.amx
[21:31:57] [debug] #0 00000004 in public S@@_OnPlayerLogin (0x00000000, 0x00000000) from UnitedStreet.amx
[21:31:57] [debug] AMX backtrace:
[21:31:57] [debug] Server crashed while executing UnitedStreet.amx
Code:
pawn Код:
public OnLoginAttempt(playerid) {
new rows,fields;
cache_get_data(rows,fields);
new loginattempts = GetPVarInt(playerid,"LoginAttempts");
new msg[128];
if(rows < 1) {
loginattempts++;
if((MAX_LOGIN_ATTEMPTS-loginattempts) <= 0) {
SendClientMessage(playerid, X11_RED,"You have been kicked for entering the incorrect password.");
Kick(playerid);
}
SetPVarInt(playerid,"LoginAttempts",loginattempts);
format(msg,sizeof(msg),"[ERROR]: Incorrect password. You have %d more attempts before you will be kicked.",MAX_LOGIN_ATTEMPTS-loginattempts);
SendClientMessage(playerid, X11_WHITE, msg);
ShowLoginDialog(playerid);
return 1;
}
SendClientMessage(playerid, X11_ORANGE,"Successful login!");
new alevel, id_string[32];
cache_get_row(0,0,id_string);
//`adminlevel`,`newbrank`,`connecttime`,`admintitle`
alevel = strval(id_string);
cache_get_row(0,1,id_string);
SetPVarInt(playerid, "NewbieRank", strval(id_string));
cache_get_row(0,2,id_string);
SetPVarInt(playerid, "ConnectTime", strval(id_string));
cache_get_row(0,3,id_string);
SetPVarString(playerid, "AdminTitle", id_string);
if(alevel != 0) {
format(msg,sizeof(msg),"You are logged in as a %s!",id_string);
SendClientMessage(playerid, X11_WHITE, msg);
SetPVarInt(playerid,"AdminFlags",alevel);
}
cache_get_row(0,1,id_string);
alevel = strval(id_string);
if(alevel != 0) {
SetPVarInt(playerid,"NewbieRank",alevel);
format(msg,sizeof(msg),"You are logged in as a %s",GetNewbieName(playerid));
SendClientMessage(playerid, X11_WHITE, msg);
}
if(GetPVarInt(playerid, "AdminFlags") != 0 || GetPVarInt(playerid, "NewbieRank") != 0) {
adminOnPlayerLogin(playerid);
}
cache_get_row(0,4,id_string); //donate points
alevel = strval(id_string);
SetPVarInt(playerid, "DonatePoints", alevel);
cache_get_row(0,5,id_string); //donate rank
alevel = strval(id_string);
SetPVarInt(playerid, "DonateRank", alevel);
cache_get_row(0,6,id_string); //cookies
alevel = strval(id_string);
SetPVarInt(playerid, "Cookies", alevel);
cache_get_row(0,7,id_string); //ajail release time
alevel = strval(id_string);
if(alevel > 0) {
SetTimerEx("AJail",1000, false, "dds", playerid, alevel, "AJailed");
}
cache_get_row(0,8,id_string);
SetPVarInt(playerid, "NMuteTime", strval(id_string)+gettime());
cache_get_row(0,9,id_string);
SetPVarInt(playerid, "MuteTime", strval(id_string)+gettime());
cache_get_row(0,10,id_string);
SetPVarInt(playerid, "ReportBanned", strval(id_string));
cache_get_row(0,11,id_string);
SetPVarInt(playerid, "AccountFlags", strval(id_string));
cache_get_row(0,12,id_string);
SetPVarInt(playerid, "NumAJails", strval(id_string));
cache_get_row(0,13,id_string);
SetPVarInt(playerid, "NumKicks", strval(id_string));
cache_get_row(0,14,id_string);
SetPVarInt(playerid, "NumBans", strval(id_string));
cache_get_row(0,15,id_string);
new hideval = strval(id_string);
if(hideval != 0)
SetPVarInt(playerid, "AdminHidden", hideval);
OnPlayerLogin(playerid);
return 1;
}
forward OnPlayerConnectEx(playerid);
public OnPlayerConnectEx(playerid) {
if(numUsersOnIP(playerid) > 6) {
#if ip_remote_check
KickEx(playerid, "Too many simultaneous sessions");
#else
Ban(playerid);
#endif
return 0;
}
return 0;
}
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()); //Login time for the account, not the character
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;
}
pawn Код:
unloadCmds(playerid) {
for(new i=0;i<sizeof(admincmds);i++) {
Command_SetPlayerNamed(admincmds[i][ECmdName], playerid, false);
SetCmdAlts(i, playerid, false);
}
}
loadCmds(playerid) {
for(new i=0;i<sizeof(admincmds);i++) {
if(isCmdAllowed(playerid,i )) {
Command_SetPlayerNamed(admincmds[i][ECmdName], playerid, true);
SetCmdAlts(i, playerid, true);
} else {
SetCmdAlts(i, playerid, false);
}
}
}
public adminOnPlayerConnect(playerid) {
unloadCmds(playerid);
checkBans(playerid);
return 1;
}
With best regards Scrillex.