BanPlayer(playerid, reason[], adminid)
{
new String[500], PlayerName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME], IP[32], Date[3], Time[3];
getdate(Date[0], Date[1], Date[2]);
gettime(Time[0], Time[1], Time[2]);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
GetPlayerIp(playerid, IP, 32);
GetPlayerName(adminid, AdminName, MAX_PLAYER_NAME);
if(adminid == -1) { AdminName = "Server"; }
format(String, sizeof(String), "AdmCmd: %s Has been banned by %s. Reason: %s", PlayerName, AdminName, reason);
SendClientMessageToAll(COLOR_RED, String);
SendClientMessage(playerid, COLOR_AAC, "You have been banned from the server.");
SendClientMessage(playerid, COLOR_RED, "If you feel this ban is unfair, please Screen Shot the below information.");
format(String, sizeof(String), "BanInfo: Date: %d:%d:%d || Time: %d:%d || Admin Name: %s || Reason: %s", Date[0], Date[1], Date[2], Time[0], Time[1], AdminName, reason);
SendClientMessage(playerid, COLOR_RED, String);
format(String, sizeof(String), "BanInfo: IP: %s || Player Name : %s || Admin Name: %s || Reason: %s", IP, PlayerName, AdminName, reason);
Log("Logs/BanInfo.log", String);
format(String, sizeof(String), "INSERT INTO `BanInfo`(Username, IPAddress, Reason, AdminName) VALUES (%s, %s, %s, %s)", DB_Escape(PlayerName), IP, reason, DB_Escape(AdminName));
db_query(Database, String);
Kick(playerid);
}
public OnGameModeInit( )
{
mysql_debug( 1 ); // makes a file in root of the server about the queries and all mysql functions
// other stuff
return 1;
}
Sorry mate, I'm using SQLite not Mysql. Is there anything similar for SQLite?
|
BanPlayer(playerid, reason[], adminid) { new String[500], PlayerName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME], IP[32], Date[3], Time[3]; getdate(Date[0], Date[1], Date[2]); gettime(Time[0], Time[1], Time[2]); GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME); GetPlayerIp(playerid, IP, 32); GetPlayerName(adminid, AdminName, MAX_PLAYER_NAME); if(adminid == -1) { AdminName = "Server"; } format(String, sizeof(String), "AdmCmd: %s Has been banned by %s. Reason: %s", PlayerName, AdminName, reason); SendClientMessageToAll(COLOR_RED, String); SendClientMessage(playerid, COLOR_AAC, "You have been banned from the server."); SendClientMessage(playerid, COLOR_RED, "If you feel this ban is unfair, please Screen Shot the below information."); format(String, sizeof(String), "BanInfo: Date: %d:%d:%d || Time: %d:%d || Admin Name: %s || Reason: %s", Date[0], Date[1], Date[2], Time[0], Time[1], AdminName, reason); SendClientMessage(playerid, COLOR_RED, String); format(String, sizeof(String), "BanInfo: IP: %s || Player Name : %s || Admin Name: %s || Reason: %s", IP, PlayerName, AdminName, reason); Log("Logs/BanInfo.log", String); format(String, sizeof(String), "INSERT INTO `BanInfo`(Username, IPAddress, Reason, AdminName) VALUES ('%s', '%s', '%s', '%s')", DB_Escape(PlayerName), IP, reason, DB_Escape(AdminName)); db_query(Database, String); SetTimerEx( "KickPlayer", 1000, 0, "i", playerid ); } forward KickPlayer( playerid ); public KickPlayer( playerid ) return Kick( playerid );
Alright, however I have a crash issue right now, I'm not sure what's causing it. Would you mind helping me on that?
|
[11:58:57] [debug] Server crashed while executing DM_Server.amx [11:58:57] [debug] AMX backtrace: [11:58:57] [debug] #0 native fwrite () [00405710] from samp-server.exe [11:58:57] [debug] #1 00008798 in ?? () from DM_Server.amx [11:58:57] [debug] #2 00009bfc in ?? () from DM_Server.amx [11:58:57] [debug] #3 0000d93c in public UpdatePlayerEx () from DM_Server.amx [11:58:57] [debug] Native backtrace: [11:58:57] [debug] #0 77397ae2 in ?? () from C:\Windows\system32\ntdll.dll [11:58:57] [debug] #1 00492860 in ?? () from C:\Users\Mike\Desktop\Scripting\DM Server\samp-server.exe [11:58:57] [debug] #2 0040534e in ?? () from C:\Users\Mike\Desktop\Scripting\DM Server\samp-server.exe
I've done that, all I receive is:
Код:
[11:58:57] [debug] Server crashed while executing DM_Server.amx [11:58:57] [debug] AMX backtrace: [11:58:57] [debug] #0 native fwrite () [00405710] from samp-server.exe [11:58:57] [debug] #1 00008798 in ?? () from DM_Server.amx [11:58:57] [debug] #2 00009bfc in ?? () from DM_Server.amx [11:58:57] [debug] #3 0000d93c in public UpdatePlayerEx () from DM_Server.amx [11:58:57] [debug] Native backtrace: [11:58:57] [debug] #0 77397ae2 in ?? () from C:\Windows\system32\ntdll.dll [11:58:57] [debug] #1 00492860 in ?? () from C:\Users\Mike\Desktop\Scripting\DM Server\samp-server.exe [11:58:57] [debug] #2 0040534e in ?? () from C:\Users\Mike\Desktop\Scripting\DM Server\samp-server.exe |
UpdatePlayer(playerid)
{
// AntiCheat
if(!JustRegistered[playerid])
{
new RealMoney = GetPlayerCash(playerid), String[128], PlayerName[MAX_PLAYER_NAME];
if(GetPlayerMoney(playerid) != RealMoney)
{
ResetPlayerMoney(playerid);
GivePlayerCash(playerid, RealMoney);
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking money - Cash Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
Log("Log/DebugLog.log", "Player hacking Money");
}
new Float: Health, Float: Armour;
GetPlayerHealth(playerid, Health);
GetPlayerArmour(playerid, Armour);
if(Health == 100)
{
if(PlayerInfo[playerid][pAdminLevel] == 0)
{
SetPlayerHealth(playerid, 99.0);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking health - Health Reset.", ReturnPlayerName(playerid));
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
Log("Log/DebugLog.log", "Player hacking Health.");
}
}
if(Armour == 100)
{
if(PlayerInfo[playerid][pAdminLevel] == 0)
{
SetPlayerArmour(playerid, 99.0);
format(String, sizeof(String), "AdmWarning: %s Is possibly hacking armour - Armour Reset.", ReturnPlayerName(playerid));
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid]++;
Log("Log/DebugLog.log", "Player hacking Armour.");
}
}
if(PlayerHacking[playerid] == 3)
{
SetPlayerHealth(playerid, 0.0);
SetPlayerArmour(playerid, 0.0);
ResetPlayerCash(playerid);
ResetPlayerWeapons(playerid);
BanPlayer(playerid, "General Cheats.", -1);
Log("Log/DebugLog.log", "Player Had Three Warnings");
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && PlayerInfo[playerid][pAdminLevel] <= 2)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); // Reset the player.
format(String, sizeof(String), "AdmWarning: %s Is possibly jetpack hacking - Jetpack Reset.", PlayerName);
SendClientMessageToAdmins(COLOR_AAC, String);
PlayerHacking[playerid] ++;
PlayerUsingJetpack[playerid] = true;
}
if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN && PlayerInfo[playerid][pAdminLevel] == 0)
{
BanPlayer(playerid, "General Cheats.", -1);
Log("Log/DebugLog.log", "Minigun Ban");
}
SetPlayerScore(playerid, PlayerInfo[playerid][pKills] - PlayerInfo[playerid][pDeaths]);
OnPlayerSave(playerid);
OnPlayerPingUpdate(playerid);
PlayerSeconds[playerid]++;
if(PlayerSeconds[playerid] == 60)
{
PlayerMinutes[playerid]++;
PlayerSeconds[playerid] = 0;
}
if(PlayerMinutes[playerid] == 60)
{
PlayerHours[playerid]++;
PlayerSeconds[playerid] = 0;
}
}
return 1;
}