All pastes #825120 Raw Edit

Anonymous

public text v1 · immutable
#825120 ·published 2007-12-20 10:48 UTC
rendered paste body
/*
CREDITS:
-Woet, scripted everything
-mabako, made the boundry part

VISIT:
-http://www.uploadffs.com
-http://www.midna.nl

GREETINGS TO:
-Felle
-damospiderman
-Picklemick
-Hyperion
-alepet
-Bearz
-Popz
-h0z
-Tratulla
-Ali
-mabako
-yetihwelttil
-Kaz
-Carlambor
-Peter
-Jernejl (GO TO WORK!)


HUGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG <3
*/




























#include <a_samp>
#include <core>
#include <float>

//
// Forwards
//
forward Reset(playerid);
forward IsPlayerSpawned(playerid);
forward SendWarnMessage(playerid,adminid,reason[]);
forward SendKickMessage(playerid,adminid,reason[]);
forward SendBanMessage(playerid,adminid,reason[]);
forward SendAdminMessage(message[]);
forward GetPlayerID(name[]);
forward GiveID(const string[]);
forward FindUser(const string[]);
forward IsPlayerLevel(playerid,level);
forward mktime(second,minute,hour,day,month,year);
forward time();
forward Log(playerid,text[]);
forward AdminLog(playerid,text[]);
forward AdminChatLog(playerid,text[]);
forward Login(playerid,password[]);
forward IsPlayerRegistered(playerid);
forward IsPlayerLoggedIn(playerid);
forward PlayerToCoord(playerid,Float:x2,Float:y2,Float:z2);
forward PlayerToPlayer(playerid,targetid);
forward PlayerToCar(playerid,vehicleid);
forward antiSpawnKill();
forward Register(playername[], password[], level);
forward antiCheat();
forward updatetime();
forward showTime();
forward boundry();
forward alive();
forward FreezeMenu(playerid);
forward SetPlayerCash(playerid, cash);
forward GivePlayerCash(playerid, cash);
forward SetPlayerPoint(playerid, points);
forward GivePlayerPoint(playerid, points);
forward updatePos();
forward interiorOut(playerid);
forward Delete(name[]);
forward GetPlayerLevel(name[]);
forward Level(name[],level);
forward nicemessage();
forward SendTeamMessage(playerid, text[]);
forward antiSpam(playerid);
forward ping();
forward TimeStamp();
forward best();
forward weather();

//
// All variables used by all players
//
static gTeam[MAX_PLAYERS];
static gLogin[MAX_PLAYERS];
static gAuth[MAX_PLAYERS];
static gMute[MAX_PLAYERS];
static gMuteAdmin[MAX_PLAYERS];
static gMuteReason[MAX_PLAYERS][256];
static gFreeze[MAX_PLAYERS];
static gFreezeAdmin[MAX_PLAYERS];
static gFreezeReason[MAX_PLAYERS][256];
static gWarnings[MAX_PLAYERS];
static gProtected[MAX_PLAYERS];
static gMoney[MAX_PLAYERS];
static gScore[MAX_PLAYERS];
static gSpec[MAX_PLAYERS];
static gSpeccing[MAX_PLAYERS];
static gPrimary[MAX_PLAYERS];
static gSecondary[MAX_PLAYERS];
static gHand[MAX_PLAYERS];
static gNext[MAX_PLAYERS];
static gPistol[MAX_PLAYERS];
static gMenu[MAX_PLAYERS];
static gSpam[MAX_PLAYERS];
static gPingCount[MAX_PLAYERS][2];
static gInsurance[MAX_PLAYERS];
static gSuicide[MAX_PLAYERS];
static gSpecced[MAX_PLAYERS];
static gSpecAdmin[MAX_PLAYERS];
static gInvisibleKick[MAX_PLAYERS];

//
// Colors
//
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_REALRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_PURPLE 0xFF00FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_WHITE 0xFFFFFFAA

//
// Variables
//
new chatlock = 0;
new chatlockreason = 0;
new worldtime = 12;
new code = 3482394920184213657213429108821472819472190482152379847281903210974982356983274;
new codetext[256];
new codemoney;
new Menu:ChooseSecondary;
new Menu:ChooseHand;
new Menu:ChoosePrimary;
new Menu:ChooseOption;
new Menu:ChoosePistol;
new Menu:BuyPoint;
new Menu:Ammo;
new Menu:Health;
new Menu:Armor;
new Menu:Special;
new Float:players[ MAX_PLAYERS ][ 3 ][ 3 ];
new messagecount;

//
// Main
//
main(){
	print("\n----------------------------------");
	print("Desert TDM v1.5 by Woet");
	print("----------------------------------\n");
}

//
// When gamemode launches
//
public OnGameModeInit(){
	//
	// Global vars
	//
	ShowNameTags(1);
	ShowPlayerMarkers(1);
	SetGameModeText("Desert TDM");
	EnableTirePopping(1);
	AllowInteriorWeapons(0);
	SetWeather(6);
    EnableZoneNames(0);
    UsePlayerPedAnims();
    SetDisabledWeapons(1,2,3,4,7,9,11,12,13,14,15,16,17,18,33,34,35,36,37,38,39,40,41,42,43,44,45);

	//
	// Set time
	//
	SetWorldTime(12);
	SetTimer("updatetime", 120000, 1);

	//
	// Anti spawnkill
	//
	SetTimer("antiSpawnKill", 1000, 1);

	//
	// Are you alive? :]
	//
	SetTimer("alive", 120000, 0);

	//
	// Save their position!
	//
	SetTimer("updatePos", 2000, 1);

	//
	// Nice message :)
	//
	SetTimer("nicemessage", 120000, 1);

	//
	// Go away laggers
	//
	SetTimer("ping", 5000, 1);

	//
	// Your tha best!
	//
	SetTimer("best", 300000, 1);

	//
	// Weather ftw
	//
	SetTimer("weather", 90000, 1);
	
	//
	// Spawns
	//
	AddPlayerClass(283,-1394.5950,2643.2791,55.8932,100.2026,0,0,0,0,0,0); // upstanding citizens
	AddPlayerClass(159,-733.8346,1624.4266,27.1172,79.2481,0,0,0,0,0,0); // crazy farmers
	AddPlayerClass(247,-321.6065,1056.7443,19.7422,2.5328,0,0,0,0,0,0); // bailed criminals
	AddPlayerClass(287,184.2655,1931.6104,17.8262,94.2981,0,0,0,0,0,0); // private military
	AddPlayerClass(2,-251.0042,2588.0261,63.5703,307.6865,0,0,0,0,0,0); // retarted cops

	//
	// Objects
	//
	CreateObject(1227, -1455.218872, 2592.125488, 55.437645, 0, 0, 180);
	CreateObject(1227, -1455.237305, 2592.119141, 56.336430, 0, 0.8594, 180);
	CreateObject(1227, -253.278824, 2597.870605, 62.856621, 0, 0, 90);
	CreateObject(1227, -253.575562, 2599.304199, 62.609871, 0, 0, 90);
	CreateObject(1227, -253.278824, 2597.838135, 64.127953, 0, 0, 90);
	CreateObject(1227, -253.520905, 2599.252686, 63.861095, 0, 0, 90);
	CreateObject(987, -259.202423, 2593.860840, 59.973866, 0, 0, 22.5);
	CreateObject(987, -248.311707, 2598.385254, 59.958054, 0, 0, 157.5);
	CreateObject(987, -1454.746216, 2596.526855, 52.360909, 0, 0, 292.5);
	CreateObject(987, -1454.765381, 2596.493408, 52.385925, 0, 0, 236.25);
	CreateObject(1227, -862.782837, 1536.546265, 22.298206, 0, 0, 180);
	CreateObject(1227, -862.770630, 1536.551270, 23.427113, 0, 0, 180);
	CreateObject(987, -861.135742, 1527.999634, 19.087698, 0, 0, 90);
	CreateObject(987, -861.002930, 1539.972412, 19.087645, 0, 0, 225);
	CreateObject(987, -869.471802, 1531.592651, 19.123978, 0, 0, 314.9999);
	CreateObject(983, -251.729111, 2597.646484, 64.961777, 359.1406, 96.2569, 293.3595);
	CreateObject(983, -252.803482, 2598.141357, 65.422218, 359.1406, 96.2569, 293.3595);
	CreateObject(983, -254.210938, 2598.828613, 65.628059, 359.1406, 96.2569, 293.3595);
	CreateObject(983, -1453.540039, 2593.700928, 57.521065, 0, 91.9598, 22.5);
	CreateObject(983, -1453.972290, 2592.803223, 57.828777, 0, 91.9598, 22.5);
	CreateObject(983, -1455.623047, 2593.670166, 57.921028, 0, 276.6346, 359.1406);
	CreateObject(983, -1456.109619, 2593.597412, 57.789864, 0, 268.0403, 326.25);
	CreateObject(983, -1454.819214, 2591.032471, 57.464783, 0, 274.0563, 0);
	CreateObject(983, -861.741760, 1536.929810, 24.278406, 0, 264.6025, 0);
	CreateObject(983, -863.422852, 1536.828735, 24.153584, 0, 269.7591, 315);
	CreateObject(972, 224.435760, 1867.391602, 9.137506, 0, 0, 0);
	CreateObject(975, 214.463959, 1875.917114, 13.821650, 0, 0, 0);

	//
	// Vehicles
	//
	AddStaticVehicle(468, 906.271545, 1016.849670, 12.637600, 33, -1, -1);
	AddStaticVehicle(412, 844.510132, 1189.678223, 27.374863, 360, -1, -1);
	AddStaticVehicle(463, 526.572571, 1045.812744, 28.368513, 282, -1, -1);
	AddStaticVehicle(541, 303.263000, 1402.076172, 8.955420, 360, -1, -1);
	AddStaticVehicle(412, 319.528320, 1400.276733, 7.539894, 360, -1, -1);
	AddStaticVehicle(561, 430.408386, 1622.946655, 17.068489, 293, -1, -1);
	AddStaticVehicle(456, 588.087463, 1646.489014, 6.652565, 67, -1, -1);
	AddStaticVehicle(471, 601.753662, 1651.383789, 6.652565, 22, -1, -1);
	AddStaticVehicle(463, 653.181274, 1716.299805, 6.659906, 360, -1, -1);
	AddStaticVehicle(561, 662.041504, 1806.315063, 5.148039, 78, -1, -1);
	AddStaticVehicle(415, 668.852661, 1832.487183, 4.839073, 360, -1, -1);
	AddStaticVehicle(588, 675.840454, 1829.091797, 4.885698, 360, -1, -1);
	AddStaticVehicle(445, 696.277039, 1941.904297, 5.199440, 157, -1, -1);
	AddStaticVehicle(420, 714.223938, 1942.389282, 5.199440, 168, -1, -1);
	AddStaticVehicle(567, 782.436951, 1887.509766, 4.670862, 282, -1, -1);
	AddStaticVehicle(567, 783.443237, 1874.056030, 4.520521, 338, -1, -1);
	AddStaticVehicle(456, 784.404968, 1922.524048, 5.347878, 123, -1, -1);
	AddStaticVehicle(445, 789.294312, 2020.162842, 5.957750, 67, -1, -1);
	AddStaticVehicle(463, 679.584534, 2223.311035, 24.185936, 360, -1, -1);
	AddStaticVehicle(422, 654.430176, 2584.806152, 28.931374, 360, -1, -1);
	AddStaticVehicle(593,290.2563,2538.4377,16.3596,170.2159,-1,-1);
	AddStaticVehicle(593,324.9756,2536.8103,16.3473,178.2893,-1,-1);
	AddStaticVehicle(545,382.8270,2539.7546,16.0785,89.1131,-1,-1);
	AddStaticVehicle(440,383.9177,2560.2517,16.0904,27.4864,-1,-1);
	AddStaticVehicle(547,-1399.2861,2631.4751,55.7706,86.1025,-1,-1);
	AddStaticVehicle(567,-1411.2469,2656.8931,55.3094,204.4431,-1,-1);
	AddStaticVehicle(445,-1399.4615,2651.7119,55.3124,238.1548,-1,-1);
	AddStaticVehicle(422,-1399.7427,2637.6387,55.3122,268.1987,-1,-1);
	AddStaticVehicle(422,-1420.6659,2621.7732,55.3834,0.8577,-1,-1);
	AddStaticVehicle(413,-1437.3376,2656.7180,55.4610,357.5930,-1,-1);
	AddStaticVehicle(456,-1466.1102,2606.6946,55.9297,92.3991,-1,-1);
	AddStaticVehicle(415,-1490.4409,2616.9976,55.3836,0.3744,-1,-1);
	AddStaticVehicle(415,-1472.2163,2697.6729,55.4093,176.5308,-1,-1);
	AddStaticVehicle(524,-1495.0291,2703.5686,55.4071,89.7649,-1,-1);
	AddStaticVehicle(535,-1563.0865,2663.6814,55.4610,90.8669,-1,-1);
	AddStaticVehicle(463,-1550.6055,2613.1628,55.3850,358.4211,-1,-1);
	AddStaticVehicle(525,-1547.4119,2551.2021,55.3842,211.4803,-1,-1);
	AddStaticVehicle(463,-1502.4109,2577.2095,55.4611,5.8877,-1,-1);
	AddStaticVehicle(420,-1263.2976,2713.1133,49.6876,355.9517,-1,-1);
	AddStaticVehicle(509,-1275.4048,2705.0037,49.6876,197.4953,-1,-1);
	AddStaticVehicle(471,-1266.6541,2711.3706,49.6933,150.8640,-1,-1);
	AddStaticVehicle(471,-1311.2288,2702.0649,49.6874,186.8068,-1,-1);
	AddStaticVehicle(541,-1444.6453,2731.6123,64.2421,71.6616,-1,-1);
	AddStaticVehicle(561,-1571.4023,2726.6624,60.2075,98.2282,-1,-1);
	AddStaticVehicle(524,-737.4963,1643.7805,26.983-1,-178.6222,-1,-1);
	AddStaticVehicle(583,-748.6228,1645.0568,26.9265,168.0734,-1,-1);
	AddStaticVehicle(471,-766.0641,1641.9635,27.0757,45.0177,-1,-1);
	AddStaticVehicle(576,-759.4797,1626.4730,26.7422,263.6198,-1,-1);
	AddStaticVehicle(468,-778.4099,1628.5500,26.7491,123.0067,-1,-1);
	AddStaticVehicle(444,-756.2526,1589.8672,26.5859,150.3240,-1,-1);
	AddStaticVehicle(471,-706.7706,1441.2397,18.1016,7.6059,-1,-1);
	AddStaticVehicle(413,-738.9677,1486.8907,23.6617,64.7629,-1,-1);
	AddStaticVehicle(422,-771.6180,1443.8713,13.4527,137.8059,-1,-1);
	AddStaticVehicle(429,-786.7217,1428.6246,13.4629,333.4239,-1,-1);
	AddStaticVehicle(575,-808.0195,1446.4460,13.4971,81.3889,-1,-1);
	AddStaticVehicle(409,-852.802-1,-1421.5721,13.3951,205.7993,-1,-1);
	AddStaticVehicle(567,-828.9178,1498.5365,18.7960,86.2183,-1,-1);
	AddStaticVehicle(463,-866.0620,1541.2053,22.3088,274.5798,-1,-1);
	AddStaticVehicle(413,-865.8810,1552.4216,23.2817,72.1642,-1,-1);
	AddStaticVehicle(547,-866.5358,1567.1469,24.4684,32.9128,-1,-1);
	AddStaticVehicle(575,-903.4521,1548.9772,25.5194,353.3472,-1,-1);
	AddStaticVehicle(415,-885.5550,1523.0334,25.5388,243.0238,-1,-1);
	AddStaticVehicle(413,-932.3776,1422.8518,29.7501,171.3751,-1,-1);
	AddStaticVehicle(412,-768.9281,1509.3065,25.0140,356.0026,-1,-1);
	AddStaticVehicle(463,-793.0693,1542.2157,26.6036,94.1161,-1,-1);
	AddStaticVehicle(422,-801.5713,1601.6085,26.6561,354.2005,-1,-1);
	AddStaticVehicle(456,-839.8713,1604.7076,26.6703,281.9255,-1,-1);
	AddStaticVehicle(413,-305.7297,1011.6077,19.2183,80.9237,-1,-1);
	AddStaticVehicle(429,-305.8649,1017.2133,19.2189,315.9489,-1,-1);
	AddStaticVehicle(420,-305.5986,1031.8375,19.2182,84.3091,-1,-1);
	AddStaticVehicle(541,-290.2163,1044.0137,19.2440,2.7026,-1,-1);
	AddStaticVehicle(429,-301.6657,1069.3833,19.3181,96.2926,-1,-1);
	AddStaticVehicle(587,-310.2428,1085.6373,19.3678,176.0323,-1,-1);
	AddStaticVehicle(468,-330.648-1,-1065.1300,19.3664,271.8984,-1,-1);
	AddStaticVehicle(463,-354.9519,1106.8188,19.3567,41.8610,-1,-1);
	AddStaticVehicle(477,-360.4245,1197.6466,19.3596,178.9912,-1,-1);
	AddStaticVehicle(429,-256.0686,1158.1448,19.3725,271.1678,-1,-1);
	AddStaticVehicle(567,-238.4327,1221.8577,19.3669,349.5958,-1,-1);
	AddStaticVehicle(506,-252.9423,1211.2950,19.3676,261.7472,-1,-1);
	AddStaticVehicle(575,-199.0901,1223.0026,19.3672,4.3578,-1,-1);
	AddStaticVehicle(587,-209.1190,1226.7495,19.3618,98.2883,-1,-1);
	AddStaticVehicle(409,-184.7276,1130.8678,19.3280,188.7554,-1,-1);
	AddStaticVehicle(463,-220.2828,1092.4733,19.3306,97.1592,-1,-1);
	AddStaticVehicle(471,-185.4255,1036.4297,19.2890,186.0785,-1,-1);
	AddStaticVehicle(567,-123.9884,888.1815,18.9006,51.1348,-1,-1);
	AddStaticVehicle(444,-79.5160,932.2335,20.2122,346.0010,-1,-1);
	AddStaticVehicle(444,-31.1763,956.0410,19.1622,53.4364,-1,-1);
	AddStaticVehicle(413,-15.5665,978.7767,19.4963,307.2029,-1,-1);
	AddStaticVehicle(525,42.2830,1002.4468,17.2371,353.8121,-1,-1);
	AddStaticVehicle(506,120.956-1,-1052.8921,13.234-1,-179.5415,-1,-1);
	AddStaticVehicle(429,104.8625,1071.6541,13.2345,189.9687,-1,-1);
	AddStaticVehicle(445,123.4219,1076.4353,13.2348,177.0088,-1,-1);
	AddStaticVehicle(413,118.0614,1108.3141,13.2337,358.9442,-1,-1);
	AddStaticVehicle(463,51.3876,1210.5883,18.5327,91.7294,-1,-1);
	AddStaticVehicle(409,66.2620,1179.5868,18.2885,291.1401,-1,-1);
	AddStaticVehicle(588,81.1157,1165.2614,18.2857,83.9657,-1,-1);
	AddStaticVehicle(588,-20.4265,1227.6368,19.0630,93.8055,-1,-1);
	AddStaticVehicle(422,-3.2001,1238.4734,18.9785,178.8604,-1,-1);
	AddStaticVehicle(541,1.7061,1167.0304,19.1756,181.1840,-1,-1);
	AddStaticVehicle(583,17.0943,1165.842-1,-19.1921,241.5235,-1,-1);
	AddStaticVehicle(444,-42.2918,1165.056-1,-19.1719,246.6628,-1,-1);
	AddStaticVehicle(506,-33.5260,1143.0715,19.2910,93.8599,-1,-1);
	AddStaticVehicle(412,-71.0199,1111.3271,19.2871,176.4041,-1,-1);
	AddStaticVehicle(506,-80.1434,1078.0978,19.3669,177.6294,-1,-1);
	AddStaticVehicle(583,-108.609-1,-1103.7733,19.2899,89.0844,-1,-1);
	AddStaticVehicle(525,-148.5494,1082.4767,19.3691,353.1048,-1,-1);
	AddStaticVehicle(429,168.4480,1934.287-1,-18.0664,181.9625,-1,-1);
	AddStaticVehicle(463,175.0586,1933.2695,17.8096,180.2549,-1,-1);
	AddStaticVehicle(535,210.5673,1919.7947,17.2656,87.4488,-1,-1);
	AddStaticVehicle(420,177.8536,1907.1600,17.7186,0.1131,-1,-1);
	AddStaticVehicle(541,140.3389,1916.3646,18.5712,88.1238,-1,-1);
	AddStaticVehicle(415,102.0665,1892.0979,17.7293,269.4406,-1,-1);
	AddStaticVehicle(422,100.4729,1866.350-1,-17.3644,355.4272,-1,-1);
	AddStaticVehicle(535,129.4773,1850.779-1,-17.3184,90.8901,-1,-1);
	AddStaticVehicle(413,166.9568,1829.7693,17.2703,0.6207,-1,-1);
	AddStaticVehicle(422,193.8089,1808.2306,17.2659,39.7433,-1,-1);
	AddStaticVehicle(541,229.8319,1887.4211,17.2670,5.4804,-1,-1);
	AddStaticVehicle(547,-201.2112,2595.8496,62.3280,16.8266,-1,-1);
	AddStaticVehicle(575,-205.4152,2608.7310,62.3277,347.0627,-1,-1);
	AddStaticVehicle(429,-231.6441,2609.0623,62.3287,237.3181,-1,-1);
	AddStaticVehicle(583,-241.2001,2594.8872,62.3281,11.1642,-1,-1);
	AddStaticVehicle(575,-227.6827,2592.1785,62.3973,202.6982,-1,-1);
	AddStaticVehicle(525,-237.2302,2627.4956,62.3330,90.2801,-1,-1);
	AddStaticVehicle(535,-262.0178,2662.7747,62.2359,358.3932,-1,-1);
	AddStaticVehicle(413,-273.1066,2675.3167,62.2615,270.5418,-1,-1);
	AddStaticVehicle(444,-225.7179,2695.1040,62.2748,279.7275,-1,-1);
	AddStaticVehicle(422,-182.7448,2722.0940,62.2352,7.4132,-1,-1);
	AddStaticVehicle(463,-164.2666,2686.2761,62.1570,1.2893,-1,-1);
	AddStaticVehicle(576,-149.7491,2728.0947,61.691-1,-172.5766,-1,-1);
	AddStaticVehicle(587,-161.2165,2770.1079,62.2969,171.3407,-1,-1);
	AddStaticVehicle(541,-205.3898,2728.6299,62.3123,358.5861,-1,-1);
	AddStaticVehicle(509,-231.8817,2726.6931,62.3126,91.0253,-1,-1);
	AddStaticVehicle(575,-263.3339,2720.6165,62.3185,186.2390,-1,-1);
	AddStaticVehicle(413,-277.4811,2685.0862,62.2842,358.6736,-1,-1);
	AddStaticVehicle(576,-327.2713,2657.1350,63.2983,88.3093,-1,-1);
	AddStaticVehicle(561,-284.4737,2664.8013,62.2581,171.1799,-1,-1);
	AddStaticVehicle(583,-349.2129,2666.3630,64.1739,46.9931,-1,-1);
	AddStaticVehicle(429,-1463.7504,2369.7310,52.6309,92.2359,-1,-1);
	AddStaticVehicle(587,-1711.5103,2326.7546,31.4144,142.1869,-1,-1);
	AddStaticVehicle(415,-1817.3459,2041.5509,8.2606,39.9400,-1,-1);
	AddStaticVehicle(587,-1800.5823,2043.6740,8.7359,299.2476,-1,-1);
	AddStaticVehicle(509,-1991.7937,2322.3005,22.4870,354.7424,-1,-1);
	AddStaticVehicle(415,-1939.0344,2390.3831,49.1171,115.1967,-1,-1);
	AddStaticVehicle(561,-1933.8927,2379.7573,49.1247,235.0596,-1,-1);
	AddStaticVehicle(583,-1915.9368,2360.7852,47.8109,271.4160,-1,-1);
	AddStaticVehicle(524,-1649.3271,2066.8386,18.1170,195.0745,-1,-1);
	AddStaticVehicle(471,-1525.2631,1836.2568,29.1451,263.2952,-1,-1);
	AddStaticVehicle(541,-1274.5671,1740.3247,17.8707,264.6907,-1,-1);
	AddStaticVehicle(506,-1207.0663,1810.6445,41.3441,331.4899,-1,-1);
	AddStaticVehicle(547,-1197.7006,1820.5166,41.3438,225.5501,-1,-1);
	AddStaticVehicle(525,-1215.5883,1846.9668,41.1934,46.6991,-1,-1);
	AddStaticVehicle(477,-906.4188,1988.1740,60.5389,90.4961,-1,-1);
	AddStaticVehicle(420,-918.9186,1999.4799,60.5393,291.4976,-1,-1);
	AddStaticVehicle(420,-909.4289,2021.1453,60.5387,258.3463,-1,-1);
	AddStaticVehicle(561,-933.2523,2018.4424,60.5390,308.1467,-1,-1);
	AddStaticVehicle(525,-432.2601,2224.4365,42.0018,353.9135,-1,-1);
	AddStaticVehicle(412,-403.5657,2250.2427,42.0014,288.7562,-1,-1);
	AddStaticVehicle(588,-429.3867,1994.8099,74.5537,136.3332,-1,-1);
	AddStaticVehicle(409,-290.3193,1748.0605,42.3169,300.4565,-1,-1);
	AddStaticVehicle(535,-288.6798,1762.4624,42.3125,88.8632,-1,-1);
	AddStaticVehicle(587,-302.1125,1768.7463,42.3121,29.6429,-1,-1);
	AddStaticVehicle(471,-1359.5851,2051.0520,52.0869,93.2973,-1,-1);
	AddStaticVehicle(429,-1373.0815,2062.4097,52.2110,346.4612,-1,-1);
	AddStaticVehicle(444,-1507.1261,1975.6212,47.9894,354.8489,-1,-1);
	AddStaticVehicle(547,-1500.3285,1946.7206,48.1724,269.8910,-1,-1);
	AddStaticVehicle(506,-1486.2063,1877.8813,32.2579,186.3369,-1,-1);
	AddStaticVehicle(468,-1466.4763,1869.8313,32.2597,273.9136,-1,-1);
	AddStaticVehicle(471,-836.8705,1097.5946,32.5249,197.0592,-1,-1);
	AddStaticVehicle(409,-672.4380,955.6550,11.7580,179.0346,-1,-1);
	AddStaticVehicle(456,-688.0450,957.1738,11.7788,92.3171,-1,-1);
	AddStaticVehicle(547,-677.9335,962.3325,11.7604,0.7791,-1,-1);
	AddStaticVehicle(471,-686.6831,962.5955,11.7632,3.0077,-1,-1);
	AddStaticVehicle(409,-788.7913,704.9814,18.3850,238.4808,-1,-1);
	AddStaticVehicle(471,-450.6845,609.1823,16.4644,145.3357,-1,-1);
	AddStaticVehicle(509,-313.5707,803.8435,14.7347,357.1109,-1,-1);
	AddStaticVehicle(575,-318.2125,820.8584,13.9190,270.6082,-1,-1);
	AddStaticVehicle(463,303.4321,732.3605,7.7207,334.5540,-1,-1);
	AddStaticVehicle(468,688.9692,682.9720,8.6461,280.8177,-1,-1);
	AddStaticVehicle(422,830.0168,851.6343,11.6585,281.6622,-1,-1);
	AddStaticVehicle(456,722.5506,1192.6431,13.1566,347.3993,-1,-1);
	AddStaticVehicle(444,632.9728,1261.7307,11.3381,280.5494,-1,-1);
	AddStaticVehicle(471,638.6220,1250.2339,11.2677,183.2343,-1,-1);
	AddStaticVehicle(413,577.4530,1218.0609,11.3515,221.7321,-1,-1);
	AddStaticVehicle(477,512.8015,1126.0031,13.6834,54.2465,-1,-1);
	AddStaticVehicle(547,313.7537,1139.3367,8.2186,79.0608,-1,-1);
	AddStaticVehicle(561,-289.3626,1116.0436,19.8076,177.5774,-1,-1);
	AddStaticVehicle(525,841.6210,1541.3939,17.8517,319.5254,-1,-1);
	AddStaticVehicle(471,382.8270,2539.7546,16.0785,89.1131,-1,-1);
	AddStaticVehicle(588,383.9177,2560.2517,16.0904,27.4864,-1,-1);
	AddStaticVehicle(583,678.8978,2110.2302,17.6455,172.8832,-1,-1);
	AddStaticVehicle(575,-782.1928,2750.8564,45.5309,263.6770,-1,-1);
	AddStaticVehicle(444,-742.2373,2750.9919,47.1001,179.6838,-1,-1);
	AddStaticVehicle(413,-821.8776,2758.7529,45.7223,285.4342,-1,-1);
	AddStaticVehicle(567,-862.7127,2755.8411,45.7229,270.0028,-1,-1);
	AddStaticVehicle(429,-893.4011,2702.7048,42.2464,243.4622,-1,-1);
	AddStaticVehicle(535,-553.5084,2716.6223,65.5578,226.2689,-1,-1);
	AddStaticVehicle(509,-510.8720,2630.6553,53.2881,26.3336,-1,-1);
	AddStaticVehicle(445,-519.3713,2611.0249,53.2855,295.9069,-1,-1);
	AddStaticVehicle(541,-540.6998,2582.4885,53.2926,239.4546,-1,-1);
	AddStaticVehicle(524,-523.8633,2568.7300,53.3679,241.5073,-1,-1);
	AddStaticVehicle(576,-415.9417,2459.3633,44.5552,120.8632,-1,-1);
	AddStaticVehicle(575,-624.1248,2473.2458,74.6509,48.9400,-1,-1);
	AddStaticVehicle(463,-847.5779,2423.4553,120.3866,164.1819,-1,-1);
	AddStaticVehicle(524,-730.7629,2349.4160,125.8305,266.9761,-1,-1);
	AddStaticVehicle(445,525.8647,2356.4534,31.1162,159.9682,-1,-1);
	AddStaticVehicle(445,-87.6346,2569.7703,17.6418,198.6958,-1,-1);
	AddStaticVehicle(588,-84.3997,1342.2336,10.2673,160.2022,-1,-1);
	AddStaticVehicle(588,-98.4329,1338.8177,9.8444,79.3171,-1,-1);
	AddStaticVehicle(525,-1522.5328,2529.7163,55.4038,3.1565,-1,-1);
	AddStaticVehicle(412,-222.6658,2595.3018,62.2175,316.2845,-1,-1);
	AddStaticVehicle(445,-276.3699,2589.9861,63.1119,174.8524,-1,-1);
	AddStaticVehicle(575,-298.6087,2610.0000,63.0348,353.7388,-1,-1);
	AddStaticVehicle(463,-295.0529,2609.2588,62.9194,345.0119,-1,-1);
	AddStaticVehicle(487,-168.8790,2652.5044,63.1865,281.5857,-1,-1);
	AddStaticVehicle(513,265.7367,2533.3311,16.2940,174.5457,-1,-1);
	AddStaticVehicle(513,223.3597,2534.4478,16.2145,167.8589,-1,-1);
	AddStaticVehicle(487,357.3448,2539.5281,16.2442,171.7309,-1,-1);
	AddStaticVehicle(487,228.5010,1908.6528,17.1601,99.1504,-1,-1);
	AddStaticVehicle(487,-287.4342,1211.6553,19.2612,189.8407,-1,-1);
	AddStaticVehicle(487,-733.3394,1520.9110,37.9057,0.0557,-1,-1);
	AddStaticVehicle(487,-1525.3237,2636.6516,55.5404,273.7487,-1,-1);
	AddStaticVehicle(567,-1400.3826,2648.2952,55.6719,31.9705,-1,-1);
	AddStaticVehicle(413,-1390.3942,2627.7170,55.9710,5.5927,-1,-1);
	AddStaticVehicle(541,-1410.7639,2632.1833,55.6740,67.8900,-1,-1);
	AddStaticVehicle(468,-1433.6299,2633.7061,55.8172,195.5999,-1,-1);
	AddStaticVehicle(415,-734.8799,1623.7214,26.7271,263.6269,-1,-1);
	AddStaticVehicle(471,-322.6968,1074.5054,19.3381,8.8847,-1,-1);
	AddStaticVehicle(413,-313.3278,1104.0696,19.3401,268.1991,-1,-1);
	AddStaticVehicle(547,-289.4848,1089.2935,19.4219,228.8604,-1,-1);
	AddStaticVehicle(525,-282.6940,1054.0261,19.4220,189.8490,-1,-1);
	AddStaticVehicle(525,192.5705,1901.3212,17.1653,116.4108,-1,-1);
	AddStaticVehicle(547,176.3067,1889.0280,20.1172,79.3936,-1,-1);
	AddStaticVehicle(409,175.0368,1872.6005,20.3134,203.1233,-1,-1);
	AddStaticVehicle(413,208.6663,1858.6287,20.1814,268.5108,-1,-1);
	AddStaticVehicle(509,251.5676,1895.3811,20.1734,169.7996,-1,-1);
	AddStaticVehicle(575,-208.7240,2611.1819,62.5282,186.0562,-1,-1);
	AddStaticVehicle(412,-213.3560,2596.1616,62.4405,137.0589,-1,-1);
	AddStaticVehicle(541,-243.6388,2608.6184,62.4723,68.6031,-1,-1);
	AddStaticVehicle(513,248.4418,2532.2568,17.3012,180.6818,-1,-1);
	AddStaticVehicle(519,403.8629,2453.5754,17.0422,357.6751,-1,-1);
	AddStaticVehicle(553,95.6526,2535.0930,16.0469,185.9408,66,71);

	//
	// FISH!
	//
	CreateObject(1607, 467.110596, -2132.258301, -27.557951, -1, -1, -1);
    CreateObject(1607, 465.179901, -2136.499268, -24.482952, -1, -1, -1);

	//
	// Weapon Menu
	//
	ChoosePistol = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(ChoosePistol, 0, "Pistol:");
	AddMenuItem(ChoosePistol, 0, "Pistol (15O Ammo)");
    AddMenuItem(ChoosePistol, 0, "Silenced Pistol (125 Ammo)");
    AddMenuItem(ChoosePistol, 0, "Deagle (70 Ammo)");

	ChooseHand = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(ChooseHand, 0, "Hand Weapon:");
	AddMenuItem(ChooseHand, 0, "Katana");
    AddMenuItem(ChooseHand, 0, "Baseball Bat");
    AddMenuItem(ChooseHand, 0, "Shovel");
    AddMenuItem(ChooseHand, 0, "Dildo");

	ChoosePrimary = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(ChoosePrimary, 0, "Primary Weapon:");
	AddMenuItem(ChoosePrimary, 0, "Shotgun (125 Ammo)");
	AddMenuItem(ChoosePrimary, 0, "Sawnoff Shotgun (125 Ammo)");
    AddMenuItem(ChoosePrimary, 0, "M4AI (250 Ammo)");
    AddMenuItem(ChoosePrimary, 0, "AK47 (250 Ammo)");

	ChooseSecondary = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(ChooseSecondary, 0, "Secondary Weapon:");
	AddMenuItem(ChooseSecondary, 0, "MP5 (350 Ammo)");
	AddMenuItem(ChooseSecondary, 0, "TEC9 (350 Ammo)");
	AddMenuItem(ChooseSecondary, 0, "Uzi (350 Ammo)");

	ChooseOption = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(ChooseOption, 0, "Next Time:");
	AddMenuItem(ChooseOption, 0, "Ask me again");
    AddMenuItem(ChooseOption, 0, "Use this selection");

	BuyPoint = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(BuyPoint, 0, "Buy:");
	AddMenuItem(BuyPoint, 0, "Ammo");
	AddMenuItem(BuyPoint, 0, "Health");
	AddMenuItem(BuyPoint, 0, "Armor");
	AddMenuItem(BuyPoint, 0, "Life Insurance");

	Ammo = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(Ammo, 0, "Ammo Amount:");
	AddMenuItem(Ammo, 0, "50 (1500$)");
	AddMenuItem(Ammo, 0, "100 (3000$)");
	AddMenuItem(Ammo, 0, "250 (7500$)");
	AddMenuItem(Ammo, 0, "500 (15000$)");

	Health = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(Health, 0, "Health Amount:");
	AddMenuItem(Health, 0, "10 (800$)");
	AddMenuItem(Health, 0, "25 (2000$)");
	AddMenuItem(Health, 0, "50 (4000$)");
	AddMenuItem(Health, 0, "75 (6000$)");
	AddMenuItem(Health, 0, "100 (8000$)");

	Armor = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(Armor, 0, "Armor Amount:");
	AddMenuItem(Armor, 0, "10 (800$)");
	AddMenuItem(Armor, 0, "25 (2000$)");
	AddMenuItem(Armor, 0, "50 (4000$)");
	AddMenuItem(Armor, 0, "75 (6000$)");
	AddMenuItem(Armor, 0, "100 (8000$)");

	Special = CreateMenu("Menu", 1, 350, 100, 200, 50);
	SetMenuColumnHeader(Special, 0, "Special:");
	AddMenuItem(Special, 0, "Life Insurance 25% (2500$)");
	AddMenuItem(Special, 0, "Life Insurance 50% (5000$)");
	AddMenuItem(Special, 0, "Life Insurance 75% (7500$)");
	AddMenuItem(Special, 0, "Life Insurance 100% (10000$)");

	return 1;
}

//
// Hahah, laggers ftl
//
public ping(){
	new string[256];
	for(new x=0; x<MAX_PLAYERS; x++) {
	    if(IsPlayerConnected(x)){
		    if(GetPlayerPing(x) > 600) {
				if(gPingCount[x][0] == 0) { gPingCount[x][1] = TimeStamp(); }

	    		gPingCount[x][0]++;
				if(TimeStamp() - gPingCount[x][1] > 20) {
		    		gPingCount[x][1] = TimeStamp();
					gPingCount[x][0] = 1;
				}
				else if(gPingCount[x][0] == 3) {
				    gInvisibleKick[x] = 1;
					format(string,sizeof(string),"Maximum ping is 600 (Ping: %i)", GetPlayerPing(x));
					SendKickMessage(x, 999, string);
				}
			}
		}
	}
	return 1;
}

//
// Timestamp needed :D
//
public TimeStamp()
{
	new tim2e = GetTickCount() / 1000;
	return tim2e;
}

//
// Intercepting pm's >:)
//
public OnPlayerPrivmsg(playerid, recieverid, text[]){
	new playerstring[256], receiverstring[256], log[256], sender[256], receiver[256];

	GetPlayerName(recieverid, receiver, sizeof(receiver));
	GetPlayerName(playerid, sender, sizeof(sender));

	format(log, sizeof(log), "PM from %s sent to %s: %s", sender, receiver, text);
	format(playerstring, sizeof(playerstring), "PM succesfully sent to %s (%i)", receiver, recieverid);
	format(receiverstring, sizeof(receiverstring), "PM From %s (%i): %s", sender, playerid, text);

	SendClientMessage(playerid, COLOR_LIGHTBLUE, playerstring);
	SendClientMessage(recieverid, COLOR_LIGHTBLUE, receiverstring);

	Log(playerid, log);
	
	return 0;
}

//
// When player chooses something from the weapon menu
//
public OnPlayerSelectedMenuRow(playerid,row)
{
	new Menu:Current = GetPlayerMenu(playerid);
	
	if(Current == ChoosePistol){
		switch(row){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 22, 150);
		        gPistol[playerid] = 0;
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 23, 125);
		        gPistol[playerid] = 1;
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 24, 70);
		        gPistol[playerid] = 2;
			}
		}

	    ShowMenuForPlayer(ChooseSecondary, playerid);
	}
	if(Current == ChooseSecondary){
		switch(row){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 29, 350);
		        gSecondary[playerid] = 0;
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 32, 350);
		        gSecondary[playerid] = 1;
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 28, 350);
		        gSecondary[playerid] = 2;
			}
		}

	    ShowMenuForPlayer(ChoosePrimary, playerid);
	}
	if(Current == ChoosePrimary){
		switch(row){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 25, 125);
    			gPrimary[playerid] = 0;
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 26, 125);
		        gPrimary[playerid] = 1;
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 31, 250);
		        gPrimary[playerid] = 2;
			}
		    case 3:
		    {
		        GivePlayerWeapon(playerid, 30, 250);
		        gPrimary[playerid] = 3;
			}
		}

	    ShowMenuForPlayer(ChooseOption, playerid);
	}
	if(Current == ChooseHand){
		switch(row){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 8, 1);
		        gHand[playerid] = 0;
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 5, 1);
		        gHand[playerid] = 1;
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 6, 1);
		        gHand[playerid] = 2;
			}
		    case 3:
		    {
		        GivePlayerWeapon(playerid, 10, 1);
		        gHand[playerid] = 3;
			}
		}

	    ShowMenuForPlayer(ChoosePistol, playerid);
	}
	if(Current == ChooseOption){
		switch(row){
		    case 0:
		    {
		        gNext[playerid] = 0;
			}
		    case 1:
		    {
		        gNext[playerid] = 1;
		        SendClientMessage(playerid, COLOR_YELLOW, "Type /weapons to re-enable the weapon menu.");
			}
		}
		
		if(gFreeze[playerid] != 1){
	   		TogglePlayerControllable(playerid, true);
	    }
	    SendClientMessage(playerid, COLOR_YELLOW, "You can always buy ammo by typing /buy in the weapon checkpoints!");
	}
	if(Current == BuyPoint){
		switch(row){
		    case 0:
		    {
		        ShowMenuForPlayer(Ammo, playerid);
		        SendClientMessage(playerid, COLOR_YELLOW, "You can buy ammo for your weapon here, with a maximum of 1000 bullets!");
			}
		    case 1:
		    {
                ShowMenuForPlayer(Health, playerid);
                SendClientMessage(playerid, COLOR_YELLOW, "You can buy health here!");
			}
		    case 2:
		    {
                ShowMenuForPlayer(Armor, playerid);
                SendClientMessage(playerid, COLOR_YELLOW, "You can buy armor here!");
			}
		    case 3:
		    {
                ShowMenuForPlayer(Special, playerid);
                SendClientMessage(playerid, COLOR_YELLOW, "Insurance refunds the money you had when you died!");
			}
		}
	}
	if(Current == Ammo){
	    if(GetPlayerWeapon(playerid) < 15){
	        SendClientMessage(playerid, COLOR_ORANGE, "You cannot buy ammo for this weapon!");
            TogglePlayerControllable(playerid, true);
		} else {
			switch(row){
			    case 0:
			    {
			        if(gMoney[playerid] >= 1500){
						new ammo = GetPlayerAmmo(playerid);

						if(ammo == 1000){
						    SendClientMessage(playerid, COLOR_ORANGE, "You cannot buy more ammo then 1000!");
						} else {
				            SetPlayerCash(playerid, gMoney[playerid] - 1500);

				            if(ammo > 950){
				                SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 1000);
				                SendClientMessage(playerid, COLOR_ORANGE, "Your maximum of 1000 bullets is reached!");
							} else {
							    SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo + 50);
							}
						}
			        } else {
			            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 1500$");
					}
				}
			    case 1:
			    {
			        if(gMoney[playerid] >= 3000){
						new ammo = GetPlayerAmmo(playerid);

						if(ammo == 1000){
						    SendClientMessage(playerid, COLOR_ORANGE, "You cannot buy more ammo then 1000!");
						} else {
				            SetPlayerCash(playerid, gMoney[playerid] - 3000);

				            if(ammo >= 900){
				                SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 1000);
				                SendClientMessage(playerid, COLOR_ORANGE, "Your maximum of 1000 bullets is reached!");
							} else {
							    SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo + 100);
							}
						}
			        } else {
			            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 3000$");
					}
				}
			    case 2:
			    {
			        if(gMoney[playerid] >= 7500){
						new ammo = GetPlayerAmmo(playerid);

						if(ammo == 1000){
						    SendClientMessage(playerid, COLOR_ORANGE, "You cannot buy more ammo then 1000!");
						} else {
				            SetPlayerCash(playerid, gMoney[playerid] - 7500);

				            if(ammo >= 750){
				                SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 1000);
				                SendClientMessage(playerid, COLOR_ORANGE, "Your maximum of 1000 bullets is reached!");
							} else {
							    SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo + 250);
							}
						}
			        } else {
			            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 7500$");
					}
				}
			    case 3:
			    {
			        if(gMoney[playerid] >= 15000){
						new ammo = GetPlayerAmmo(playerid);

						if(ammo == 1000){
						    SendClientMessage(playerid, COLOR_ORANGE, "You cannot buy more ammo then 1000!");
						} else {
				            SetPlayerCash(playerid, gMoney[playerid] - 15000);

				            if(ammo >= 500){
				                SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), 1000);
				                SendClientMessage(playerid, COLOR_ORANGE, "Your maximum of 1000 bullets is reached!");
							} else {
							    SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo + 500);
							}
						}
			        } else {
			            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 15000$");
					}
				}
			}

		    TogglePlayerControllable(playerid, true);
	    }
	}
	if(Current == Health){
		switch(row){
		    case 0:
		    {
		        if(gMoney[playerid] >= 800){
		            new Float:ammo;
					GetPlayerHealth(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 health!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 800);

			            if(health > 90){
			                SetPlayerHealth(playerid, 100);
						} else {
						   	SetPlayerHealth(playerid, health + 10);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 10 health!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 800$");
				}
			}
		    case 1:
		    {
		        if(gMoney[playerid] >= 2000){
		            new Float:ammo;
					GetPlayerHealth(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 health!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 2000);

			            if(health > 75){
			                SetPlayerHealth(playerid, 100);
						} else {
						   	SetPlayerHealth(playerid, health + 25);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 25 health!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 2000$");
				}
			}
		    case 2:
		    {
		        if(gMoney[playerid] >= 4000){
		            new Float:ammo;
					GetPlayerHealth(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 health!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 4000);

			            if(health > 50){
			                SetPlayerHealth(playerid, 100);
						} else {
						   	SetPlayerHealth(playerid, health + 50);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 50 health!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 4000$");
				}
			}
		    case 3:
		    {
		        if(gMoney[playerid] >= 6000){
		            new Float:ammo;
					GetPlayerHealth(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 health!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 6000);

			            if(health > 25){
			                SetPlayerHealth(playerid, 100);
						} else {
						   	SetPlayerHealth(playerid, health + 75);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 75 health!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 6000$");
				}
			}
		    case 4:
		    {
		        if(gMoney[playerid] >= 8000){
		            new Float:ammo;
					GetPlayerHealth(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 health!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 8000);

		                SetPlayerHealth(playerid, 100);
		                SendClientMessage(playerid, COLOR_ORANGE, "You bought 100 health!");
					}

		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 8000$");
				}
			}
		}

		if(gFreeze[playerid] != 1){
	    	TogglePlayerControllable(playerid, true);
	    }
	}
	if(Current == Armor){
		switch(row){
		    case 0:
		    {
		        if(gMoney[playerid] >= 800){
		            new Float:ammo;
					GetPlayerArmour(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 armor!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 800);

			            if(health > 90){
			                SetPlayerArmour(playerid, 100);
						} else {
						   	SetPlayerArmour(playerid, health + 10);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 10 armor!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 800$");
				}
			}
		    case 1:
		    {
		        if(gMoney[playerid] >= 2000){
		            new Float:ammo;
					GetPlayerArmour(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 armor!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 2000);

			            if(health > 75){
			                SetPlayerArmour(playerid, 100);
						} else {
						   	SetPlayerArmour(playerid, health + 25);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 25 armor!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 2000$");
				}
			}
		    case 2:
		    {
		        if(gMoney[playerid] >= 4000){
		            new Float:ammo;
					GetPlayerArmour(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 armor!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 4000);

			            if(health > 50){
			                SetPlayerArmour(playerid, 100);
						} else {
						   	SetPlayerArmour(playerid, health + 50);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 50 armor!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 4000$");
				}
			}
		    case 3:
		    {
		        if(gMoney[playerid] >= 6000){
		            new Float:ammo;
					GetPlayerArmour(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 armor!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 6000);

			            if(health > 25){
			                SetPlayerArmour(playerid, 100);
						} else {
						   	SetPlayerArmour(playerid, health + 75);
						}

						SendClientMessage(playerid, COLOR_ORANGE, "You bought 75 armor!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 6000$");
				}
			}
		    case 4:
		    {
		        if(gMoney[playerid] >= 8000){
		            new Float:ammo;
					GetPlayerArmour(playerid, ammo);
					new health = floatround(ammo);

					if(health == 100){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have 100 armor!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 8000);

		                SetPlayerArmour(playerid, 100);
		                SendClientMessage(playerid, COLOR_ORANGE, "You bought 100 armor!");
					}

		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 8000$");
				}
			}
		}

		if(gFreeze[playerid] != 1){
	    	TogglePlayerControllable(playerid, true);
	    }
	}
	if(Current == Special){
		switch(row){
		    case 0:
		    {
		        if(gMoney[playerid] >= 2500){
					if(gInsurance[playerid] == 1){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have this insurance!");
					} else if(gInsurance[playerid] > 1) {
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have a better insurance!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 2500);
						gInsurance[playerid] = 1;
						SendClientMessage(playerid, COLOR_ORANGE, "You now have 25 percent insurance!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 2500$");
				}
			}
		    case 1:
		    {
		        if(gMoney[playerid] >= 5000){
					if(gInsurance[playerid] == 2){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have this insurance!");
					} else if(gInsurance[playerid] > 2) {
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have a better insurance!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 5000);
						gInsurance[playerid] = 2;
						SendClientMessage(playerid, COLOR_ORANGE, "You now have 50 percent insurance!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 5000$");
				}
			}
		    case 2:
		    {
		        if(gMoney[playerid] >= 7500){
					if(gInsurance[playerid] == 3){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have this insurance!");
					} else if(gInsurance[playerid] > 3) {
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have a better insurance!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 7500);
						gInsurance[playerid] = 3;
						SendClientMessage(playerid, COLOR_ORANGE, "You now have 75 percent insurance!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 7500$");
				}
			}
		    case 3:
		    {
		        if(gMoney[playerid] >= 10000){
					if(gInsurance[playerid] == 4){
					    SendClientMessage(playerid, COLOR_ORANGE, "You already have this insurance!");
					} else {
			            SetPlayerCash(playerid, gMoney[playerid] - 10000);
						gInsurance[playerid] = 4;
						SendClientMessage(playerid, COLOR_ORANGE, "You now have 100 percent insurance!");
					}
		        } else {
		            SendClientMessage(playerid, COLOR_ORANGE, "You dont have enough money! You need at least 10000$");
				}
			}
		}

		if(gFreeze[playerid] != 1){
	    	TogglePlayerControllable(playerid, true);
	    }
	}
}

//
// When player disconnects
//
public OnPlayerDisconnect(playerid){
	Reset(playerid);

	return 0;
}

//
// When player connects
//
public OnPlayerConnect(playerid)
{
	Reset(playerid);
	ResetPlayerMoney(playerid);
	ResetPlayerWeapons(playerid);
	gMoney[playerid] = 0;
    SetPlayerColor(playerid,0xFFFFFF00);

	SendClientMessage(playerid, COLOR_YELLOW, "Welcome at the Midna.nl | Desert TDM server!");
	SendClientMessage(playerid, COLOR_YELLOW, "Type /help for more info and commands, and type /rules for the servers rules.");

    GameTextForPlayer(playerid, "Welcome at Desert TDM!", 1500, 3);
	SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);

	return 0;
}

//
// When player changes interior
//
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid){
	if(newinteriorid != 0){
        SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);
	    SetTimerEx( "interiorOut", 3000, 0, "i", playerid );
		TogglePlayerControllable(playerid, false);
	}
	
	return 1;
}

//
// When player requests to spawn
//
public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 471.172577, -2128.310059, -28.597435);
	SetPlayerCameraPos(playerid, 475.871735, -2126.508057, -27.522444);
	SetPlayerCameraLookAt(playerid, 471.172577, -2128.310059, -28.597435);
	SetPlayerFacingAngle(playerid, 282);
	SetPlayerColor(playerid,0xFFFFFF00);
	SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);
	
	new string[256];
	new realid = classid + 1;

	if(classid == 0){
	    format(string, sizeof(string), "~b~Retarded Cops %i/5", realid);
		gTeam[playerid] = 1;
 	} else if(classid == 1){
	    format(string, sizeof(string), "~y~Crazy Farmers %i/5", realid);
		gTeam[playerid] = 2;
	} else if(classid == 2){
	    format(string, sizeof(string), "~p~Drunk Idiots %i/5", realid);
		gTeam[playerid] = 3;
 	} else if(classid == 3){
	    format(string, sizeof(string), "~g~Private Army %i/5", realid);
		gTeam[playerid] = 4;
 	} else if(classid == 4){
	    format(string, sizeof(string), "~r~Lazy Citizens %i/5", realid);
		gTeam[playerid] = 5;
	}

	GameTextForPlayer(playerid, string, 6000000, 3);
	
	return 1;
}

//
// When player dies
//
public OnPlayerDeath(playerid, killerid, reason)
{
	HideMenuForPlayer(GetPlayerMenu(playerid),playerid);
    SendDeathMessage(killerid, playerid, reason);
    SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);
	new money, cash, string[256], playername[256];
	GetPlayerName(playerid, playername, sizeof(playername));
	money = GetPlayerMoney(playerid);

	if(money > 17500){
	    money = 17500;
	}

	if(IsPlayerConnected(killerid)){
		if(gTeam[playerid] == gTeam[killerid]){
		    GameTextForPlayer(killerid, "~r~DO NOT TEAMKILL!", 5000, 3);
		    SendWarnMessage(killerid, 999, "Dont teamkill!");
		    SetPlayerPoint(killerid, GetPlayerScore(killerid) - 3);
 		} else {
			cash = money + 2500;
 		    GivePlayerPoint(killerid, 1);
			GivePlayerCash(killerid, cash);
			format(string, sizeof(string), "You earned $%i by killing %s!", cash, playername);
			SendClientMessage(killerid, COLOR_YELLOW, string);
		}
	}

    money = GetPlayerMoney(playerid);
	ResetPlayerMoney(playerid);

	if(gInsurance[playerid] == 1){
    	if(gSuicide[playerid] == 1){
		    SendClientMessage(playerid, COLOR_YELLOW, "Your insurance doesnt cover suicides! Your insurance has ended now!");
		} else {
		    new refund = floatround(money / 4);
			format(string, sizeof(string), "Your insurance refunded you 25 percent, that is in total $%i! Your insurance has ended now!", refund);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			GivePlayerMoney(playerid, refund);
		}
	}
	if(gInsurance[playerid] == 2){
		if(gSuicide[playerid] == 1){
		    SendClientMessage(playerid, COLOR_YELLOW, "Your insurance doesnt cover suicides! Your insurance has ended now!");
		} else {
		    new refund = floatround(money / 2);
			format(string, sizeof(string), "Your insurance refunded you 50 percent, that is in total $%i! Your insurance has ended now!", refund);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			GivePlayerMoney(playerid, refund);
		}
	}
	if(gInsurance[playerid] == 3){
		if(gSuicide[playerid] == 1){
		    SendClientMessage(playerid, COLOR_YELLOW, "Your insurance doesnt cover suicides! Your insurance has ended now!");
		} else {
		    new refund = floatround(floatround(money / 4) * 3);
			format(string, sizeof(string), "Your insurance refunded you 75 percent, that is in total $%i! Your insurance has ended now!", refund);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			GivePlayerMoney(playerid, refund);
		}
	}
	if(gInsurance[playerid] == 4){
		if(gSuicide[playerid] == 1){
		    SendClientMessage(playerid, COLOR_YELLOW, "Your insurance doesnt cover suicides! Your insurance has ended now!");
		} else {
		    new refund = money;
			format(string, sizeof(string), "Your insurance refunded you 100 percent, that is in total $%i! Your insurance has ended now!", refund);
			SendClientMessage(playerid, COLOR_YELLOW, string);
			GivePlayerMoney(playerid, refund);
		}
	}

	gInsurance[playerid] = 0;
	gSuicide[playerid] = 0;

	return 1;
}

//
// Your tha best
//
public best(){
	new highest = 0, name[256], old, found = 0;

	for(new i = 0; i <= MAX_PLAYERS; i++){
		if(IsPlayerConnected(i)){
			new score = GetPlayerScore(i);

			if(score > highest){
			    highest = score;
			    old = i;
			    found = 1;
				GetPlayerName(i, name, sizeof(name));
			}
		}
	}

	if(found == 0){
	    SendClientMessageToAll(COLOR_YELLOW, "There is currently no top-player!");
	} else {
		new string[256];
		format(string, sizeof(string), "The top-player at the moment is %s, with a score of %i!", name, highest);
		SendClientMessageToAll(COLOR_YELLOW, string);

	 	highest = 0;
	 	found = 0;
		for(new i = 0; i <= MAX_PLAYERS; i++){
			if(IsPlayerConnected(i)){
			    if(i != old){
					new score = GetPlayerScore(i);

					if(score > highest){
					    highest = score;
					    found = 1;
						GetPlayerName(i, name, sizeof(name));
					}
				}
			}
		}

		if(found == 0){
		    SendClientMessageToAll(COLOR_YELLOW, "There is currently no second place!");
		} else {
			format(string, sizeof(string), "Second place is %s, with a score of %i!", name, highest);
			SendClientMessageToAll(COLOR_YELLOW, string);
		}
	}
}

//
// When player spawns
//
public OnPlayerSpawn(playerid)
{
	if(gFreeze[playerid] == 1){
	    SendClientMessage(playerid, COLOR_ORANGE, "You have been frozen.");
	    TogglePlayerControllable(playerid, false);
	}

	SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);

	if(gTeam[playerid] == 1){
	    SetPlayerColor(playerid, COLOR_BLUE);
	} else if(gTeam[playerid] == 2){
	    SetPlayerColor(playerid, COLOR_YELLOW);
	} else if(gTeam[playerid] == 3){
	    SetPlayerColor(playerid, COLOR_PURPLE);
	} else if(gTeam[playerid] == 4){
	    SetPlayerColor(playerid, COLOR_GREEN);
	} else if(gTeam[playerid] == 5){
	    SetPlayerColor(playerid, COLOR_REALRED);
	}

	GameTextForPlayer(playerid, "~r~H~y~a~r~v~y~e ~r~F~y~u~r~n~y~!", 3000, 3);

    new i = playerid;
    GetPlayerPos(i, players[ i ][ 2 ][ 0 ], players[ i ][ 2 ][ 1 ], players[ i ][ 2 ][ 2 ]);
    GetPlayerPos(i, players[ i ][ 1 ][ 0 ], players[ i ][ 1 ][ 1 ], players[ i ][ 1 ][ 2 ]);
    GetPlayerPos(i, players[ i ][ 0 ][ 0 ], players[ i ][ 0 ][ 1 ], players[ i ][ 0 ][ 2 ]);

	if(gNext[playerid] == 1){
		switch(gPistol[playerid]){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 22, 150);
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 23, 125);
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 24, 70);
			}
		}
		switch(gSecondary[playerid]){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 29, 350);
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 32, 350);
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 28, 350);
			}
		}
		switch(gPrimary[playerid]){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 25, 125);
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 26, 125);
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 31, 250);
			}
		    case 3:
		    {
		        GivePlayerWeapon(playerid, 30, 250);
			}
		}
		switch(gHand[playerid]){
		    case 0:
		    {
		        GivePlayerWeapon(playerid, 8, 1);
			}
		    case 1:
		    {
		        GivePlayerWeapon(playerid, 5, 1);
			}
		    case 2:
		    {
		        GivePlayerWeapon(playerid, 2, 1);
			}
		    case 3:
		    {
		        GivePlayerWeapon(playerid, 10, 1);
			}
		}

		if(gFreeze[playerid] != 1){
			TogglePlayerControllable(playerid, true);
		}
		
		SendClientMessage(playerid, COLOR_YELLOW, "Your weapons are restored as you have chosen before. Type /weapons to re-enable the menu.");
	} else {
		SetTimerEx( "FreezeMenu", 750, 0, "i", playerid );
	}

    SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);
	return 1;
}

//
// When player submits a command
//
public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256], idx;
	cmd = strtok(cmdtext, idx);

	//
	// Player commands
	//
	if (strcmp(cmd, "/help", true)==0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "This is a TEAM deathmatch. It basicly means you (and your teammates) are fighting the other teams.");
	    SendClientMessage(playerid, COLOR_YELLOW, "You can buy health & ammo at the red checkpoints.");
	    SendClientMessage(playerid, COLOR_YELLOW, "Also, be sure to follow the RULES, you might get banned if you dont! (Type /rules for more info)");
        SendClientMessage(playerid, COLOR_YELLOW, "Type /commands for all commands, type /rules for the rules..");
        SendClientMessage(playerid, COLOR_YELLOW, "This mode is made by Woet!");
	    SendClientMessage(playerid, COLOR_RED, "--> For questions, you can always visit www.midna.nl");

		return 1;
	}

	if (strcmp(cmd, "/rules", true)==0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "This are basic rules. Admins are allowed to kick/ban for reasons that are NOT in this list.");
	    SendClientMessage(playerid, COLOR_YELLOW, "1) Dont spam.");
	    SendClientMessage(playerid, COLOR_YELLOW, "2) Dont teamkill.");
	    SendClientMessage(playerid, COLOR_YELLOW, "3) Dont carkill/helikill.");
	    SendClientMessage(playerid, COLOR_YELLOW, "4) Dont cheat/hack/mod.");
	    SendClientMessage(playerid, COLOR_YELLOW, "5) Dont driveby. ");
	    SendClientMessage(playerid, COLOR_YELLOW, "6) Keep it fun for everyone on the server.");
	    SendClientMessage(playerid, COLOR_RED, "--> For questions, you can always visit www.midna.nl");

		return 1;
	}

	if (strcmp(cmd, "/commands", true)==0)
	{
		SendClientMessage(playerid, COLOR_YELLOW, "/kill, /rules, /help, /irc");
	    SendClientMessage(playerid, COLOR_YELLOW, "/bug [info], Tell us about a bug!");
	    SendClientMessage(playerid, COLOR_YELLOW, "/message [message], Send a message to the admins.");
  	    SendClientMessage(playerid, COLOR_YELLOW, "/transfer [id-name] [amount], Transfer money!");
   	    SendClientMessage(playerid, COLOR_YELLOW, "/pm [id] [message], Send a private message!");
  	    SendClientMessage(playerid, COLOR_YELLOW, "/buy, Buy insurance, armor, health and ammo when your in the checkpoint.");
	    SendClientMessage(playerid, COLOR_RED, "--> For questions, you can always visit www.midna.nl");

		return 1;
	}

	if (strcmp(cmd, "/irc", true)==0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "Midna has its own IRC channel!");
	    SendClientMessage(playerid, COLOR_YELLOW, "Server: irc.gtanet.com");
		SendClientMessage(playerid, COLOR_YELLOW, "Channel: #midna");
	    SendClientMessage(playerid, COLOR_YELLOW, "Download a IRC client such as mIRC (www.mirc.com) to access IRC!");
	    SendClientMessage(playerid, COLOR_RED, "--> For questions, you can always visit www.midna.nl");
		return 1;
	}

	if (strcmp(cmd, "/kill", true)==0)
	{
	    SetPlayerHealth(playerid, 0.0);
	    SetPlayerPoint(playerid, GetPlayerScore(playerid) - 1);
	    gSuicide[playerid] = 1;
		return 1;
	}

	if (strcmp(cmd, "/bug", true)==0)
	{
		new filecontents[256], tmp[256], string[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)){
		    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /bug [info]");
		} else {
		    new Day,Month,Year,Hour,Minut,Second,name[256],ip[256];
		    getdate(Year,Month,Day);
		    gettime(Hour,Minut,Second);
		    GetPlayerIp(playerid, ip, sizeof(ip));
		    GetPlayerName(playerid, name, sizeof(name));

		    strdel(cmdtext, 0, 5);
			format(filecontents, sizeof(filecontents), "[%i-%i-%i %i:%i:%i] [%s] [%s] [%s]\n", Day,Month,Year,Hour,Minut,Second,name,ip,cmdtext);

	        new File:gFile = fopen("bugs.log", io_readwrite);
			fseek(gFile, 0, seek_end);
	        fwrite(gFile, filecontents);
	        fclose(gFile);

	        format(string, sizeof(string), "%s has submitted a bug", name);

	        SendClientMessage(playerid, COLOR_YELLOW, "Thank you for reporting your bug!");
			SendAdminMessage(string);
		}

		return 1;
	}

	if (strcmp(cmd, "/weapons", true)==0)
	{
	    if(gNext[playerid] == 0){
	        SendClientMessage(playerid, COLOR_ORANGE, "Your menu is already re-enabled! You can choose weapons when you die.");
		} else {
			SendClientMessage(playerid, COLOR_YELLOW, "The menu will be re-enabled once you die.");
			gNext[playerid] = 0;
		}
		
		return 1;
	}

	if (strcmp(cmd, "/buy", true)==0)
	{
	    if(IsPlayerInCheckpoint(playerid)){
	        TogglePlayerControllable(playerid, false);
		    ShowMenuForPlayer(BuyPoint, playerid);
		    SendClientMessage(playerid, COLOR_YELLOW, "Welcome at the shop! What would you like to buy?");
		} else {
			SendClientMessage(playerid, COLOR_ORANGE, "You must be in the checkpoint to buy stuff!");
		}

		return 1;
	}

	if (strcmp(cmd, "/message", true)==0)
	{
	    new name[256], string[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    strdel(cmdtext, 0, 9);
	    
		format(string, sizeof(string), "--> [%s]: %s", name, cmdtext);
		SendAdminMessage(string);
		SendClientMessage(playerid, COLOR_YELLOW, "You message has been sent!");
		
		return 1;
	}

	if (strcmp(cmd, "/me", true)==0)
	{
	    new name[256], string[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    strdel(cmdtext, 0, 4);
	    
	    if(strlen(cmdtext) == 0){
			SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /me [text]");
		} else {
			format(string, sizeof(string), "* %s %s", name, cmdtext);
			SendClientMessageToAll(COLOR_WHITE, string);
		}
		
		return 1;
	}

	if (strcmp(cmd, "/transfer", true)==0)
	{
	    new tmp[256], to[256], from[256], string[256];
		GetPlayerName(playerid, from, sizeof(from));
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)){
		    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /transfer [id-name] [amount]");
		} else {
			if(FindUser(tmp)){
			    new id = GiveID(tmp);
			    GetPlayerName(id, to, sizeof(to));
			    tmp = strtok(cmdtext, idx);

				if(!strlen(tmp)){
				    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /transfer [id-name] [amount]");
				} else {
				    new amount = strval(tmp);
				    new money = GetPlayerMoney(playerid);
					new newmoney = money - amount;

				    if(amount < 1){
        				SendClientMessage(playerid, COLOR_ORANGE, "You need to transfer at least $1!");
					} else if(amount > money){
				        SendClientMessage(playerid, COLOR_ORANGE, "You dont have so much money!");
					} else if(id == playerid){
					    SendClientMessage(playerid, COLOR_ORANGE, "You cannot send money to yourself!");
					} else {
					    format(string, sizeof(string), "%s transfered $%i to %s", from, amount, to);
					    SendClientMessageToAll(COLOR_YELLOW, string);
					    GivePlayerCash(id, amount);
					    SetPlayerCash(playerid, newmoney);
                	}
				}
			} else {
	  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
			}
		}

		return 1;
	}

	//
	// Admin commands
	//
	if (strcmp(cmd, "/admin", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
	        new tmp[256];
	        tmp = strtok(cmdtext, idx);
	    
	        if(!strlen(tmp)){
			    if(IsPlayerLevel(playerid,1)){
			        SendClientMessage(playerid, COLOR_GREEN, "/c [chat], /info [id-name], /spec [id-name], /stopspec, /frozen, /muted, /mute [id-name] <reason>, /unmute [id-name]");
				} else {
				    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
				}
			    if(IsPlayerLevel(playerid,2)){
			        SendClientMessage(playerid, COLOR_GREEN, "/freeze [id-name] <reason>, /unfreeze [id-name], /warn [id-name] <reason>, /slap [id-name] [health]");
				}
			    if(IsPlayerLevel(playerid,3)){
			        SendClientMessage(playerid, COLOR_GREEN, "/disarm [id-name], /tele [id-name], /bring [id-name], /fkill [id-name] <reason>, /annnounce [message]");
		  	        SendClientMessage(playerid, COLOR_GREEN, "/eject [id-name], /sethealth [id-name] [amount], /setscore [id-name] [amount], /setmoney [id-name] [amount]");
				}
			    if(IsPlayerLevel(playerid,4)){
			        SendClientMessage(playerid, COLOR_GREEN, "/kick [id-name] <reason>, /lock <reason>, /unlock <reason>, /giveweapon [id-name] [weapon] <ammo>, /ban [id-name] <reason>");
				}
			    if(IsPlayerLevel(playerid,1)){
			        SendClientMessage(playerid, COLOR_GREEN, "[what] means required parameter. <what> means optional parameter. For more info about a command, type '/admin [command]'");
				}
			} else {
		        if(strcmp(tmp, "c", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/c [chat], Chat into the admin chat.");
				}
		        if(strcmp(tmp, "info", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/info [id-name], Gives information about a player (Weapons,Health,Money,Armor,IP etc).");
				}
		        if(strcmp(tmp, "spec", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/spec [id-name], Spectate a player.");
				}
 		        if(strcmp(tmp, "stopspec", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/stopspec, Stop spectating.");
				}
 		        if(strcmp(tmp, "jailed", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/jailed, Lists people who are jailed, including reason, by who, and optional unjailing time.");
				}
 		        if(strcmp(tmp, "frozen", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/frozen, Lists people who are frozen, including reason and by who.");
				}
 		        if(strcmp(tmp, "muted", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/muted, Lists people who are muted, including reason and by who.");
				}
 		        if(strcmp(tmp, "mute", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/mute [id-name] <reason>, Mute the player, optional reason.");
				}
  		        if(strcmp(tmp, "warn", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/warn [id-name] <reason>, Warn the player (After 5 warnings he will get kicked), optional reason.");
				}
  		        if(strcmp(tmp, "freeze", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/freeze [id-name] <reason>, Freezes the player so he cant move, optional reasom.");
				}
  		        if(strcmp(tmp, "unfreeze", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/unfreeze [id-name], Unfreezes the player so he can move again.");
				}
  		        if(strcmp(tmp, "fkill", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/fkill [id-name] <reason>, Kills the player.");
				}
   		        if(strcmp(tmp, "slap", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/slap [id-name] [health], Slaps the player, health is the health taken off.");
				}
   		        if(strcmp(tmp, "giveweapon", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/giveweapon [id-name] [weapon] <ammo>, Gives player a weapon with a specific ammo. (Ammo Default is 100)");
				}
   		        if(strcmp(tmp, "announce", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/announce [message], Send an message to all players online.");
				}
   		        if(strcmp(tmp, "disarm", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/disarm [id-name], Removes all the weapons of a player.");
				}
   		        if(strcmp(tmp, "tele", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/tele [id-name], Teleport to a player.");
				}
   		        if(strcmp(tmp, "bring", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/bring [id-name], Bring the player to you.");
				}
   		        if(strcmp(tmp, "sethealth", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/sethealth [id-name] [amount], Sets the players health.");
				}
   		        if(strcmp(tmp, "setmoney", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/setmoney [id-name] [amount], Sets the players money.");
				}
   		        if(strcmp(tmp, "kick", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/kick [id-name] <reason>, Kicks a player.");
				}
   		        if(strcmp(tmp, "lock", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/lock <reason>, Locks the chat, only allowing members can talk.");
				}
   		        if(strcmp(tmp, "unlock", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/unlock, Unlocks the chat, allowing everyone to talk.");
				}
   		        if(strcmp(tmp, "ban", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/unlock, Unlocks the chat, allowing everyone to talk.");
				}
   		        if(strcmp(tmp, "eject", true) == 0){
		            SendClientMessage(playerid, COLOR_GREEN, "/eject [id-name], Removes the player from his vehicle.");
				}
			}
        } else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

  		return 1;
	}

	if (strcmp(cmd, "/info", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
		    new tmp[256], string[256], admin[256];
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_RED, "USAGE: /info [id-name]");
			} else {
				if(FindUser(tmp)){
					new id = GiveID(tmp), playername[256], name[256], ip[256], string2[256], string3[256], vhealthstuff[256], vehicle[256], Float:health, Float:vhealth, Float:armor, rcon;
					GetPlayerName(id, name, sizeof(name));

					format(string, sizeof(string), "%s has looked up info of %s", admin, name);
					AdminLog(playerid,string);

					GetPlayerIp(id, ip, sizeof(ip));
					GetPlayerArmour(id, armor);
					GetPlayerName(id, playername, sizeof(playername));
					GetPlayerHealth(id, health);
					new ammo = GetPlayerAmmo(id);
					if(IsPlayerAdmin(id)){
					    rcon = 1;
					} else {
					    rcon = 0;
					}

					if(IsPlayerInAnyVehicle(id)){
						new vehid = GetPlayerVehicleID(playerid);
						
						format(vehicle, sizeof(vehicle), "%i", GetVehicleModel(vehid));
						GetVehicleHealth(vehid, vhealth);
						vhealth = floatround(vhealth / 10, floatround_round);
						format(vhealthstuff, sizeof(vhealthstuff), "%i", floatround(vhealth));
					} else {
					    format(vehicle, sizeof(vehicle), "None");
					    format(vhealthstuff, sizeof(vhealthstuff), "-");
					}

					if(ammo == 65535){
					    ammo = 0;
					}
					
					new health2 = floatround(health);
					new armor2 = floatround(armor);
					
					format(string, sizeof(string), "Name: %s | ID: %i | Team: %i | IP: %s | Ping: %i | Warnings: %i/3 | Admin: %i", playername, id, gTeam[id], ip, GetPlayerPing(id), gWarnings[id], rcon);
					format(string2, sizeof(string2), "Money: %i | Health: %i | Armor: %i | Weapon: %i | Ammo: %i", GetPlayerMoney(id), health2, armor2, GetPlayerWeapon(id), ammo);
					format(string3, sizeof(string3), "Vehicle: %s | Vehicle Health: %s | Score: %i", vehicle, vhealthstuff, GetPlayerScore(id));

					SendClientMessage(playerid, COLOR_GREEN, string);
					SendClientMessage(playerid, COLOR_GREEN, string2);
					SendClientMessage(playerid, COLOR_GREEN, string3);
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/spec", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
		    new tmp[256], string[256], admin[256];
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_RED, "USAGE: /spec [id-name]");
			} else {
				if(FindUser(tmp)){
					new id = GiveID(tmp), playername[256];
					
					GetPlayerName(id, playername, sizeof(playername));

					TogglePlayerSpectating(playerid, 1);
					if(IsPlayerInAnyVehicle(id)){
					    new specvehicleid = GetPlayerVehicleID(id);
						PlayerSpectateVehicle(playerid, specvehicleid);
					} else {
						PlayerSpectatePlayer(playerid, id);
					}
					
					SetPlayerInterior(playerid,GetPlayerInterior(id));
					
					format(string, sizeof(string), " %s is now spectating %s", admin, playername);
					AdminLog(playerid,string);
					
					gSpec[playerid] = 1;
					gSpeccing[playerid] = id;
					gSpecced[id] = 1;
					gSpecAdmin[id] = playerid;
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/stopspec", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
			if(gSpec[playerid] == 1){
				new string[256], admin[256], playername[256];
 				GetPlayerName(playerid, admin, sizeof(admin));
				GetPlayerName(gSpeccing[playerid], playername, sizeof(playername));
				
				gSpec[playerid] = 0;
				gSpecced[gSpeccing[playerid]] = 0;
			    TogglePlayerSpectating(playerid, 0);
			    format(string, sizeof(string), " %s stopped speccing %s", admin, playername);
			    
				AdminLog(playerid, string);
			} else {
                SendClientMessage(playerid, COLOR_ORANGE, "You are not spectating anyone!");
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/eject", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
			new tmp[256], string[256], admin[256];
			tmp = strtok(cmdtext, idx);
			GetPlayerName(playerid, admin, sizeof(admin));

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /eject [id-name]");
			} else {
			    if(FindUser(tmp)){
			        new id = GiveID(tmp), playername[256];

			        if(IsPlayerInAnyVehicle(id)){
				        GetPlayerName(id, playername, sizeof(playername));

				        format(string, sizeof(string), "%s has ejected %s from his vehicle.", admin, playername);
				        SendClientMessageToAll(COLOR_GREEN, string);
				        RemovePlayerFromVehicle(playerid);
						AdminLog(playerid,string);
					} else {
					    SendClientMessage(playerid, COLOR_ORANGE, "Player isnt in any vehicle!");
					}
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}
		
		return 1;
	}

	if (strcmp(cmd, "/muted", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
			new string[256], results = 0, playername[256], admin[256];
			GetPlayerName(playerid, playername, sizeof(playername));
			SendClientMessage(playerid, COLOR_GREEN, "People muted:");

			for(new i = 0; i <= MAX_PLAYERS; i++){
			    if(IsPlayerConnected(i)){
					if(gMute[i] == 1){
					    new name[256];
					    GetPlayerName(i, name, sizeof(name));
					    GetPlayerName(gMuteAdmin[i], admin, sizeof(admin));
					    format(string, sizeof(string), "-%s (%i) (By: %s) (Reason: %s)", name, i, admin, gMuteReason[i]);
					    SendClientMessage(playerid, COLOR_GREEN, string);
						results++;
					}
				}
			}

			if(results == 0){
			    SendClientMessage(playerid, COLOR_GREEN, "- None!");
			}

			format(string, sizeof(string), " %s has looked at the people muted.", playername);
			AdminLog(playerid, string);
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/frozen", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
			new string[256], results = 0, playername[256], admin[256];
			GetPlayerName(playerid, playername, sizeof(playername));
			SendClientMessage(playerid, COLOR_GREEN, "People frozen:");

			for(new i = 0; i <= MAX_PLAYERS; i++){
			    if(IsPlayerConnected(i)){
					if(gFreeze[i] == 1){
					    new name[256];
					    GetPlayerName(i, name, sizeof(name));
					    GetPlayerName(gFreezeAdmin[i], admin, sizeof(admin));
					    format(string, sizeof(string), "-%s (%i) (By: %s) (Reason: %s)", name, i, admin, gFreezeReason[i]);
					    SendClientMessage(playerid, COLOR_GREEN, string);
						results++;
					}
				}
			}

			if(results == 0){
			    SendClientMessage(playerid, COLOR_GREEN, "- None!");
			}

			format(string, sizeof(string), " %s has looked at the people frozen.", playername);
			AdminLog(playerid, string);
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/kick", true)==0)
	{
	    if(IsPlayerLevel(playerid,4)){
		    new tmp[256], string[256], admin[256];
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);
			new length = strlen(tmp);
			new offset = 7 + length;

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /kick [id-name] <reason>");
			} else {
				if(FindUser(tmp)){
					new id = GiveID(tmp), name[256];
					GetPlayerName(id, name, sizeof(name));
					strdel(cmdtext, 0, offset);

					format(string, sizeof(string), " %s has kicked %s for reason %s", admin, name, cmdtext);
					AdminLog(playerid,string);
					SendKickMessage(id,playerid,cmdtext);
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}
		
		return 1;
	}

	if (strcmp(cmd, "/ban", true)==0)
	{
	    if(IsPlayerLevel(playerid,5)){
 		    new tmp[256], string[256], admin[256];
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);
			new length = strlen(tmp);
			new offset = 6 + length;

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /ban [id-name] <reason>");
			} else {
				if(FindUser(tmp)){
					new id = GiveID(tmp), name[256];
					GetPlayerName(id, name, sizeof(name));
					strdel(cmdtext, 0, offset);

					format(string, sizeof(string), " %s has banned %s for reason %s", admin, name, cmdtext);
					AdminLog(playerid,string);
					SendBanMessage(id,playerid,cmdtext);
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}
		
		return 1;
	}

	if (strcmp(cmd, "/c", true)==0)
	{
	    if(IsPlayerLevel(playerid,1)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /c [message]");
			} else {
			    strdel(cmdtext, 0, 3);
				format(string, sizeof(string), "[ADMIN] %s: %s", admin, cmdtext);
				SendAdminMessage(string);
				AdminChatLog(playerid,string);
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/mute", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		   	new tmp[256], admin[256], name[256], string[256];
 		    tmp = strtok(cmdtext, idx);
     		new id = GiveID(tmp);
			GetPlayerName(playerid, admin, sizeof(admin));
			GetPlayerName(id, name, sizeof(name));
			new length = strlen(tmp);
			new offset = 7 + length;
			
			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /mute [id-name] <reason>");
			} else {
				if(FindUser(tmp)){
				    if(gMute[id] == 1){
						format(string, sizeof(string), "%s is already muted.", name);
				        SendClientMessage(playerid, COLOR_ORANGE, string);
					} else {
						new reason[256];
						GetPlayerName(id, name, sizeof(name));
                        strdel(cmdtext, 0, offset);
                        
					 	gMute[id] = 1;
					 	gMuteAdmin[id] = playerid;

						if(!strlen(cmdtext)){
						    format(reason, sizeof(reason), "-");
						} else {
						    format(reason, sizeof(reason), "%s", cmdtext);
						}
					 	
					 	gMuteReason[id] = reason;
					 	gMuteAdmin[id] = playerid;
					 	
						format(string, sizeof(string), "%s has muted %s. (Reason: %s)", admin, name, reason);

						AdminLog(playerid,string);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/unmute", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		   	new tmp[256], admin[256], name[256], string[256];
 		    tmp = strtok(cmdtext, idx);
     		new id = GiveID(tmp);
			GetPlayerName(playerid, admin, sizeof(admin));
			GetPlayerName(id, name, sizeof(name));

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /unmute [id-name]");
			} else {
				if(FindUser(tmp)){
				    if(gMute[id] == 0){
						format(string, sizeof(string), "%s is already unmuted.", name);
				        SendClientMessage(playerid, COLOR_ORANGE, string);
					} else {
					 	gMute[id] = 0;

						format(string, sizeof(string), "%s has unmuted %s.", admin, name);

						AdminLog(playerid,string);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/freeze", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		   	new tmp[256], admin[256], name[256], string[256];
 		    tmp = strtok(cmdtext, idx);
     		new id = GiveID(tmp);
			GetPlayerName(playerid, admin, sizeof(admin));
			GetPlayerName(id, name, sizeof(name));
			new length = strlen(tmp);
			new offset = 9 + length;

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /freeze [id-name] <reason>");
			} else {
				if(FindUser(tmp)){
				    if(gFreeze[id] == 1){
						format(string, sizeof(string), "%s is already frozen.", name);
				        SendClientMessage(playerid, COLOR_RED, string);
					} else {
						new reason[256];
						GetPlayerName(id, name, sizeof(name));
                        strdel(cmdtext, 0, offset);

					 	gFreeze[id] = 1;
					 	gFreezeAdmin[id] = playerid;

						if(!strlen(cmdtext)){
						    format(reason, sizeof(reason), "-");
						} else {
						    format(reason, sizeof(reason), "%s", cmdtext);
						}

					 	gFreezeReason[id] = reason;

						format(string, sizeof(string), "%s has frozen %s. (Reason: %s)", admin, name, reason);

						TogglePlayerControllable(id, false);
						AdminLog(playerid,string);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/unfreeze", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		   	new tmp[256], admin[256], name[256], string[256];
 		    tmp = strtok(cmdtext, idx);
     		new id = GiveID(tmp);
			GetPlayerName(playerid, admin, sizeof(admin));
			GetPlayerName(id, name, sizeof(name));

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /unfreeze [id-name]");
			} else {
				if(FindUser(tmp)){
				    if(gFreeze[id] == 0){
						format(string, sizeof(string), "%s is already unfrozen.", name);
				        SendClientMessage(playerid, COLOR_ORANGE, string);
					} else {
					 	gFreeze[id] = 0;

						format(string, sizeof(string), "%s has unfrozen %s.", admin, name);

                        TogglePlayerControllable(id, true);
						AdminLog(playerid,string);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/lock", true)==0)
	{
	    if(IsPlayerLevel(playerid,4)){
		    if(chatlock == 1){
		        SendClientMessage(playerid, COLOR_ORANGE, "The chat is already locked.");
			} else {
	 		    new tmp[256], admin[256], string[256];
				GetPlayerName(playerid, admin, sizeof(admin));
				tmp = strtok(cmdtext, idx);

			    format(string, sizeof(string), "%s has locked the chat.", admin);
				chatlock = 1;

				AdminLog(playerid,string);
				SendClientMessageToAll(COLOR_GREEN, string);
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/unlock", true)==0)
	{
	    if(IsPlayerLevel(playerid,4)){
		    if(chatlock == 0){
		        SendClientMessage(playerid, COLOR_ORANGE, "The chat is already unlocked.");
			} else {
	 		    new tmp[256], admin[256], string[256];
				GetPlayerName(playerid, admin, sizeof(admin));
				tmp = strtok(cmdtext, idx);

			    format(string, sizeof(string), "%s has unlocked the chat.", admin);
				chatlock = 0;

				AdminLog(playerid,string);
				SendClientMessageToAll(COLOR_GREEN, string);
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/warn", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		    new tmp[256], admin[256], string[256], length, offset;
			GetPlayerName(playerid, admin, sizeof(admin));
			tmp = strtok(cmdtext, idx);
			length = strlen(tmp);
			offset = 6 + length;

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /warn [id-name] <reason>");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256], reason[256];
					GetPlayerName(id, name, sizeof(name));
					tmp = strtok(cmdtext, idx);

					if(!strlen(tmp)){
					    format(reason, sizeof(reason), "None");
					} else {
					    strdel(cmdtext, 0, offset);
					    format(reason, sizeof(reason), cmdtext);
					}

				    gWarnings[id]++;
					format(string, sizeof(string), "%s has warned %s: %s", admin, name, reason);

					if(gWarnings[id] == 5){
						SendKickMessage(id,playerid,"Exceeded warning limit of 5");
					} else {
						AdminLog(playerid,string);
						SendWarnMessage(id,playerid,cmdtext);
				    }

				    SendClientMessageToAll(COLOR_GREEN, string);
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
  		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/fkill", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /fkill [id-name]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256];
					GetPlayerName(id, name, sizeof(name));

					format(string, sizeof(string), "%s has killed %s", admin, name);

					AdminLog(playerid,string);
					SetPlayerHealth(id, 0.0);
					SendClientMessageToAll(COLOR_GREEN, string);
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/slap", true)==0)
	{
	    if(IsPlayerLevel(playerid,2)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /slap [id-name] <health>");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256], amount, Float:health, force;
   					
					GetPlayerName(id, name, sizeof(name));
					GetPlayerHealth(id, health);
					new health2 = floatround(health);

                    tmp = strtok(cmdtext, idx);

                    if(!strlen(tmp)){
                        amount = health2;
                        force = 0;
					} else {
						amount = health2 - strval(tmp);
						force = strval(tmp);
					}

					format(string, sizeof(string), "%s has slapped %s with %i trouts.", admin, name, force);

					AdminLog(playerid,string);
					SetPlayerHealth(id, amount);
					SendClientMessageToAll(COLOR_GREEN, string);
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/disarm", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /disarm [id-name]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256];
					GetPlayerName(id, name, sizeof(name));

					format(string, sizeof(string), "%s has disarmed %s.", admin, name);

					AdminLog(playerid,string);
					ResetPlayerWeapons(id);
					SendClientMessageToAll(COLOR_GREEN, string);
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/giveweapon", true)==0)
	{
	    if(IsPlayerLevel(playerid,4)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /giveweapon [id-name] [weapon] <ammo>");
			} else {
				if(FindUser(tmp)){
					new id = GiveID(tmp);
					tmp = strtok(cmdtext, idx);
					
					if(!strlen(tmp)){
					    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /giveweapon [id-name] [weapon] <ammo>");
					} else {
					    new weapon = strval(tmp), ammo, playername[256];
                        tmp = strtok(cmdtext, idx);
                        GetPlayerName(id, playername, sizeof(playername));

                        if(!strlen(tmp)){
                            ammo = 100;
						} else {
						   	ammo = strval(tmp);
						}
						
						if(weapon >= 1 && weapon <= 47){
						    GivePlayerWeapon(id, weapon, ammo);
						    format(string, sizeof(string), "%s give %s weapon %i with ammo %i", admin, playername, weapon, ammo);
						    
						    SendClientMessageToAll(COLOR_GREEN, string);
						    AdminLog(playerid, string);
						} else {
							SendClientMessage(playerid, COLOR_ORANGE, "Invalid weapon!");
						}
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/tele", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /tele [id-name]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256], Float:x, Float:y, Float:z;
					GetPlayerName(id, name, sizeof(name));
					
					if(id == playerid){
					    SendClientMessage(playerid, COLOR_ORANGE, "You cannot teleport to yourself!");
					} else {
						format(string, sizeof(string), "%s has teleported to %s.", admin, name);

                        SetPlayerWorldBounds( playerid, 887.0, -2090.0, 2989.0, 537.0);
						AdminLog(playerid,string);
					    GetPlayerPos(id, x, y, z);
					    SetPlayerInterior(playerid, GetPlayerInterior(id));
						SetPlayerPos(playerid, x, y, z);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/bring", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /bring [id-name]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp), name[256], Float:x, Float:y, Float:z;
					GetPlayerName(id, name, sizeof(name));

					if(id == playerid){
					    SendClientMessage(playerid, COLOR_ORANGE, "You cannot fetch yourself!");
					} else {
						format(string, sizeof(string), "%s has fetched %s.", admin, name);

                        SetPlayerWorldBounds( id, 887.0, -2090.0, 2989.0, 537.0);
						AdminLog(playerid,string);
					    GetPlayerPos(playerid, x, y, z);
					    SetPlayerInterior(id, GetPlayerInterior(playerid));
						SetPlayerPos(id, x, y, z);
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/setmoney", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /setmoney [id-name] [amount]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp);
   					tmp = strtok(cmdtext, idx);
   					
   					if(!strlen(tmp)){
   					    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /setmoney [id-name] [amount]");
   					} else {
   					    new name[256];

						GetPlayerName(id, name, sizeof(name));
						format(string, sizeof(string), "%s has set money of  %s to %i.", admin, name, strval(tmp));

						AdminLog(playerid,string);
						SetPlayerCash(id, strval(tmp));
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/sethealth", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /sethealth [id-name] [amount]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp);
   					tmp = strtok(cmdtext, idx);

   					if(!strlen(tmp)){
   					    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /sethealth [id-name] [amount]");
   					} else {
   					    new name[256];

						GetPlayerName(id, name, sizeof(name));
						format(string, sizeof(string), "%s has set health of  %s to %i.", admin, name, strval(tmp));

						AdminLog(playerid,string);
						SetPlayerHealth(id, strval(tmp));
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	if (strcmp(cmd, "/setscore", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /setscore [id-name] [amount]");
			} else {
				if(FindUser(tmp)){
   					new id = GiveID(tmp);
   					tmp = strtok(cmdtext, idx);

   					if(!strlen(tmp)){
   					    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /setscore [id-name] [amount]");
   					} else {
   					    new name[256];

						GetPlayerName(id, name, sizeof(name));
						format(string, sizeof(string), "%s has set score of  %s to %i.", admin, name, strval(tmp));

						AdminLog(playerid,string);
						SetPlayerScore(id, strval(tmp));
						SendClientMessageToAll(COLOR_GREEN, string);
					}
 				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "Target not found or multiple targets found.");
				}

			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/add", true)==0)
	{
	    if(IsPlayerLevel(playerid,6)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /add [name] [password] <level>");
			} else {
				new name[256];
				format(name, sizeof(name), "%s", tmp);
				tmp = strtok(cmdtext, idx);

				if(!strlen(tmp)){
				    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /add [name] [password] <level>");
				} else {
				    new filename[256];
				    format(filename, sizeof(filename), "%s.txt", name);

				    if(fexist(filename)){
				     	SendClientMessage(playerid, COLOR_ORANGE, "This user is already registered!");
					} else {
					    new string2[256], password[256], level;
						format(password, sizeof(password), "%s", tmp);
						tmp = strtok(cmdtext, idx);

	   					if(!strlen(tmp)){
	   					    level = 1;
	   					} else {
	   					    level = strval(tmp);

	   					    if(level < 1 || level > 6){
	   					        level = 1;
							}
						}

						format(string, sizeof(string), "%s has added player %s with level %i.", admin, name, level);
	                    format(string2, sizeof(string2), "Your registered! You can login with password %s by typing /login.", password);

						AdminLog(playerid,string);
						SendClientMessageToAll(COLOR_GREEN, string);
						Register(name,password,level);

						for(new i = 0; i <= MAX_PLAYERS; i++){
						    if(IsPlayerConnected(i)){
								new playername[256];
								GetPlayerName(i, playername, sizeof(playername));

								if(strcmp(playername, name, false) == 0){
	                                SendClientMessage(i, COLOR_LIGHTBLUE, string2);
								}
							}
						}
					}
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/del", true)==0)
	{
	    if(IsPlayerLevel(playerid,6)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /del [name]");
			} else {
				new name[256];
				format(name, sizeof(name), "%s", tmp);

			    new filename[256];
			    format(filename, sizeof(filename), "%s.txt", name);

			    if(fexist(filename)){
					format(string, sizeof(string), "%s has deleted player %s.", admin, name);

					AdminLog(playerid,string);
					SendClientMessageToAll(COLOR_GREEN, string);
					Delete(name);
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "This user isnt registered.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/lvl", true)==0)
	{
	    if(IsPlayerLevel(playerid,6)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /lvl [name] [new-level]");
			} else {
				new name[256];
				format(name, sizeof(name), "%s", tmp);
				tmp = strtok(cmdtext, idx);
				
				if(!strlen(tmp)){
				    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /lvl [name] [new-level]");
				} else {
				    new filename[256];
				    format(filename, sizeof(filename), "%s.txt", name);

				    if(fexist(filename)){
				        if(strval(tmp) == GetPlayerLevel(name)){
				            SendClientMessage(playerid, COLOR_ORANGE, "Levels are the same!");
						} else {
							format(string, sizeof(string), "%s has changed the level of player from %i to %i.", GetPlayerLevel(name), strval(tmp));

							AdminLog(playerid,string);
							SendClientMessageToAll(COLOR_GREEN, string);
							Level(name,strval(tmp));
						}
					} else {
			  			SendClientMessage(playerid, COLOR_ORANGE, "This user isnt registered.");
					}
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}
		
		return 1;
	}
	
	if (strcmp(cmd, "/member", true)==0)
	{
	    if(IsPlayerLevel(playerid,6)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /member [name]");
			} else {
				new name[256];
				format(name, sizeof(name), "%s", tmp);
			    new filename[256];
			    format(filename, sizeof(filename), "%s.txt", name);

			    if(fexist(filename)){
					format(string, sizeof(string), "[ADMIN] Level of %s is %i", name, GetPlayerLevel(name));

					AdminLog(playerid,string);
					SendClientMessage(playerid, COLOR_GREEN, string);
				} else {
		  			SendClientMessage(playerid, COLOR_ORANGE, "This user isnt registered.");
				}
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}

	if (strcmp(cmd, "/announce", true)==0)
	{
	    if(IsPlayerLevel(playerid,3)){
 		    new tmp[256], admin[256], string[256];
			GetPlayerName(playerid, admin, sizeof(admin));
            tmp = strtok(cmdtext, idx);

			if(!strlen(tmp)){
			    SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /announce [message]");
			} else {
				strdel(cmdtext, 0, 10);
				GameTextForAll(cmdtext, 5000, 3);
				
				format(string, sizeof(string), "%s announced: %s", admin, cmdtext);
				AdminLog(playerid, string);
			}
		} else {
		    SendClientMessage(playerid, COLOR_ORANGE, "Your not authorised to use this command!");
		}

		return 1;
	}
	
	return 0;
}

//
// When player enters a checkpoint
//
public OnPlayerEnterCheckpoint(playerid)
{
	SendClientMessage(playerid, COLOR_YELLOW, "Type /buy to buy ammo, health, armor and insurances here!");

	return 1;
}

//
// When player enters a vehicle
//
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
	if(gSpecced[playerid] == 1){
		PlayerSpectateVehicle(gSpecAdmin[playerid], vehicleid);
	}
}

//
// When player exits a vehicle
//
public OnPlayerExitVehicle(playerid, vehicleid){
	if(gSpecced[playerid] == 1){
		PlayerSpectatePlayer(gSpecAdmin[playerid], playerid);
	}
}

//
// When player submits a message
//
public OnPlayerText(playerid, text[])
{
	if(gLogin[playerid] == 1){
	    Login(playerid, text);
	    return 0;
	} else if(gMute[playerid] == 1){
	    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have been muted by an admin.");
		return 0;
	} else if(chatlock == 1){
	    if(!IsPlayerLevel(playerid, 1)){
	        if(chatlockreason == 0){
		    	SendClientMessage(playerid, COLOR_LIGHTBLUE, "An admin has locked the chat.");
			} else {
			    new string[256];
			    
			    format(string, sizeof(string), "An admin has locked the chat for reason: '%s'", chatlockreason);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			}
			
		    return 0;
	    }
	} else if(text[0] == '!'){
		strdel(text, 0, 1);
		
		if(!strlen(text) || strlen(text) == 0){
			SendClientMessage(playerid, COLOR_ORANGE, "You must put something behind your ! (Your message)");
		} else {
			SendTeamMessage(playerid, text);
		}
		
		return 0;
	}

	format(codetext, sizeof(codetext), "%i", code);
	if (strcmp(text, codetext, true)==0)
	{
	    new string[256], playername[256];

	    GetPlayerName(playerid, playername, sizeof(playername));
	    format(string, sizeof(string), "%s has won $%i for typing %i the fastest!", playername, codemoney, code);
		code = 98327421903201487238421930210482358621983472190145;

	    SendClientMessageToAll(COLOR_YELLOW, string);

	    GivePlayerCash(playerid, codemoney);

		return 0;
	}

	gSpam[playerid] = gSpam[playerid] + 1;
	if(gSpam[playerid] > 3){
		SendClientMessage(playerid, COLOR_ORANGE, "Stop spamming!");
	    return 0;
	} else if(gSpam[playerid] == 1){
        SetTimerEx( "antiSpam", 5000, 0, "i", playerid );
	}

	Log(playerid, text);
	return 1;
}

//
// Bai
//
public antiSpam(playerid){
	gSpam[playerid] = 0;
}

//
// Reset all variables
//
public Reset(playerid){
	gTeam[playerid] = 0;
	gLogin[playerid] = 0;
	gAuth[playerid] = 0;
	gMute[playerid] = 0;
	gFreeze[playerid] = 0;
	gWarnings[playerid] = 0;
	gProtected[playerid] = 0;
	gMoney[playerid] = 0;
	gScore[playerid] = 0;
	gSpec[playerid] = 0;
	gNext[playerid] = 0;
	ResetPlayerMoney(playerid);
	ResetPlayerWeapons(playerid);
}

//
// Nice message
//
public nicemessage(){
	messagecount++;

	if(messagecount == 8){
		messagecount = 1;
	}

	if(messagecount == 1){
	    SendClientMessageToAll(COLOR_PINK, "Did you know you can buy ammo, health, armor and insurances? Go to the red checkpoints and type /buy!");
	} else if(messagecount == 2){
	    SendClientMessageToAll(COLOR_PINK, "Found someone cheating? Send a message to the admins by typing /message!");
	} else if(messagecount == 3){
	    SendClientMessageToAll(COLOR_PINK, "You want to choose your weapons again? Type /weapons and you get the menu when you spawn again!");
	} else if(messagecount == 4){
	    SendClientMessageToAll(COLOR_PINK, "Follow the rules! Type /rules for all the rules on this server.");
	} else if(messagecount == 5){
	    SendClientMessageToAll(COLOR_PINK, "Need help? Type /help for more information, and type /commands for all the commands!");
	} else if(messagecount == 6){
	    SendClientMessageToAll(COLOR_PINK, "Would like to talk about team-related stuff? Add an ! in front of your message for teamchat!");
	} else if(messagecount == 7){
	    SendClientMessageToAll(COLOR_PINK, "This mode is made by Woet!");
	}
}

//
// Anti spawnkill
//
public antiSpawnKill(){
	for(new i = 0; i <= MAX_PLAYERS; i++){
	    if(IsPlayerConnected(i)){
			if(IsPlayerSpawned(i)){
			    new range;

				if(gTeam[i] == 1){
					range = PlayerToCoord(i, -1394.5950,2643.2791,55.8932);
				} else if(gTeam[i] == 2){
				    range = PlayerToCoord(i, -733.8346,1624.4266,27.1172);
    			} else if(gTeam[i] == 3){
    			    range = PlayerToCoord(i, -321.6065,1056.7443,19.7422);
    			} else if(gTeam[i] == 4){
    			    range = PlayerToCoord(i, 184.2655,1931.6104,17.8262);
    			} else if(gTeam[i] == 5){
    			    range = PlayerToCoord(i, -251.0042,2588.0261,63.5703);
				} else {
				    range = 0;
				}

				if(range < 5 && gProtected[i] != 2){
					gProtected[i] = 1;
					SetPlayerHealth(i, 99999);
				} else {
				    if(gProtected[i] == 1){
				    	SetPlayerHealth(i, 100);
				    	gProtected[i] = 2;
					}
				}
			}
		}
	}
}

//
// Did the player log in and spawn?
//
public IsPlayerSpawned(playerid){
    if(GetPlayerState(playerid) == 1 || GetPlayerState(playerid) == 2){
    	return 1;
	}

	return 0;
}

//
// Send messgae to player that he's warned
//
public SendWarnMessage(playerid,adminid,reason[]){
	new length, string[256], admin[256], reason2[256], reason3[256], Hour, Minute, Second;

    gWarnings[playerid] = gWarnings[playerid] + 1;

	if(IsPlayerConnected(adminid)){
	    GetPlayerName(adminid, admin, sizeof(admin));
	} else {
	    admin = "System";
	}

	gettime(Hour, Minute, Second);
	length = strlen(reason);

 	if(length == 0){
		format(reason2, sizeof(reason2), "None");
  	} else {
  		format(reason2, sizeof(reason2), "%s", reason);
  	}

	if(gWarnings[playerid] >= 3){
	    format(reason3, sizeof(reason3), "Maximum of 3 warnings reached (%s)", reason);
	    SendKickMessage(playerid, 999, reason3);
	}

	SendClientMessage(playerid, COLOR_PINK, "****************************************************************");
	SendClientMessage(playerid, COLOR_PINK, "*                             WARNING!                              *");
	SendClientMessage(playerid, COLOR_PINK, "****************************************************************");
	format(string, sizeof(string), "Admin: %s", admin);
	SendClientMessage(playerid, COLOR_PINK, string);
	format(string, sizeof(string), "Warning: %i/3", gWarnings[playerid]);
	SendClientMessage(playerid, COLOR_PINK, string);
	format(string, sizeof(string), "Time: %i:%i:%i", Hour,Minute,Second);
	SendClientMessage(playerid, COLOR_PINK, string);
	format(string, sizeof(string), "Reason: %s", reason2);
	SendClientMessage(playerid, COLOR_PINK, string);
	SendClientMessage(playerid, COLOR_PINK, "****************************************************************");
	SendClientMessage(playerid, COLOR_PINK, "* Follow the rules or get kicked/banned! *");
	SendClientMessage(playerid, COLOR_PINK, "****************************************************************");

	return 1;
}

//
// Send message to player that he's kicked.
//
public SendKickMessage(playerid,adminid,reason[]){
	new length, string[256], name[256], admin[256], Hour, Minute, Second, reason2[256];
	
	if(IsPlayerConnected(adminid)){
	    GetPlayerName(adminid, admin, sizeof(admin));
	} else {
	    admin = "System";
	}
	
	GetPlayerName(playerid, name, sizeof(name));
	gettime(Hour, Minute, Second);
	length = strlen(reason);

 	if(length == 0){
		format(reason2, sizeof(reason2), "Reason: None");
  	} else {
  		format(reason2, sizeof(reason2), "Reason: %s", reason);
  	}

	if(gInvisibleKick[playerid] == 1){
	    gInvisibleKick[playerid] = 0;
	} else {
		format(string, sizeof(string), "KICK: %s has kicked player %s (%s)", admin, name, reason2);
		SendClientMessageToAll(COLOR_PINK, string);
	}
	
	SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
	SendClientMessage(playerid, COLOR_PINK, "* You have been KICKED from the server *");
	SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
	format(string, sizeof(string), "Admin: %s", admin);
    SendClientMessage(playerid, COLOR_PINK, string);
   	SendClientMessage(playerid, COLOR_PINK, reason2);
 	format(string, sizeof(string), "Time: %i:%i:%i", Hour, Minute, Second);
    SendClientMessage(playerid, COLOR_PINK, string);
    SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
    SendClientMessage(playerid, COLOR_PINK, "* Come back if you can follow the rules   *");
    SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
    
    Reset(playerid);
    Kick(playerid);
    return 1;
}

//
// Send message to player that he's banned.
//
public SendBanMessage(playerid,adminid,reason[]){
	new length, string[256], name[256], admin[256], Hour, Minute, Second, reason2[256];
	GetPlayerName(playerid, name, sizeof(name));
	GetPlayerName(adminid, admin, sizeof(admin));
	gettime(Hour, Minute , Second);
	length = strlen(reason);
	
	if(IsPlayerConnected(adminid)){
	    GetPlayerName(adminid, admin, sizeof(admin));
	} else {
	    admin = "System";
	}

 	if(length == 0){
		format(reason2, sizeof(reason2), "Reason: None");
  	} else {
  		format(reason2, sizeof(reason2), "Reason: %s", reason);
  	}

	format(string, sizeof(string), "BAN: %s has banned player %s (%s)", admin, name, reason2);
	SendClientMessageToAll(COLOR_PINK, string);
	SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
	SendClientMessage(playerid, COLOR_PINK, "* You have been BANNED from the server *");
	SendClientMessage(playerid, COLOR_PINK, "*****************************************************");
	format(string, sizeof(string), "Admin: %s", admin);
    SendClientMessage(playerid, COLOR_PINK, string);
   	SendClientMessage(playerid, COLOR_PINK, reason2);
 	format(string, sizeof(string), "Time: %i:%i:%i", Hour, Minute, Second);
    SendClientMessage(playerid, COLOR_PINK, string);
    SendClientMessage(playerid, COLOR_PINK, "***********************************************************");
    SendClientMessage(playerid, COLOR_PINK, "* Ban Appeals: http://www.clan12.com   *");
    SendClientMessage(playerid, COLOR_PINK, "***********************************************************");
    
    Reset(playerid);
    BanEx(playerid,reason);
    
    return 1;
}

//
// Send an message to all admins
//
public SendAdminMessage(message[]){
	for(new i = 0; i <= MAX_PLAYERS; i++){
	    if(IsPlayerConnected(i)){
		    if(IsPlayerAdmin(i)){
		        SendClientMessage(i, COLOR_GREEN, message);
			}
		}
	}
}

//
// Find the ID of a name, in stead of the other way round
//
public GetPlayerID(name[]){
	new stop = 0;
	
	for(new i = 0; i <= MAX_PLAYERS; i++){
	    if(stop == 0){
		    if(IsPlayerConnected(i)){
				new playername[256];
				GetPlayerName(i, playername, sizeof(playername));

                if (strcmp(playername, name[0], true)==0){
				    return i;
				}
			}
		}
	}
	
	return 0;
}
//
// Is the user id, part of name, or name online? Returns user ID
//
public GiveID(const string[]) {
	new results = 0, resultid;
	new id = strval(string);

	if(isNumeric(string)){
		if(IsPlayerConnected(id)){
		    return id;
		}
	} else {
		for(new i = 0; i <= MAX_PLAYERS; i++){
		    if(IsPlayerConnected(i)){
				new name[256], message[256];
				GetPlayerName(i, name, sizeof(name));
				format(message, sizeof(message), "%s|%s", name, string);

     			if (strfind(name, string, true) == -1){
     			} else {
     			    results++;
     			    resultid = i;
				}
			}
		}
		if(results == 1){
		    return resultid;
		}
	}

	return 0;
}

//
// Is the user id, part of name, or name online? Returns true/false
//
public FindUser(const string[]) {
	new results = 0;
	new Float:id = floatstr(string);
	new round = floatround(id, floatround_floor);

	if(isNumeric(string)){
		if(IsPlayerConnected(round)){
		    return 1;
		}
	} else {
		for(new i = 0; i <= MAX_PLAYERS; i++){
		    if(IsPlayerConnected(i)){
				new name[256], message[256];
				GetPlayerName(i, name, sizeof(name));
				format(message, sizeof(message), "%s|%s", name, string);

     			if (strfind(name, string, true) == -1){
     			} else {
     			    results++;
				}
			}
		}
		if(results == 1){
		    return 1;
		}
	}

	return 0;
}

//
// Make a timestamp
//
public mktime(second,minute,hour,day,month,year) {
	new timestamp2;

	timestamp2 = second + (minute * 60) + (hour * 3600);
	new days_of_month[12];

	if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) {
		days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31};
	} else {
		days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31};
	}

	new days_this_year = 0;
	days_this_year = day;

	if(month > 1) {
		for(new i=0; i<month-1;i++) {
			days_this_year += days_of_month[i];
		}
	}
	timestamp2 += days_this_year * 86400;

	for(new j=1970;j<year;j++) {
		timestamp2 += 31536000;
		
		if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ){
			timestamp2 += 86400;
		}
	}

	return timestamp2;
}

//
// Freeze the player
//
public FreezeMenu(playerid){
	ShowMenuForPlayer(ChooseHand, playerid);
	TogglePlayerControllable(playerid, false);
}

//
// Make a timestamp
//
public time(){
  	new second,minute,hour,day,month,year;
  
  	gettime(hour, minute, second);
	getdate(year, month, day);
  
	return mktime(second,minute,hour,day,month,year);
}

//
// Log
//
public Log(playerid,text[]){
	if(gLogin[playerid] == 1){
	} else {
		new Hour,Minut,Second,Day,Month,Year,name[256],ip[256],filecontents[256];
		gettime(Hour,Minut,Second);
		getdate(Year,Month,Day);
		GetPlayerIp(playerid, ip, sizeof(ip));
		GetPlayerName(playerid, name, sizeof(name));

		format(filecontents, sizeof(filecontents), "[%i-%i-%i %i:%i:%i] [%s] [%s] [%s]\n", Day,Month,Year,Hour,Minut,Second,name,ip,text);

        new File:gFile = fopen("log.log", io_readwrite);
		fseek(gFile, 0, seek_end);
        fwrite(gFile, filecontents);
        fclose(gFile);
	}
}

//
// Admin Log
//
public AdminLog(playerid,text[]){
		new Hour,Minut,Second,Day,Month,Year,name[256],ip[256],filecontents[256];
		gettime(Hour,Minut,Second);
		getdate(Year,Month,Day);
		GetPlayerIp(playerid, ip, sizeof(ip));
		GetPlayerName(playerid, name, sizeof(name));

		format(filecontents, sizeof(filecontents), "[%i-%i-%i %i:%i:%i] [%s] [%s] [%s]\n", Day,Month,Year,Hour,Minut,Second,name,ip,text);

        new File:gFile = fopen("admin.log", io_readwrite);
		fseek(gFile, 0, seek_end);
        fwrite(gFile, filecontents);
        fclose(gFile);
}

//
// Admin Chat Log
//
public AdminChatLog(playerid,text[]){
		new Hour,Minut,Second,Day,Month,Year,name[256],ip[256],filecontents[256];
		gettime(Hour,Minut,Second);
		getdate(Year,Month,Day);
		GetPlayerIp(playerid, ip, sizeof(ip));
		GetPlayerName(playerid, name, sizeof(name));

		format(filecontents, sizeof(filecontents), "[%i-%i-%i %i:%i:%i] [%s] [%s] [%s]\n", Day,Month,Year,Hour,Minut,Second,name,ip,text);

        new File:gFile = fopen("adminchat.log", io_readwrite);
		fseek(gFile, 0, seek_end);
        fwrite(gFile, filecontents);
        fclose(gFile);
}

//
// Registering a player
//
public Register(playername[], password[], level){
	new tmp[256], idx, filename[256], filecontents[256], filename2[256], levelstring[256];
	tmp = strtok(password, idx);

	format(filename, sizeof(filename), "%s.txt", playername);
	format(filename2, sizeof(filename2), "%s_level.txt", playername);
	format(filecontents, sizeof(filecontents), "%s|%s", playername, tmp);
	format(levelstring, sizeof(levelstring), "%i", level);

    new File:gFile = fopen(filename, io_readwrite);
    fwrite(gFile, filecontents);
    fclose(gFile);

    new File:gFile2 = fopen(filename2, io_readwrite);
    fwrite(gFile2, levelstring);
    fclose(gFile2);

    return 1;
}

//
// Logging in a player
//
public Login(playerid, password[]){
	new tmp[256], idx, filename[256], filecontents[256], filerealcontents[256], playername[256], string[256];
	tmp = strtok(password, idx);

	GetPlayerName(playerid, playername, sizeof(playername));
	format(filename, sizeof(filename), "%s.txt", playername);
	format(filecontents, sizeof(filecontents), "%s|%s", playername, tmp);

	if(fexist(filename)){
        new File:gFile = fopen(filename, io_readwrite);
		fread(gFile, filerealcontents, sizeof(filerealcontents));
        fclose(gFile);

        if (strcmp(filecontents, filerealcontents, true)==0){
			gLogin[playerid] = 0;
		   	gAuth[playerid] = 1;

			format(string, sizeof(string), "Welcome %s, your now logged in!", playername);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

			format(string, sizeof(string), "[ADMIN] %s has logged in.", playername);
			SendAdminMessage(string);
			AdminLog(playerid, string);
		} else {
		    SendClientMessage(playerid, COLOR_LIGHTBLUE, "ERROR: Password is incorrect. Please try again.");
		}
	} else {
		gLogin[playerid] = 0;
	    SendClientMessage(playerid, COLOR_ORANGE, "ERROR: This nickname isnt an Admin.");
	}

	return 0;
}

//
// Checking if player is registered
//
public IsPlayerRegistered(playerid){
	    new playername[256], filename[256];

		GetPlayerName(playerid, playername, sizeof(playername));
	    format(filename, sizeof(filename), "%s.txt", playername);

	    if(fexist(filename)){
	        return 1;
		}

		return 0;
}

//
// Checking if player is logged in
//
public IsPlayerLoggedIn(playerid){
	if(IsPlayerAdmin(playerid)){
	    return 1;
	}

	return 0;
}

//
// Check users level
//
public IsPlayerLevel(playerid,level){
	if(IsPlayerAdmin(playerid)){
		return 1;
	}

	return 0;
}

//
// Are you alive? :]
//
public alive(){
	new rand = random(999999), string[256];

	while(rand < 10000){
	    rand = random(999999);
	}

	new money = random(10000);
	new timenew = random(1000);

	while(timenew < 120){
	    timenew = random(1000);
	}

	format(string, sizeof(string), "ARE YOU ALIVE? Win $%i by typing the following numbers the fastest! %i", money, rand);
	SendClientMessageToAll(COLOR_YELLOW, string);

	timenew = timenew * 1000;

	code = rand;
	codemoney = money;
	SetTimer("alive", timenew, 0);
}

//
// Anti cheat
//
public antiCheat(){
	// I cant be assed for anticheat, SAC will do his job (i hope)
}

//
// Stupid exiters!
//
public OnPlayerExitedMenu(playerid){
	if(gFreeze[playerid] != 1){
	    TogglePlayerControllable(playerid, true);
	}
}

//
// Lets save his position
//
public updatePos(){
    for(new i = 0; i < MAX_PLAYERS; i++){
        if(IsPlayerConnected(i)){
            //
			// Lets check for checkpoints
			//
			new distanceone = PlayerToCoord(i,-1424.7205,2169.2412,49.9769);
			new distancetwo = PlayerToCoord(i,-687.6823,938.1758,13.6328);
			new distancethree = PlayerToCoord(i,414.7509,2533.7778,19.1484);
			new distancefour = PlayerToCoord(i,661.0508,1718.2899,7.1875);
			new distancefive = PlayerToCoord(i,-312.1561,1765.9705,43.6406);

			if(distanceone < 100){
			    if(gMenu[i] != 1){
			        gMenu[i] = 1;
	   				SetPlayerCheckpoint(i,-1424.7205,2169.2412,49.9769,10);
	   				SetPlayerMapIcon(i,1,-1424.7205,2169.2412,49.9769,18, COLOR_WHITE);
				}
			} else if(distancetwo < 100){
			    if(gMenu[i] != 1){
			        gMenu[i] = 1;
					SetPlayerCheckpoint(i,-687.6823,938.1758,13.6328,10);
					SetPlayerMapIcon(i,1,-687.6823,938.1758,13.6328,18, COLOR_WHITE);
				}
			} else if(distancethree < 100){
			    if(gMenu[i] != 1){
			        gMenu[i] = 1;
			    	SetPlayerCheckpoint(i,403.8127,2536.7527,16.5457,10);
			    	SetPlayerMapIcon(i,1,403.8127,2536.7527,16.5457,18, COLOR_WHITE);
				}
			} else if(distancefour < 100){
			    if(gMenu[i] != 1){
			        gMenu[i] = 1;
			    	SetPlayerCheckpoint(i,661.0508,1718.2899,7.1875,10);
			    	SetPlayerMapIcon(i,1,661.0508,1718.2899,7.1875,18, COLOR_WHITE);
				}
			} else if(distancefive < 100){
			    if(gMenu[i] != 1){
			        gMenu[i] = 1;
			    	SetPlayerCheckpoint(i,-312.1561,1765.9705,43.6406,10);
			    	SetPlayerMapIcon(i,1,-312.1561,1765.9705,43.6406,18, COLOR_WHITE);
				}
			} else {
			    gMenu[i] = 0;
			    DisablePlayerCheckpoint(i);
			    RemovePlayerMapIcon(i, 1);
			}

            GetPlayerPos(i, players[ i ][ 2 ][ 0 ], players[ i ][ 2 ][ 1 ], players[ i ][ 2 ][ 2 ]);
            if( GetPlayerState( i ) == PLAYER_STATE_WASTED )
            {

            }
            else if( GetPlayerInterior( i ) != 0  && players[ i ][ 2 ][ 2 ] > 900.0)
            {
                SetPlayerInterior( i, 0 );
                SetPlayerPos( i, players[ i ][ 0 ][ 0 ], players[ i ][ 0 ][ 1 ], players[ i ][ 0 ][ 2 ]);
                SendClientMessage( i, COLOR_ORANGE, "Your not allowed into any interior!");
                GameTextForPlayer(i, "~r~GET OUT!", 2000, 3);
               	TogglePlayerControllable(i, true);
                players[ i ][ 1 ] = players[ i ][ 0 ];
                players[ i ][ 2 ] = players[ i ][ 0 ];

            } else if( GetPlayerInterior ( i ) != 0){
            }
            else
            {
                players[ i ][ 0 ] = players[ i ][ 1 ];
                players[ i ][ 1 ] = players[ i ][ 2 ];
            }
        }
    }
}

//
// Our special function to set player's money.
//
public SetPlayerCash(playerid, cash){
	if(IsPlayerConnected(playerid)){
	    ResetPlayerMoney(playerid);
	    gMoney[playerid] = cash;
	    GivePlayerMoney(playerid, cash);
	}
}

//
// Our special function to give player money.
//
public GivePlayerCash(playerid, cash){
	if(IsPlayerConnected(playerid)){
	    new money = GetPlayerMoney(playerid);
	    new amount = money + cash;
	    
	    ResetPlayerMoney(playerid);
	    gMoney[playerid] = amount;
	    GivePlayerMoney(playerid, amount);
	}
}

//
// Our special function to set player score
//
public SetPlayerPoint(playerid, points){
	if(IsPlayerConnected(playerid)){
        gScore[playerid] = points;
	    SetPlayerScore(playerid, points);
	}
}

//
// Our special function to give player score
//
public GivePlayerPoint(playerid, points){
	if(IsPlayerConnected(playerid)){
	    new score = GetPlayerScore(playerid);
	    new amount = score + points;

        gScore[playerid] = amount;
	    SetPlayerScore(playerid, amount);
	}
}

//
// Update world time
//
public updatetime(){
	new string[256];

	if(worldtime == 24){
	    worldtime = 00;
	}

	format(string, sizeof(string), "%i:00", worldtime);
	SetWorldTime(worldtime);
	GameTextForAll(string, 0, 1);

	worldtime = worldtime + 01;
}

//
// Dont go away!
//
public boundry(){
	for(new i = 0; i < MAX_PLAYERS; i++){
	    if(IsPlayerConnected(i)){
	        if(IsPlayerSpawned(i)){
	            new Float:x,Float:y,Float:z;
	            GetPlayerPos(i, x, y, z);
			}
		}
	}
}

//
// Calculating distance: player-vehicle
//
public PlayerToCar(playerid,vehicleid){
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	new Float:tmpdis;

	GetPlayerPos(playerid,x1,y1,z1);
	GetVehiclePos(vehicleid,x2,y2,z2);

	tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

	return floatround(tmpdis / 2);
}

//
// Calculating distance: player-player
//
public PlayerToPlayer(playerid,targetid){
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	new Float:tmpdis;

	GetPlayerPos(playerid,x1,y1,z1);
	GetPlayerPos(targetid,x2,y2,z2);

	tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

	return floatround(tmpdis / 2);
}

//
// Calculating distance: player-coordinates
//
public PlayerToCoord(playerid,Float:x2,Float:y2,Float:z2){
	new Float:x1,Float:y1,Float:z1;
	new Float:tmpdis;

	GetPlayerPos(playerid,x1,y1,z1);

	tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));

	return floatround(tmpdis / 2);
}

//
// Checks certain parameters
//
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

//
// Get out!
//
public interiorOut(playerid) {
	if(GetPlayerInterior(playerid) != 0){
        SetPlayerInterior( playerid, 0 );
        SetPlayerPos( playerid, players[ playerid ][ 0 ][ 0 ], players[ playerid ][ 0 ][ 1 ], players[ playerid ][ 0 ][ 2 ]);
        SendClientMessage( playerid, COLOR_ORANGE, "Your not allowed into any interior!");
        GameTextForPlayer(playerid, "~r~GET OUT!", 2000, 3);
        
       	TogglePlayerControllable(playerid, true);

	    players[ playerid ][ 1 ] = players[ playerid ][ 0 ];
	    players[ playerid ][ 2 ] = players[ playerid ][ 0 ];
	}
}

//
// Check if something is numberic
//
stock isNumeric(const string[])
{
  new length=strlen(string);
  if (length==0) return false;
  for (new i = 0; i < length; i++)
    {
      if (
            (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
             || (string[i]=='-' && i!=0)                                             // A '-' but not at first.
             || (string[i]=='+' && i!=0)                                             // A '+' but not at first.
         ) return false;
    }
  if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
  return true;

}

//
// Delete a player
//
public Delete(name[]){
	new tmp[256], idx, filename[256];
	tmp = strtok(name, idx);
	format(filename, sizeof(filename), "%s.txt", tmp);

	fremove(filename);
}

//
// Change the level
//
public Level(name[], level){
	new tmp[256], idx, filename[256], levelstring[256];
	tmp = strtok(name, idx);
	format(filename, sizeof(filename), "%s_level.txt", tmp);
	format(levelstring, sizeof(levelstring), "%i", level);
	
    new File:gFile = fopen(filename, io_readwrite);
    fwrite(gFile, levelstring);
    fclose(gFile);
}

//
// Get the level
//
public GetPlayerLevel(name[]){
	new tmp[256], idx, filename[256], filerealcontents[256], level;
	tmp = strtok(name, idx);
	format(filename, sizeof(filename), "%s_level.txt", tmp);
	
    new File:gFile = fopen(filename, io_readwrite);
	fread(gFile, filerealcontents, sizeof(filerealcontents));
	
	level = strval(filerealcontents);

	return level;
}

//
// Team message ftw
//
public SendTeamMessage(playerid, text[]){
	new string[256], name[256];
	
	if(IsPlayerConnected(playerid)){
		GetPlayerName(playerid, name, sizeof(name));
	    format(string, sizeof(string), "[TEAM] %s: %s", name, text);

		for(new i = 0; i < MAX_PLAYERS; i++){
		    if(IsPlayerConnected(i)){
		        if(gTeam[i] == gTeam[playerid]){
		            SendClientMessage(i, COLOR_LIGHTBLUE, string);
				}
			}
		}
	}
}

//
// Weather!
//
public weather(){
	new rand = random(20);
	
	while(rand == 8 || rand == 16 || rand == 20){
	    rand = random(20);
	}
	
	SetWeather(rand);
}