rendered paste body#include <a_samp>// Uncomment the functions you want to use// They are all disabled by default for speed//#define ON_PLAYER_AMMO_CHANGE//#define ON_PLAYER_WEAPON_CHANGE//#define ON_PLAYER_HEALTH_CHANGE//#define ON_PLAYER_ARMOUR_CHANGE//#define ON_PLAYER_MONEY_CHANGE//#define ON_PLAYER_WEAPON_SLOT_CHANGE// Max time a player is allowed to be AFK (in milliseconds)#define MAX_AFK_TIME (2000)enum e_STATE{ e_STATE_NONE, e_STATE_CONNECTED, e_STATE_UPDATING}new gLastUpdate[MAX_PLAYERS], #if defined ON_PLAYER_AMMO_CHANGE gPlayerAmmo[MAX_PLAYERS], #endif #if defined ON_PLAYER_WEAPON_CHANGE gPlayerWeapon[MAX_PLAYERS], #endif #if defined ON_PLAYER_HEALTH_CHANGE Float:gPlayerHealth[MAX_PLAYERS], #endif #if defined ON_PLAYER_ARMOUR_CHANGE Float:gPlayerArmour[MAX_PLAYERS], #endif #if defined ON_PLAYER_MONEY_CHANGE gPlayerMoney[MAX_PLAYERS], #endif #if defined ON_PLAYER_WEAPON_SLOT_CHANGE gPlayerWeapons[MAX_PLAYERS][13], #endif e_STATE:gState[MAX_PLAYERS] = {e_STATE_NONE, ...};forward KickUpdate();public OnFilterScriptInit(){ print("\n---------------------------------------"); print(" _____.___.____ _____________"); print(" \\__ | | | \\______ \\"); print(" / | | | /| ___/"); print(" \\____ | | / | |"); print(" / ______|______/ |____|"); print(" \\/"); print(" Update script by Alex \"Y_Less\" Cole"); print("---------------------------------------\n"); SetTimer("KickUpdate", 100, 1); return 1;}public OnPlayerUpdate(playerid){ // Get the time of a player's last update gLastUpdate[playerid] = GetTickCount(); // When you first connect you don't send much, don't kick players for this gState[playerid] = e_STATE_UPDATING; #if defined ON_PLAYER_HEALTH_CHANGE || defined ON_PLAYER_ARMOUR_CHANGE || defined ON_PLAYER_GET_WEAPON new Float:tempf; #endif #if defined ON_PLAYER_WEAPON_CHANGE || defined ON_PLAYER_AMMO_CHANGE || defined ON_PLAYER_MONEY_CHANGE || defined ON_PLAYER_GET_WEAPON new temp; #endif #if defined ON_PLAYER_WEAPON_CHANGE temp = GetPlayerWeapon(playerid); if (temp != gPlayerWeapon[playerid]) { CallRemoteFunction("OnPlayerWeaponChange", "iii", playerid, gPlayerWeapon[playerid], temp); gPlayerWeapon[playerid] = temp; } #if defined ON_PLAYER_AMMO_CHANGE else { #endif #endif #if defined ON_PLAYER_AMMO_CHANGE temp = GetPlayerAmmo(playerid); if (temp != gPlayerAmmo[playerid]) { CallRemoteFunction("OnPlayerAmmoChange", "iii", playerid, gPlayerAmmo[playerid], temp); gPlayerAmmo[playerid] = temp; } #if defined ON_PLAYER_WEAPON_CHANGE } #endif #endif #if defined ON_PLAYER_HEALTH_CHANGE GetPlayerHealth(playerid, tempf); if (tempf != gPlayerHealth[playerid]) { CallRemoteFunction("OnPlayerHealthChange", "iff", playerid, gPlayerHealth[playerid], tempf); gPlayerHealth[playerid] = tempf; } #endif #if defined ON_PLAYER_ARMOUR_CHANGE GetPlayerArmour(playerid, tempf); if (tempf != gPlayerArmour[playerid]) { CallRemoteFunction("OnPlayerArmourChange", "iff", playerid, gPlayerArmour[playerid], tempf); gPlayerArmour[playerid] = tempf; } #endif #if defined ON_PLAYER_MONEY_CHANGE temp = GetPlayerMoney(playerid); if (temp != gPlayerMoney[playerid]) { CallRemoteFunction("OnPlayerMoneyChange", "iii", playerid, gPlayerMoney[playerid], temp); gPlayerMoney[playerid] = temp; } #endif #if defined ON_PLAYER_WEAPON_SLOT_CHANGE GetPlayerWeaponData(playerid, 0, temp, _:tempf); if (temp != gPlayerWeapons[playerid][0]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 0, gPlayerWeapons[playerid][0], temp); gPlayerWeapons[playerid][0] = temp; } GetPlayerWeaponData(playerid, 1, temp, _:tempf); if (temp != gPlayerWeapons[playerid][1]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 1, gPlayerWeapons[playerid][1], temp); gPlayerWeapons[playerid][1] = temp; } GetPlayerWeaponData(playerid, 2, temp, _:tempf); if (temp != gPlayerWeapons[playerid][2]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 2, gPlayerWeapons[playerid][2], temp); gPlayerWeapons[playerid][2] = temp; } GetPlayerWeaponData(playerid, 3, temp, _:tempf); if (temp != gPlayerWeapons[playerid][3]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 3, gPlayerWeapons[playerid][3], temp); gPlayerWeapons[playerid][3] = temp; } GetPlayerWeaponData(playerid, 4, temp, _:tempf); if (temp != gPlayerWeapons[playerid][4]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 4, gPlayerWeapons[playerid][4], temp); gPlayerWeapons[playerid][4] = temp; } GetPlayerWeaponData(playerid, 5, temp, _:tempf); if (temp != gPlayerWeapons[playerid][5]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 5, gPlayerWeapons[playerid][5], temp); gPlayerWeapons[playerid][5] = temp; } GetPlayerWeaponData(playerid, 6, temp, _:tempf); if (temp != gPlayerWeapons[playerid][6]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 6, gPlayerWeapons[playerid][6], temp); gPlayerWeapons[playerid][6] = temp; } GetPlayerWeaponData(playerid, 7, temp, _:tempf); if (temp != gPlayerWeapons[playerid][7]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 7, gPlayerWeapons[playerid][7], temp); gPlayerWeapons[playerid][7] = temp; } GetPlayerWeaponData(playerid, 8, temp, _:tempf); if (temp != gPlayerWeapons[playerid][8]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 8, gPlayerWeapons[playerid][8], temp); gPlayerWeapons[playerid][8] = temp; } GetPlayerWeaponData(playerid, 9, temp, _:tempf); if (temp != gPlayerWeapons[playerid][9]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 9, gPlayerWeapons[playerid][9], temp); gPlayerWeapons[playerid][9] = temp; } GetPlayerWeaponData(playerid, 10, temp, _:tempf); if (temp != gPlayerWeapons[playerid][10]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 10, gPlayerWeapons[playerid][10], temp); gPlayerWeapons[playerid][10] = temp; } GetPlayerWeaponData(playerid, 11, temp, _:tempf); if (temp != gPlayerWeapons[playerid][11]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 11, gPlayerWeapons[playerid][11], temp); gPlayerWeapons[playerid][11] = temp; } GetPlayerWeaponData(playerid, 12, temp, _:tempf); if (temp != gPlayerWeapons[playerid][12]) { CallRemoteFunction("OnPlayerWeaponChange", "iiii", playerid, 12, gPlayerWeapons[playerid][12], temp); gPlayerWeapons[playerid][12] = temp; } #endif return 1;}public OnPlayerConnect(playerid){ // Give new players some leway gState[playerid] = e_STATE_CONNECTED; #if defined ON_PLAYER_AMMO_CHANGE gPlayerAmmo[playerid] = 0; #endif #if defined ON_PLAYER_WEAPON_CHANGE gPlayerWeapon[playerid] = 0; #endif #if defined ON_PLAYER_HEALTH_CHANGE gPlayerHealth[playerid] = 100.0; #endif #if defined ON_PLAYER_ARMOUR_CHANGE gPlayerArmour[playerid] = 0.0; #endif #if defined ON_PLAYER_MONEY_CHANGE gPlayerMoney[playerid] = 0; #endif #if defined ON_PLAYER_WEAPON_SLOT_CHANGE new slot[13]; gPlayerWeapons[playerid] = slot; #endif return 1;}public OnPlayerDisconnect(playerid, reason){ gState[playerid] = e_STATE_NONE; return 1;}public KickUpdate(){ // Get the last valid time new time = GetTickCount() - MAX_AFK_TIME; // Loop through all players for (new i = 0; i < MAX_PLAYERS; i++) { if (gState[i] == e_STATE_UPDATING && time >= gLastUpdate[i]) { SendClientMessage(i, 0xFF0000AA, "You have been kicked for being out the game"); Kick(i); } }}