Public feed #377230

Something

public cpp v1 · immutable
Raw Edit
·published 2007-03-01 16:15 UTC
rendered paste body
// Author: sniper89// Licence: http://creativecommons.org/licenses/by-sa/2.5/#include <a_samp>// defines	// teams	#define teamct 0	#define teamt 1	// weapons	#define deagle 24	#define uzi 28	#define tec9 32	#define m4 31	#define ak47 30	#define ammo 900	// colours	#define blue 0x00A0FFAA	#define yellow 0xFFFF40AA	#define green 0x00C821AA	#define red 0xFF3030AA	#define grey 0x999999AA	#define white 0xFFFFFFAA	#define gold 0xFFDC18AA	#define servermsg 0xBAB3FFAA	// vehicles at counter-terrorists' spawn	#define armyjeep 470	#define armytruck 433	#define fbijeep 490	#define policebike 523	#define policecars 596	#define policecarf 597	#define policecarv 598	#define policejeep 599	#define swatvan 427	// vehicles at terrorists' spawn	#define alpha 602	#define banshee 429	#define blade 536	#define bullet 541	#define infernus 411	#define linerun 403	#define sabre 475	// vehicles round the city	#define burrito 482	#define cabbie 438	#define hermes 474	#define manana 410	#define premier 426	#define stallion 439	#define savanna 567	#define taxi 420// variablesnew version[]="1.1d";	// user options	new isadmin[MAX_PLAYERS];	new ischatop[MAX_PLAYERS];	new muted[MAX_PLAYERS];	new query[MAX_PLAYERS];	new chat[MAX_PLAYERS][256];	new chatinv[MAX_PLAYERS][256];	new gTeam[MAX_PLAYERS];	// bombsite data	new Float:bombsitecoords[14][3];	new bombsiteinfo[sizeof(bombsitecoords)][256];	new bombsite;	new carrierid=-1;	new defuserid=-1;	// timers related	new planttick=-1;	new bombtick=-1;	new defusetick=-1;	new votingtick=-1;	// tick for	new plantticktime=10;	new bombticktime=360;	new defuseticktime=60;	new votingticktimeinitial=15;	new votingticktime=10;	// polls	new polltype;	new polldata[4][256];	new votes[MAX_PLAYERS];main(){}public OnGameModeInit(){	new output[256];	new cbs;	new sessfile[256];	format(output,sizeof(output),"Bomb Defusal %s",version);	SetGameModeText(output);	printf("\n\n* Bomb Defusal %s up and running! *\n* If you'll find any bugs etc. or just have any suggestions\nor ideas please mail me at sniper89@tlen.pl *\n",version);	cbs=0;    bombsiteinfo[cbs]="top of the skyscrapper in Los Santos";    bombsitecoords[cbs][0]=1544.3966;    bombsitecoords[cbs][1]=-1352.9486;    bombsitecoords[cbs][2]=329.4749;    cbs=1;	bombsiteinfo[cbs]="white house in Los Santos";    bombsitecoords[cbs][0]=1111.2264;    bombsitecoords[cbs][1]=-2038.6241;    bombsitecoords[cbs][2]=74.4297;    cbs=2;	bombsiteinfo[cbs]="airport in Los Santos";    bombsitecoords[cbs][0]=1685.9930;    bombsitecoords[cbs][1]=-2239.8870;    bombsitecoords[cbs][2]=13.5469;    cbs=3;	bombsiteinfo[cbs]="mansion in Los Santos";    bombsitecoords[cbs][0]=1497.0911;    bombsitecoords[cbs][1]=-689.6719;    bombsitecoords[cbs][2]=94.8737;    cbs=4;    bombsiteinfo[cbs]="warehouse in the forest";    bombsitecoords[cbs][0]=-157.0618;    bombsitecoords[cbs][1]=-281.6817;    bombsitecoords[cbs][2]=3.9053;    cbs=5;	bombsiteinfo[cbs]="gas station in the forest";    bombsitecoords[cbs][0]=-91.8374;	bombsitecoords[cbs][1]=-1169.7325;	bombsitecoords[cbs][2]=2.4332;	cbs=6;	bombsiteinfo[cbs]="foundry in the forest";    bombsitecoords[cbs][0]=-1047.2261;	bombsitecoords[cbs][1]=-626.3447;	bombsitecoords[cbs][2]=32.0078;	cbs=7;    bombsiteinfo[cbs]="top of Big Pointy in San Fierro";    bombsitecoords[cbs][0]=-1753.7244;    bombsitecoords[cbs][1]=884.9254;    bombsitecoords[cbs][2]=295.8750;    cbs=8;	bombsiteinfo[cbs]="country club in San Fierro";    bombsitecoords[cbs][0]=-2720.2898;	bombsitecoords[cbs][1]=-318.2928;	bombsitecoords[cbs][2]=7.8438;	cbs=9;	bombsiteinfo[cbs]="water treatment plant in San Fierro";    bombsitecoords[cbs][0]=-2065.4487;    bombsitecoords[cbs][1]=-859.8090;    bombsitecoords[cbs][2]=32.1719;    cbs=10;    bombsiteinfo[cbs]="donut shop in San Fierro";    bombsitecoords[cbs][0]=-2766.0530;    bombsitecoords[cbs][1]=788.6316;    bombsitecoords[cbs][2]=52.7813;    cbs=11;	bombsiteinfo[cbs]="Cluckin Bell in San Fierro";    bombsitecoords[cbs][0]=-2671.7319;	bombsitecoords[cbs][1]=262.7274;	bombsitecoords[cbs][2]=4.6328;    cbs=12;	bombsiteinfo[cbs]="pyramid in Las Venturas";    bombsitecoords[cbs][0]=2323.6340;    bombsitecoords[cbs][1]=1283.2216;    bombsitecoords[cbs][2]=97.5732;    cbs=13;	bombsiteinfo[cbs]="stadium in Las Venturas";    bombsitecoords[cbs][0]=1411.5933;	bombsitecoords[cbs][1]=2182.9885;	bombsitecoords[cbs][2]=12.0156;	bombsite=random(sizeof(bombsitecoords));	ShowNameTags(1);	ShowPlayerMarkers(1);	synctime();	SetTimer("planttimer",1000,1);	SetTimer("bombtimer",1000,1);	SetTimer("defusetimer",1000,1);	SetTimer("votingtimer",1000,1);	if(bombsite<=3) // Los Santos	{	    AddPlayerClass(281,1598.1680,-1635.1780,13.7188,4.2911,deagle,ammo,uzi,ammo,m4,ammo);           // dark uniform		AddPlayerClass(283,1598.1680,-1635.1780,13.7188,4.2911,deagle,ammo,uzi,ammo,m4,ammo);           // in a hat		AddPlayerClass(284,1598.1680,-1635.1780,13.7188,4.2911,deagle,ammo,uzi,ammo,m4,ammo);           // biker		AddPlayerClass(102,1849.5923,-1863.8481,13.5781,83.0043,deagle,ammo,tec9,ammo,ak47,ammo);       // Balles - bandana		AddPlayerClass(103,1849.5923,-1863.8481,13.5781,83.0043,deagle,ammo,tec9,ammo,ak47,ammo);       // Ballas - fat		AddPlayerClass(104,1849.5923,-1863.8481,13.5781,83.0043,deagle,ammo,tec9,ammo,ak47,ammo);       // Ballas - cat		// vehicles at counter-terrorists' spawn		AddStaticVehicle(armyjeep,1602.8262,-1606.8627,13.3261,90.5690,-1,-1);		AddStaticVehicle(fbijeep,1602.4728,-1617.4009,13.3237,90.7816,-1,-1);		AddStaticVehicle(policebike,1602.9674,-1625.3488,13.3290,88.7607,-1,-1);		AddStaticVehicle(policecars,1574.9626,-1606.7561,13.2143,179.4917,-1,-1);		AddStaticVehicle(policejeep,1546.1515,-1614.6060,13.2144,268.5039,-1,-1);		AddStaticVehicle(swatvan,1546.3379,-1606.2083,13.2144,270.4913,-1,-1);		AddStaticVehicle(armytruck,1591.3291,-1707.2271,5.7221,359.9407,-1,-1);		// vehicles at terrorists' spawn   		AddStaticVehicle(alpha,1836.7169,-1854.0336,13.0148,179.2667,6,1);		AddStaticVehicle(banshee,1840.0067,-1853.8927,13.0138,178.9389,6,1);		AddStaticVehicle(blade,1834.5814,-1870.8862,13.0124,359.7042,6,1);		AddStaticVehicle(bullet,1837.9702,-1871.0481,13.0145,358.9055,6,1);		AddStaticVehicle(infernus,1841.2870,-1871.5901,13.0148,358.4752,6,1);		AddStaticVehicle(sabre,1844.4841,-1870.8223,13.0129,359.6885,6,1);		AddStaticVehicle(linerun,1837.0289,-1883.0282,14.0125,88.9477,6,1);		// vehicles round the city		AddStaticVehicle(burrito,1779.4326,-1928.3236,13.0135,176.8824,-1,-1);		AddStaticVehicle(cabbie,1808.4180,-1717.9922,13.1724,359.3620,-1,-1);		AddStaticVehicle(hermes,1614.3586,-1894.1757,13.1727,279.7676,-1,-1);		AddStaticVehicle(manana,1370.9845,-1898.2631,13.1286,177.5409,-1,-1);		AddStaticVehicle(premier,1393.8766,-1898.1573,13.1254,269.3625,-1,-1);		AddStaticVehicle(savanna,1406.0754,-1801.7788,13.1720,271.6718,-1,-1);		AddStaticVehicle(stallion,1404.4965,-1784.0037,13.1719,271.0101,-1,-1);		AddStaticVehicle(taxi,1421.8329,-1547.9740,13.1688,174.0597,-1,-1);		AddStaticVehicle(hermes,1459.9840,-1507.4556,13.1741,93.6946,-1,-1);		AddStaticVehicle(manana,1225.8889,-1558.0336,13.1723,0.8731,-1,-1);		AddStaticVehicle(premier,1124.5583,-1559.5559,13.3325,357.0052,-1,-1);		AddStaticVehicle(savanna,976.9384,-1702.4734,13.1609,182.4889,-1,-1);		AddStaticVehicle(stallion,883.6884,-1669.3914,13.1718,178.2730,-1,-1);		AddStaticVehicle(taxi,869.9617,-1658.2997,13.1718,2.3847,-1,-1);		AddStaticVehicle(burrito,788.9207,-1551.3091,13.1940,267.3347,-1,-1);		AddStaticVehicle(cabbie,820.8651,-1473.1750,12.5559,351.1437,-1,-1);		AddStaticVehicle(hermes,1248.2661,-1426.2916,13.1231,177.5361,-1,-1);		AddStaticVehicle(manana,1521.1346,-1460.6790,9.1248,0.5091,-1,-1);		AddStaticVehicle(premier,1743.2924,-1799.6869,13.1740,350.6450,-1,-1);	}	else if(bombsite>3 && bombsite<=6) // the forest	{	    AddPlayerClass(282,-347.5321,-1049.9102,59.3030,89.3010,deagle,ammo,uzi,ammo,m4,ammo);          // light uniform	    AddPlayerClass(280,-347.5321,-1049.9102,59.3030,89.3010,deagle,ammo,uzi,ammo,m4,ammo);          // dark uniform		AddPlayerClass(287,-347.5321,-1049.9102,59.3030,89.3010,deagle,ammo,uzi,ammo,m4,ammo);          // army		AddPlayerClass(134,-569.6555,-485.9732,25.5234,270.3097,deagle,ammo,tec9,ammo,ak47,ammo);       // village weirdo		AddPlayerClass(162,-569.6555,-485.9732,25.5234,270.3097,deagle,ammo,tec9,ammo,ak47,ammo);       // bald ditto		AddPlayerClass(254,-569.6555,-485.9732,25.5234,270.3097,deagle,ammo,tec9,ammo,ak47,ammo);       // harley		// vehicles at counter-terrorists' spawn		AddStaticVehicle(armyjeep,-375.9028,-1034.2738,59.1515,273.0167,-1,-1);		AddStaticVehicle(fbijeep,-344.8119,-1063.9705,59.3650,357.7837,-1,-1);		AddStaticVehicle(policebike,-353.8959,-1041.1001,58.9394,179.5128,-1,-1);		AddStaticVehicle(policecars,-368.2491,-1062.5995,58.9489,355.5307,-1,-1);		AddStaticVehicle(policejeep,-384.7495,-1041.6604,59.0473,185.0308,-1,-1);		AddStaticVehicle(swatvan,-349.7592,-1029.0184,59.4725,90.8998,-1,-1);		AddStaticVehicle(armytruck,-354.9938,-1062.1107,59.6779,0.0002,-1,-1);		// vehicles at terrorists' spawn   		AddStaticVehicle(alpha,-480.9571,-540.1323,25.3363,89.6270,6,1);		AddStaticVehicle(banshee,-525.2704,-499.2881,25.2033,0.7528,6,1);		AddStaticVehicle(blade,-550.1363,-500.6632,25.2612,359.9869,6,1);		AddStaticVehicle(bullet,-513.5544,-498.4120,25.1471,0.0001,6,1);		AddStaticVehicle(infernus,-499.3796,-472.2011,25.2505,179.7188,6,1);		AddStaticVehicle(sabre,-512.8984,-543.9714,25.3274,180.4466,6,1);		AddStaticVehicle(linerun,-551.5375,-556.8067,26.1296,269.6903,6,1);	}	else if(bombsite>6 && bombsite<=11) // San Fierro	{	    AddPlayerClass(285,-1616.3944,685.1974,7.1875,179.0545,deagle,ammo,uzi,ammo,m4,ammo);           // SWAT		AddPlayerClass(165,-1616.3944,685.1974,7.1875,179.0545,deagle,ammo,uzi,ammo,m4,ammo);           // glassy white		AddPlayerClass(166,-1616.3944,685.1974,7.1875,179.0545,deagle,ammo,uzi,ammo,m4,ammo);           // glassy brown		AddPlayerClass(127,-1710.0602,403.7595,7.4190,135.4669,deagle,ammo,tec9,ammo,ak47,ammo);        // gloved		AddPlayerClass(143,-1710.0602,403.7595,7.4190,135.4669,deagle,ammo,tec9,ammo,ak47,ammo);        // wearing a turban		AddPlayerClass(249,-1710.0602,403.7595,7.4190,135.4669,deagle,ammo,tec9,ammo,ak47,ammo);        // pimp		// vehicles at counter-terrorists' spawn		AddStaticVehicle(armyjeep,-1637.2670,659.5166,7.1851,270.7100,-1,-1);		AddStaticVehicle(fbijeep,-1621.0599,652.3383,7.3159,360.0000,-1,-1);		AddStaticVehicle(policebike,-1637.2740,668.6583,6.7577,270.3815,-1,-1);		AddStaticVehicle(policecarf,-1610.5924,651.9211,6.9574,0.1331,-1,-1);		AddStaticVehicle(policejeep,-1606.0313,672.8774,7.3810,180.0896,-1,-1);		AddStaticVehicle(swatvan,-1599.4531,653.1339,7.3194,359.9981,-1,-1);		AddStaticVehicle(armytruck,-1577.3726,742.0726,-4.8044,90.9725,-1,-1);		// vehicles at terrorists' spawn   		AddStaticVehicle(alpha,-1718.6603,394.9421,6.9863,225.1077,6,1);		AddStaticVehicle(banshee,-1699.7975,413.0408,6.8594,224.4851,6,1);		AddStaticVehicle(blade,-1705.1365,407.9250,6.9171,225.5239,6,1);		AddStaticVehicle(bullet,-1684.2582,415.2643,6.8045,133.4444,6,1);		AddStaticVehicle(infernus,-1676.1959,436.8989,6.9068,224.1639,6,1);		AddStaticVehicle(sabre,-1672.5662,414.1622,6.9808,132.9424,6,1);		AddStaticVehicle(linerun,-1647.5122,447.5629,7.7852,223.7694,6,1);		// vehicles round the city		AddStaticVehicle(burrito,-2029.7207,156.5224,28.6133,0.0953,-1,-1);		AddStaticVehicle(cabbie,-1989.4142,274.9331,35.0053,268.1717,-1,-1);		AddStaticVehicle(hermes,-1991.5795,242.2317,35.0036,272.0292,-1,-1);		AddStaticVehicle(manana,-1993.8483,147.1136,27.3707,358.3183,-1,-1);		AddStaticVehicle(premier,-2414.0176,536.0286,29.7599,260.3005,-1,-1);		AddStaticVehicle(savanna,-2429.5874,515.1132,29.7614,214.3941,-1,-1);		AddStaticVehicle(stallion,-2415.7961,332.0088,34.8037,148.0295,-1,-1);		AddStaticVehicle(taxi,-2460.7380,159.9629,34.7893,179.2496,-1,-1);		AddStaticVehicle(burrito,-2616.3035,118.5672,4.1677,269.2128,-1,-1);		AddStaticVehicle(cabbie,-2691.7793,268.3405,4.1675,0.5050,-1,-1);		AddStaticVehicle(hermes,-2661.7629,268.3940,4.1676,359.9607,-1,-1);	}	else if(bombsite>11 && bombsite<=13) // Las Venturas	{	    AddPlayerClass(286,2291.9756,2468.6641,10.8203,89.2011,deagle,ammo,uzi,ammo,m4,ammo);           // FBI		AddPlayerClass(164,2291.9756,2468.6641,10.8203,89.2011,deagle,ammo,uzi,ammo,m4,ammo);           // security blonde		AddPlayerClass(163,2291.9756,2468.6641,10.8203,89.2011,deagle,ammo,uzi,ammo,m4,ammo);           // security brown		AddPlayerClass(144,2875.2773,914.2205,10.7500,90.4654,deagle,ammo,tec9,ammo,ak47,ammo);         // masked chemist		AddPlayerClass(213,2875.2773,914.2205,10.7500,90.4654,deagle,ammo,tec9,ammo,ak47,ammo);         // Elvis-like weirdo		AddPlayerClass(181,2875.2773,914.2205,10.7500,90.4654,deagle,ammo,tec9,ammo,ak47,ammo);         // punk		// vehicles at counter-terrorists' spawn		AddStaticVehicle(armyjeep,2269.0125,2442.8860,10.8121,0.4218,-1,-1);		AddStaticVehicle(fbijeep,2256.1162,2476.6238,10.9481,178.9438,-1,-1);		AddStaticVehicle(policebike,2295.0823,2444.1877,10.3910,359.3846,-1,-1);		AddStaticVehicle(policecarv,2256.0183,2443.8674,10.5684,0.9621,-1,-1);		AddStaticVehicle(policejeep,2282.3901,2443.4541,11.0060,359.1050,-1,-1);		AddStaticVehicle(swatvan,2269.3687,2476.9321,10.9522,179.4292,-1,-1);		AddStaticVehicle(armytruck,2277.8657,2473.1670,10.9521,178.5424,-1,-1);		// vehicles at terrorists' spawn   		AddStaticVehicle(alpha,2831.6667,900.6870,10.5637,2.0008,6,1);		AddStaticVehicle(banshee,2823.3389,900.5762,10.4297,359.9897,6,1);		AddStaticVehicle(blade,2859.5332,898.5771,10.4952,1.1657,6,1);		AddStaticVehicle(bullet,2827.2117,928.1920,10.3750,180.3400,6,1);		AddStaticVehicle(infernus,2817.5278,939.4353,10.4771,359.5291,6,1);		AddStaticVehicle(sabre,2794.2104,951.9453,10.5556,180.7859,6,1);		AddStaticVehicle(linerun,2833.6257,980.0823,11.3560,178.2041,6,1);		for(new n=0;n<GetMaxPlayers();n++)		{		    format(sessfile,sizeof(sessfile),"adminaccs/sessions/%d.txt",n);		    if(fexist(sessfile) && !IsPlayerConnected(n))		    {		        fremove(sessfile);		    }		}	}	return 1;}public OnPlayerRequestClass(playerid, classid){	SetPlayerColor(playerid,grey); 	SetPlayerInterior(playerid,14);	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);	SetPlayerFacingAngle(playerid, 270.0);	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);	if(classid>=0 && classid<3)	{	    gTeam[playerid]=teamct;		GameTextForPlayer(playerid,"~b~Counter-Terrorists",5000,3);	}	else if(classid>=3 && classid<6)	{	    gTeam[playerid]=teamt;		GameTextForPlayer(playerid,"~y~Terrorists",5000,3); 	}	return 1;}public OnGameModeExit(){	new sessfile[256];	new File:file;	for(new n=0;n<GetMaxPlayers();n++)	{	    if(isadmin[n]==1)	    {		    format(sessfile,sizeof(sessfile),"adminaccs/sessions/%d.txt",n);		    file=fopen(sessfile,io_write);		    fclose(file);	    }	}	return 1;}public OnPlayerConnect(playerid){    new sessfile[256];    new output[256];    format(sessfile,sizeof(sessfile),"adminaccs/sessions/%d.txt",playerid);	if(fexist(sessfile))	{		fremove(sessfile);		isadmin[playerid]=1;	}	else	{	    isadmin[playerid]=0;	}    ischatop[playerid]=0;    muted[playerid]=0;	query[playerid]=-1;	chat[playerid]="";	chatinv[playerid]="";	SetPlayerColor(playerid,grey);	SetPlayerCheckpoint(playerid,bombsitecoords[bombsite][0],bombsitecoords[bombsite][1],bombsitecoords[bombsite][2],5);	format(output,sizeof(output),"Hello and welcome to Bomb Defusal %s!",version);	SendClientMessage(playerid,white,output);	SendClientMessage(playerid,white,"For more info type /help in the chat window.");	SendClientMessage(playerid,white,"Currently I need someone to place cars around SF, LV and the forest.");	SendClientMessage(playerid,white,"If you'll find any bugs or have any bombsite (or other) suggestions");	SendClientMessage(playerid,white,"feel free to mail me at sniper89@tlen.pl ;)");	if(carrierid==-1)	{	    format(output,sizeof(output),"The terrorists have planted the bomb at the %s!",bombsiteinfo[bombsite]);	    	}	else	{	    format(output,sizeof(output),"The terrorists are about to plant the bomb at the %s!",bombsiteinfo[bombsite]);	}	SendClientMessage(playerid,yellow,output);	return 1;}public OnPlayerDisconnect(playerid){    if(votingtick>0 && polltype==1 && playerid==polldata[0][0])	{	    votingtick=-1;		SendClientMessageToAll(servermsg,"Player disconnected, voting cancelled.");	}	new name[256];	new output[256];	GetPlayerName(playerid,name,sizeof(name));	for(new n=0;n<GetMaxPlayers();n++)	{	    if(strlen(chat[playerid])!=0 && strcmp(chat[n],chat[playerid],true)==0)	    {	        format(output,sizeof(output),"%s has just left #%s.",name,chat[n]);			SendClientMessage(n,gold,output);	    }	}	format(output,sizeof(output),"Your conversation with %s has ended - player disconnected.",name);	for(new n=0;n<GetMaxPlayers();n++)	{	    if(query[n]==playerid)	    {			query[n]=-1;			SendClientMessage(n,gold,output);	    }	}	if(playerid==carrierid)	{	    carrierid=-1;		SendClientMessageToAll(green,"The bomb carrier has left the game!");	}	return 1;}public OnPlayerSpawn(playerid){	if(gTeam[playerid]==teamct)	{		SetPlayerColor(playerid,blue);		GameTextForPlayer(playerid,"~w~Prevent the ~y~terrorists ~w~from destroying ~r~their target~w~!",5000,3);	}	else if(gTeam[playerid]==teamt)	{		if(bombtick==-1 && carrierid==-1)	    {	        new name[256];	        new output[256];	    	carrierid=playerid;	    	SetPlayerColor(playerid,green);	    	GetPlayerName(playerid,name,sizeof(name));	    	format(output,sizeof(output),"%s is now the bomb carrier!",name);	    	SendClientMessageToAll(green,output);			GameTextForPlayer(playerid,"~w~You have the bomb. Make your way to the ~r~bomb site ~w~and plant it there.",5000,3);	    }	    else	    {	    	SetPlayerColor(playerid,yellow);	    	if(carrierid==-1)	    	{	    	    GameTextForPlayer(playerid,"~w~Prevent the ~b~counter-terrorists ~w~from defusing the bomb!",5000,3);	    	}	    	else	    	{	    	    GameTextForPlayer(playerid,"~w~Escort the ~g~bomb carrier ~w~on his way to the ~r~bomb site~w~.",5000,3);	    	}	    }	}	SetPlayerInterior(playerid,0);	GivePlayerWeapon(playerid,46,-1);	return 1;}public OnPlayerDeath(playerid, killerid, reason){	if(IsPlayerConnected(killerid))	{		if(gTeam[playerid]==gTeam[killerid])		{			SetPlayerScore(killerid,GetPlayerScore(killerid)-1);			SendClientMessage(killerid,red,"You have killed a teammate - point lost.");		}		else		{			SetPlayerScore(killerid,GetPlayerScore(killerid)+1);		}	}	else	{		SetPlayerScore(playerid,GetPlayerScore(playerid)-1);		SendClientMessage(playerid,white,"You have died - point lost.");	}	SendDeathMessage(killerid,playerid,reason);	if(playerid==defuserid)	{		defuserid=-1;		defusetick=-1;		SendClientMessage(playerid,red,"Defusing cancelled!");	}	if(playerid==carrierid)	{		GameTextForAll("~w~The ~g~bomb carrier ~w~has died!~n~~b~Counter-Terrorists win!",5000,3);		GameModeExit();	}	return 1;}public OnVehicleSpawn(vehicleid){	return 1;}public OnVehicleDeath(vehicleid, killerid){	return 1;}public OnPlayerText(playerid, text[]){	if(text[0]=='#')	{	    if(strlen(chat[playerid])==0)	    {	        SendClientMessage(playerid,red,"You are not in a chatroom! Use /cjoin ROOM to join one.");		}		else		{		    new name[256];			new message[256];		    new output[256];		    GetPlayerName(playerid,name,sizeof(name));	        strmid(message,text,1,strlen(text));		    format(output,sizeof(output),"<CHAT> %s: %s",name,message);		    for(new n=0;n<GetMaxPlayers();n++)		    {		        if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chat[playerid],true)==0)		        {					SendClientMessage(n,gold,output);		        }		    }		}		return 0;	}	else if(text[0]=='@')	{	    if(query[playerid]!=-1)	    {		    new name[256];		    new message[256];		    new output[256];		    GetPlayerName(playerid,name,sizeof(name));	        strmid(message,text,1,strlen(text));		    format(output,sizeof(output),"<%s> %s",name,message);		    SendClientMessage(query[playerid],gold,output);		    SendClientMessage(playerid,gold,output);		}		else		{			SendClientMessage(playerid,red,"You are not querying anybody! Use /query ID to establish a query.");		}		return 0;	}	else if(text[0]=='!')	{	    if(muted[playerid]==1)		{	    	SendClientMessage(playerid,red,"You are muted!");		}		else if(GetPlayerColor(playerid)==grey)		{		    SendClientMessage(playerid,red,"You haven't selected a team yet!");		}		else		{		    new name[256];		    new message[256];		    new output[256];			GetPlayerName(playerid,name,sizeof(name));			strmid(message,text,1,strlen(text));			format(output,sizeof(output),"<TEAM> %s: %s",name,message);			for(new n=0;n<GetMaxPlayers();n++)			{			    if(IsPlayerConnected(n) && gTeam[n]==gTeam[playerid] && GetPlayerColor(n)!=grey)			    {					SendClientMessage(n,GetPlayerColor(playerid),output);			    }			}		}		return 0;	}	else if(text[0]=='%')	{	    new name[256];		new message[256];	    new output[256];	    GetPlayerName(playerid,name,sizeof(name));        strmid(message,text,1,strlen(text));	    format(output,sizeof(output),"<ADMIN> %s: %s",name,message);	    for(new n=0;n<GetMaxPlayers();n++)		{		    if(IsPlayerConnected(n) && isadmin[n]==1)		    {				SendClientMessage(n,servermsg,output);			}		}		return 0;	}	return 1;}public OnPlayerCommandText(playerid, cmdtext[]){	new cmd[256];	new cmd_s=strfind(cmdtext," ",false,0);	if(cmd_s!=-1)	{		strmid(cmd,cmdtext,0,cmd_s);	}	else	{	    strmid(cmd,cmdtext,0,strlen(cmdtext));	}	if(strcmp(cmdtext,"/commands",true)==0)	{		SendClientMessage(playerid,white,"/help || /credits || /target || /cjoin <ROOM> || /cleave || /clist || /ckick <ID>");		SendClientMessage(playerid,white,"/cinvite <ID> || /cyes || /cno || /me <ACTIVITY> || /voteban <ID> [REASON] || /admins");		SendClientMessage(playerid,white,"/!<MESSAGE> - teamchat || @<MESSAGE> - private message || #<MESSAGE> - chatroom message");		SendClientMessage(playerid,white,"%<MESSAGE> - adminchat");		return 1;	}	else if(strcmp(cmdtext,"/help",true)==0)	{	    new output[256];		SendClientMessage(playerid,white,"The counter-terrorists have to prevent the terrorists from planting the bomb by the bomb carrier at the bomb site.");		SendClientMessage(playerid,white,"If the bomb is already planted the CTs need to defuse it in order to win.");		format(output,sizeof(output),"The bomb is ticking for %d seconds, it's defusal takes %d seconds and it takes %d seconds to plant it.",bombticktime,defuseticktime,plantticktime);		SendClientMessage(playerid,white,output);		SendClientMessage(playerid,white,"If the bomb carrier dies, the bomb explodes or is defused - the game is over.");		SendClientMessage(playerid,white,"Map legend:");		SendClientMessage(playerid,blue,"Counter-Terrorists");		SendClientMessage(playerid,yellow,"Terrorists");		SendClientMessage(playerid,green,"Bomb Carrier (Terrorist)");		SendClientMessage(playerid,red,"Bomb Site");		SendClientMessage(playerid,white,"Type /commands for a list of server's commands.");		return 1;	}	else if(strcmp(cmdtext,"/credits",true)==0)	{		SendClientMessage(playerid,white,"Scripting: sniper89 (sniper89@tlen.pl)");		SendClientMessage(playerid,white,"Bombsite ideas: PuppyLuv (puppyluv@inbox.com)");		SendClientMessage(playerid,white,"Vehicle spawns around LS: storm87 (storm87@tlen.pl) - taken from my King of the Hill gamemode ;)");		return 1;	}	else if(strcmp(cmd,"/query",true)==0)	{	    new p[256];	    new id;	    strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));	    id=idmatch(playerid,p);		if(id!=-1)	    {	        if(id==playerid)	        {	            SendClientMessage(playerid,red,"You can't query yourself!");	        }	        else	        {		        new name[256];		        new output[256];		        query[playerid]=id;		        GetPlayerName(id,name,sizeof(name));		        format(output,sizeof(output),"Conversation with %s started. Type @message to send a private message.",name);	            SendClientMessage(playerid,gold,output);			}	    }	    return 1;	}	else if(strcmp(cmdtext,"/unquery",true)==0)	{	    if(query[playerid]==-1)	    {	        SendClientMessage(playerid,red,"You are not querying anybody! Use /query ID to establish a query.");	    }	    else	    {		    new name[256];		    new output[256];		    GetPlayerName(query[playerid],name,sizeof(name));		    query[playerid]=-1;		    format(output,sizeof(output),"You are no longer querying %s.",name); 	    	SendClientMessage(playerid,servermsg,output);    	}	    return 1;	}	else if(strcmp(cmd,"/cjoin",true)==0)	{	    new room[256];	    strmid(room,cmdtext,strlen(cmd)+1,strlen(cmdtext));	    if(strlen(room)==0)	    {	        SendClientMessage(playerid,red,"Enter the name of the chatroom you want to enter!");	    }	    else	    {	        new output[256];	        new name[256];	        new total=0;	        GetPlayerName(playerid,name,sizeof(name));			if(strlen(chat[playerid])!=0 && strcmp(chat[playerid],room,true)==0)			{				SendClientMessage(playerid,gold,"You are already in that chatroom!");			}			else			{		        if(strlen(chat[playerid])!=0)		        {		            if(ischatop[playerid]==1)		            {		                ischatop[playerid]=0;		            }		            format(output,sizeof(output),"You have just left #%s.",chat[playerid]);		            SendClientMessage(playerid,gold,output);		            for(new n=0;n<GetMaxPlayers();n++)			        {						if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chat[playerid],true)==0 && n!=playerid)						{							format(output,sizeof(output),"%s has just left #%s.",name,chat[n]);							SendClientMessage(n,gold,output);						}			        }		        }		        format(output,sizeof(output),"You have just entered #%s.",room);		        SendClientMessage(playerid,gold,output);		        for(new n=0;n<GetMaxPlayers();n++)		        {					if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],room,true)==0)					{						format(output,sizeof(output),"%s has just entered #%s.",name,chat[n]);						SendClientMessage(n,gold,output);					}		        }		        for(new n=0;n<GetMaxPlayers();n++)			    {			        if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(room,chat[n],true)==0)			        {				       	total++;					}				}				if(total==0)				{				    ischatop[playerid]=1;				}				chat[playerid]=room;		        total=0;			    format(output,sizeof(output),"People currently in #%s:",chat[playerid]);			    for(new n=0;n<GetMaxPlayers();n++)			    {			        if(IsPlayerConnected(n))			        {				        if(strlen(chat[n])!=0 && strcmp(chat[playerid],chat[n],true)==0)				        {				            GetPlayerName(n,name,sizeof(name));							if(ischatop[n]==1)							{							    format(name,sizeof(name),"@%s",name);							}				            if(total==0)				            {								format(output,sizeof(output),"%s %s",output,name);				            }				            else				            {								format(output,sizeof(output),"%s, %s",output,name);				            }				            total++;				        }					}			    }				format(output,sizeof(output),"%s (total: %d)",output,total);			    SendClientMessage(playerid,gold,output);			}	    }		return 1;	}	else if(strcmp(cmdtext,"/cleave",true)==0)	{	    if(strlen(chat[playerid])==0)	    {	        SendClientMessage(playerid,red,"You are not in a chatroom!");	    }	    else	    {			new output[256];			new name[256];			if(ischatop[playerid]==1)			{				ischatop[playerid]=0;			}			format(output,sizeof(output),"You have just left #%s.",chat[playerid]);	        SendClientMessage(playerid,gold,output);	        GetPlayerName(playerid,name,sizeof(name));			format(output,sizeof(output),"%s has just left #%s.",name,chat[playerid]);	        for(new n=0;n<GetMaxPlayers();n++)	        {				if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chat[playerid],true)==0 && n!=playerid)				{				        SendClientMessage(n,gold,output);				}	        }	        chat[playerid]="";	    }		return 1;	}	else if(strcmp(cmdtext,"/clist",true)==0)	{	    if(strlen(chat[playerid])==0)	    {	        SendClientMessage(playerid,red,"You are not in a chatroom!");	    }	    else	    {		    new output[256];		    new total=0;		    format(output,sizeof(output),"People currently in #%s:",chat[playerid]);		    for(new n=0;n<GetMaxPlayers();n++)		    {		        if(IsPlayerConnected(n))		        {			        if(strlen(chat[n])!=0 && strcmp(chat[playerid],chat[n],true)==0)			        {			            new name[256];			            GetPlayerName(n,name,sizeof(name));						if(ischatop[n]==1)						{						    format(name,sizeof(name),"@%s",name);						}			            if(total==0)			            {							format(output,sizeof(output),"%s %s",output,name);			            }			            else			            {							format(output,sizeof(output),"%s, %s",output,name);			            }			            total++;			        }				}		    }			format(output,sizeof(output),"%s (total: %d)",output,total);		    SendClientMessage(playerid,gold,output);		}		return 1;	}	else if(strcmp(cmd,"/ckick",true)==0)	{	    if(strlen(chat[playerid])==0)	    {	        SendClientMessage(playerid,red,"You are not in a chatroom!");	    }	    else	    {	        if(ischatop[playerid]==0)	        {	            SendClientMessage(playerid,red,"You are not the chatroom operator!");	        }	        else	        {	            new p[256];	            new id;	            strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));	            id=idmatch(playerid,p);	            if(id!=-1)	            {	                new name[256];	                new output[256];	                GetPlayerName(id,name,sizeof(name));	                if(strcmp(chat[playerid],chat[id],true)==0)	                {						format(output,sizeof(output),"You have just been kicked from #%s by the chatroom operator.",chat[id]);				        SendClientMessage(id,gold,output);				        chat[id]="";				        for(new n=0;n<GetMaxPlayers();n++)				        {							if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chat[playerid],true)==0)							{							    format(output,sizeof(output),"%s has just been kicked from #%s by the chatroom operator.",name,chat[n]);								SendClientMessage(n,gold,output);							}				        }	                }	                else	                {	                    format(output,sizeof(output),"%s is not in #%s at the moment!",name,chat[playerid]);	                    SendClientMessage(playerid,gold,output);	                }	     		}    		}	    }		return 1;	}	else if(strcmp(cmd,"/cinvite",true)==0)	{	    if(strlen(chat[playerid])==0)	    {	        SendClientMessage(playerid,red,"You are not in a chatroom!");	    }	    else	    {	        if(ischatop[playerid]==0)	        {	            SendClientMessage(playerid,red,"You are not the chatroom operator!");	        }	        else	        {	            new p[256];	            new id;	            strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));	            id=idmatch(playerid,p);	            if(id!=-1)	            {	                if(id==playerid)	                {	                    SendClientMessage(playerid,red,"You can't invite yourself!");	                }	                else if(strlen(chat[id])!=0 && strcmp(chat[id],chat[playerid],true)==0)	                {	                    new name[256];	                    new output[256];	                    GetPlayerName(id,name,sizeof(name));	                    format(output,sizeof(output),"%s is already in your chatroom!",name);	                    SendClientMessage(playerid,gold,output);	                }	                else	                {		                new name[256];		                new output[256];		                GetPlayerName(id,name,sizeof(name));		                if(strlen(chatinv[id])!=0 && strcmp(chatinv[id],chat[playerid],true)==0)		                {		                    format(output,sizeof(output),"You have already invited %s to join your chatroom! Wait for the player's decision.",name);		                    SendClientMessage(playerid,gold,output);		                }		                else if(strlen(chatinv[id])!=0)		                {		                    format(output,sizeof(output),"%s has already been invited to a chatroom, try again later.",name);		                    SendClientMessage(playerid,gold,output);		                }		                else		                {							format(output,sizeof(output),"You have just invited %s to join #%s.",name,chat[playerid]);							SendClientMessage(playerid,gold,output);							chatinv[id]=chat[playerid];							GetPlayerName(playerid,name,sizeof(name));							format(output,sizeof(output),"You have just been invited by %s to join #%s.",name,chat[playerid]);							SendClientMessage(id,gold,output);							SendClientMessage(id,gold,"Type /cyes to accept or /cno to reject.");						}					}	     		}    		}	    }		return 1;	}	else if(strcmp(cmdtext,"/cyes",true)==0)	{	    if(strlen(chatinv[playerid])==0)	    {	        SendClientMessage(playerid,gold,"You have no chatroom invitations at the moment!");	    }	    else	    {			new output[256];	        new name[256];	        new total=0;	        GetPlayerName(playerid,name,sizeof(name));	        if(strlen(chat[playerid])!=0)	        {	            if(ischatop[playerid]==1)	            {	                ischatop[playerid]=0;	            }	            format(output,sizeof(output),"You have just left #%s.",chat[playerid]);	            SendClientMessage(playerid,gold,output);	            for(new n=0;n<GetMaxPlayers();n++)		        {					if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chat[playerid],true)==0 && n!=playerid)					{						format(output,sizeof(output),"%s has just left #%s.",name,chat[n]);						SendClientMessage(n,gold,output);					}		        }	        }	        format(output,sizeof(output),"You have just entered #%s.",chatinv[playerid]);	        SendClientMessage(playerid,gold,output);	        for(new n=0;n<GetMaxPlayers();n++)	        {				if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chat[n],chatinv[playerid],true)==0)				{					format(output,sizeof(output),"%s has just entered #%s.",name,chat[n]);					SendClientMessage(n,gold,output);				}	        }	        for(new n=0;n<GetMaxPlayers();n++)		    {		        if(IsPlayerConnected(n) && strlen(chat[n])!=0 && strcmp(chatinv[playerid],chat[n],true)==0)		        {			       	total++;				}			}			if(total==0)			{			    ischatop[playerid]=1;			}			chat[playerid]=chatinv[playerid];	        total=0;	        format(output,sizeof(output),"People currently in #%s:",chat[playerid]);		    for(new n=0;n<GetMaxPlayers();n++)		    {		        if(IsPlayerConnected(n))		        {			        if(strlen(chat[n])!=0 && strcmp(chat[playerid],chat[n],true)==0)			        {			            GetPlayerName(n,name,sizeof(name));						if(ischatop[n]==1)						{						    format(name,sizeof(name),"@%s",name);						}			            if(total==0)			            {							format(output,sizeof(output),"%s %s",output,name);			            }			            else			            {							format(output,sizeof(output),"%s, %s",output,name);			            }			            total++;			        }				}		    }			format(output,sizeof(output),"%s (total: %d)",output,total);		    SendClientMessage(playerid,gold,output);		    if(total==0)		    {		        ischatop[playerid]=1;		    }		    chatinv[playerid]="";	    }		return 1;	}	else if(strcmp(cmdtext,"/cno",true)==0)	{	    if(strlen(chatinv[playerid])==0)	    {	        SendClientMessage(playerid,gold,"You have no chatroom invitations at the moment!");	    }	    else	    {	        chatinv[playerid]="";	        SendClientMessage(playerid,gold,"Chatroom invitation rejected.");	    }		return 1;	}	else if(strcmp(cmd,"/me",true)==0)	{	    if(muted[playerid]==1)	    {	        SendClientMessage(playerid,red,"You are muted!");	    }	    new name[256];	    new message[256];	    new output[256];	    GetPlayerName(playerid,name,sizeof(name));	    strmid(message,cmdtext,4,strlen(cmdtext));	    if(strlen(message)!=0)	    {		    format(output,sizeof(output),"* %s %s *",name,message);			SendClientMessageToAll(GetPlayerColor(playerid),output);	    }	    else	    {	        SendClientMessage(playerid,red,"Invalid syntax, please use: /me ACTIVITY, eg. /me fries a banana pancake");	    }	    return 1;	}	else if(strcmp(cmd,"/voteban",true)==0)	{		if(votingtick>0)		{			SendClientMessage(playerid,red,"Sorry, but there's already a voting in progress!");		}		else		{			new s=strfind(cmdtext," ",false,strlen(cmd)+1);			new p[256];		    new id;			new reason[256];			if(s==-1)			{			    s=strlen(cmdtext);			}			strmid(p,cmdtext,9,s);			id=idmatch(playerid,p);			if(s==-1)			{				reason="no reason given";			}			else			{			    strmid(reason,cmdtext,s+1,strlen(cmdtext));			}			if(id!=-1)			{			    new cname[256];				new name[256];			    new output[256];			    GetPlayerName(playerid,cname,sizeof(cname));			    GetPlayerName(id,name,sizeof(name));			    polltype=1;			    polldata[0][0]=id;			    polldata[1]=reason;			    polldata[3]=cname;			    for(new n=0;n<GetMaxPlayers();n++)			    {			        votes[n]=0;			    }				votingtick=votingticktimeinitial;				votes[playerid]=1;				SendClientMessageToAll(servermsg,"A new voting has just started!");				format(output,sizeof(output),"Somebody has initiated a voting to ban %s.",name);				SendClientMessageToAll(servermsg,output);				format(output,sizeof(output),"Reason: %s",reason);				SendClientMessageToAll(servermsg,output);				SendClientMessageToAll(servermsg,"Type /vote if you agree.");			}		}		return 1;	}	else if(strcmp(cmd,"/vote",true)==0)	{		if(votingtick>0)		{		    votingtick=votingticktime;		    if(polltype==0)		    {				new to[256];				new o;				strmid(to,cmdtext,6,strlen(cmdtext));				o=strval(to);				if(strlen(to)==0 || (o==0 && strcmp(to,"0",false)!=0) || (o!=1 && o!=2))				{				    SendClientMessage(playerid,red,"Invalid syntax, please use: /vote 1 or /vote 2");				}				else				{				    votes[playerid]=o;					SendClientMessage(playerid,servermsg,"Vote taken.");				}			}			else if(polltype==1)			{				if(strlen(cmdtext)!=strlen(cmd))				{				    SendClientMessage(playerid,red,"Invalid syntax, please use: /vote");				}				else				{				    votes[playerid]=1;					SendClientMessage(playerid,servermsg,"Vote taken.");				}			}		}		else		{			SendClientMessage(playerid,red,"Sorry, there's currently no voting in progress.");		}		return 1;	}	else if(strcmp(cmdtext,"/target",true)==0)	{	    new output[256];	    if(carrierid==-1)		{		    format(output,sizeof(output),"The terrorists have planted the bomb at the %s!",bombsiteinfo[bombsite]);		}		else		{	    	format(output,sizeof(output),"The terrorists are about to plant the bomb at the %s!",bombsiteinfo[bombsite]);		}		SendClientMessage(playerid,yellow,output);		return 1;	}	else if(strcmp(cmdtext,"/admins",true)==0)	{	    new output[256];	    new total=0;	    output="Admins online:";	    for(new n=0;n<GetMaxPlayers();n++)	    {	        if(IsPlayerConnected(n))	        {		        if(isadmin[n]==1)		        {		            new name[256];		            GetPlayerName(n,name,sizeof(name));		            if(total==0)		            {						format(output,sizeof(output),"%s %s",output,name);		            }		            else		            {						format(output,sizeof(output),"%s, %s",output,name);		            }		            total++;		        }			}	    }	    if(total==0)	    {	        format(output,sizeof(output),"%s none",output);	    }	    else	    {	        format(output,sizeof(output),"%s (total: %d)",output,total);	    }	    SendClientMessage(playerid,servermsg,output);		return 1;	}	else if(strcmp(cmd,"/login",true)==0)	{		if(isadmin[playerid]==0)		{			new user[256];			new pass[256];			new s=strfind(cmdtext," ",false,7);			strmid(user,cmdtext,7,s);			strmid(pass,cmdtext,s+1,strlen(cmdtext));			if(strlen(user)!=0 && strlen(pass)!=0)			{			    new accfile[256];			    format(accfile,sizeof(accfile),"adminaccs/%s.txt",user);			    if(invchar(user)==0 && invchar(pass)==0 && fexist(accfile))			    {			        new File:file=fopen(accfile,io_read);			        new correctpass[256];			        fread(file,correctpass);					fclose(file);					if(strcmp(pass,correctpass,false)==0)					{					    new name[256];					    new output[256];					    isadmin[playerid]=1;					    GetPlayerName(playerid,name,sizeof(name));					    format(output,sizeof(output),"%s has just logged in as an admin.",name);					    SendClientMessageToAll(servermsg,output);					}					else					{					    SendClientMessage(playerid,red,"Wrong account information supplied!");					}				}			    else			    {			        SendClientMessage(playerid,red,"Wrong account information supplied!");			    }			}			else			{			    SendClientMessage(playerid,red,"Input your username AND password!");			}		}		else		{		    SendClientMessage(playerid,servermsg,"You are already logged in as an admin!");		}		return 1;	}	else if(strcmp(cmdtext,"/admincmds",true)==0)	{		if(isadmin[playerid]==1)		{			SendClientMessage(playerid,white,"/warpto ID || /warptome ID || /kick ID || /ban ID || /disarm ID || /mute ID");			SendClientMessage(playerid,white,"/unmute ID || /eject ID || /poll question;answer 1;answer 2 || /endvote || /whovote");			SendClientMessage(playerid,white,"/restart || /fullheal ID || /warp ID X Y Z || /givechute ID");		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/warpto",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new Float:coords[3];				GetPlayerPos(id,coords[0],coords[1],coords[2]);				SetPlayerPos(playerid,coords[0],coords[1],coords[2]+3);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/warptome",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new Float:coords[3];				GetPlayerPos(playerid,coords[0],coords[1],coords[2]);				SetPlayerPos(id,coords[0],coords[1],coords[2]+3);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/kick",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new name[256];			    new output[256];			    Kick(id);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"Kicked %s successfully.",name);			    SendClientMessage(playerid,servermsg,output);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/ban",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new name[256];			    new output[256];			    Ban(id);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"Banned %s successfully.",name);			    SendClientMessage(playerid,servermsg,output);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/disarm",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new name[256];			    new output[256];			    ResetPlayerWeapons(id);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"Disarmed %s successfully.",name);			    SendClientMessage(playerid,servermsg,output);			    SendClientMessage(id,servermsg,"You have got disarmed by an admin.");			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/mute",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				if(muted[id]==1)			    {			        SendClientMessage(playerid,servermsg,"This player is already muted!");			    }			    else			    {				    new name[256];				    new output[256];				    muted[id]=1;				    GetPlayerName(id,name,sizeof(name));				    format(output,sizeof(output),"Muted %s successfully.",name);				    SendClientMessage(playerid,servermsg,output);				    SendClientMessage(id,servermsg,"You have got muted by an admin.");			    }			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/unmute",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				if(muted[id]==0)			    {			        SendClientMessage(playerid,servermsg,"This player is already unmuted!");			    }			    else			    {				    new name[256];				    new output[256];				    muted[id]=0;				    GetPlayerName(id,name,sizeof(name));				    format(output,sizeof(output),"Unmuted %s successfully.",name);				    SendClientMessage(playerid,servermsg,output);				    SendClientMessage(id,servermsg,"You have got unmuted by an admin.");			    }			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/eject",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{				new name[256];			    new output[256];			    GetPlayerName(id,name,sizeof(name));				if(IsPlayerInAnyVehicle(id))			    {				    new Float:coords[3];					GetPlayerPos(id,coords[0],coords[1],coords[2]);					SetPlayerPos(id,coords[0],coords[1],coords[2]+3);				    format(output,sizeof(output),"Ejected %s successfully.",name);				    SendClientMessage(playerid,servermsg,output);				    SendClientMessage(id,servermsg,"You have got ejected by an admin.");	    		}	    		else	    		{	    		    format(output,sizeof(output),"%s is not in a vehicle!",name);	    		    SendClientMessage(playerid,servermsg,output);	    		}			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}		return 1;	}	else if(strcmp(cmd,"/poll",true)==0)	{	    if(isadmin[playerid]==1)	    {	        if(votingtick>0)	        {	            SendClientMessage(playerid,red,"Sorry, but there's already a voting in progress!");	        }	        else	        {		    	new s1;				new s2;		        new q[256];				new a1[256];				new a2[256];				s1=strfind(cmdtext,";",false,6);				s2=strfind(cmdtext,";",false,s1+1);				strmid(q,cmdtext,6,s1);				strmid(a1,cmdtext,s1+1,s2);				strmid(a2,cmdtext,s2+1,strlen(cmdtext));				if(strlen(q)==0 || strlen(a1)==0 || strlen(a2)==0)				{					SendClientMessage(playerid,red,"Invalid syntax, please use: /poll question;answer 1;answer 2");				}				else				{				    new output[256];				    polltype=0;				    polldata[0]=q;				    polldata[1]=a1;				    polldata[2]=a2;				    for(new n=0;n<GetMaxPlayers();n++)				    {				        votes[n]=0;				    }					votingtick=votingticktimeinitial;					SendClientMessageToAll(servermsg,"A new voting has just started!");					format(output,sizeof(output),"Question: %s",q);					SendClientMessageToAll(servermsg,output);					format(output,sizeof(output),"Option #1: %s",a1);					SendClientMessageToAll(servermsg,output);					format(output,sizeof(output),"Option #2: %s",a2);					SendClientMessageToAll(servermsg,output);					SendClientMessageToAll(servermsg,"Use /vote 1 or /vote 2 to vote.");				}			}	    }		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmdtext,"/endvote",true)==0)	{	    if(isadmin[playerid]==1)	    {	        if(votingtick<0)	        {				SendClientMessage(playerid,red,"Sorry, there's currently no voting in progress.");	        }	        else	        {				votingtick=-1;				SendClientMessageToAll(servermsg,"Poll closed by an admin.");			}	    }		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmdtext,"/whovote",true)==0)	{	    if(isadmin[playerid]==1)	    {	        if(strlen(polldata[3])!=0)	        {				new output[256];				format(output,sizeof(output),"The last banvoting was called by %s.",polldata[3]);				SendClientMessage(playerid,servermsg,output);			}			else			{				SendClientMessage(playerid,servermsg,"There were no votings called this round yet.");			}	    }		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmdtext,"/restart",true)==0)	{	    if(isadmin[playerid]==1)	    {	        GameModeExit();	    }		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmd,"/fullheal",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{			    new name[256];			    new output[256];			    SetPlayerHealth(id,100);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"%s's health was successfully restored.",name);			    SendClientMessage(playerid,servermsg,output);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmd,"/givechute",true)==0)	{		if(isadmin[playerid]==1)		{			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,strlen(cmdtext));			id=idmatch(playerid,p);			if(id!=-1)			{			    new name[256];			    new output[256];			    GivePlayerWeapon(id,46,-1);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"%s has been given a parachute successfully.",name);			    SendClientMessage(playerid,servermsg,output);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	else if(strcmp(cmd,"/warp",true)==0)	{		if(isadmin[playerid]==1)		{		    new s1=strfind(cmdtext," ",false,strlen(cmd)+1);			new p[256];		    new id;			strmid(p,cmdtext,strlen(cmd)+1,s1);			id=idmatch(playerid,p);			if(id!=-1)			{			    new s2=strfind(cmdtext," ",false,s1+1);		    	new s3=strfind(cmdtext," ",false,s2+1);			    new Float:coords[3];			    new tnewcoords[3][256];			    new newcoords[3];			    new name[256];			    new output[256];			    strmid(tnewcoords[0],cmdtext,s1+1,s2);			    strmid(tnewcoords[1],cmdtext,s2+1,s3);			    strmid(tnewcoords[2],cmdtext,s3+1,strlen(cmdtext));			    newcoords[0]=strval(tnewcoords[0]);			    newcoords[1]=strval(tnewcoords[1]);			    newcoords[2]=strval(tnewcoords[2]);			    GetPlayerPos(id,coords[0],coords[1],coords[2]);			    SetPlayerPos(id,coords[0]+newcoords[0],coords[1]+newcoords[1],coords[2]+newcoords[2]);			    GetPlayerName(id,name,sizeof(name));			    format(output,sizeof(output),"%s was successfully warped to X: %f Y: %f Z: %f.",name,coords[0]+newcoords[0],coords[1]+newcoords[1],coords[2]+newcoords[2]);			    SendClientMessage(playerid,servermsg,output);			}		}		else		{			SendClientMessage(playerid,red,"Only admins can use this command!");		}	    return 1;	}	return 0;}public OnPlayerInfoChange(playerid){	return 1;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){    if(IsPlayerInCheckpoint(playerid))    {	    if(bombtick>0 && gTeam[playerid]==teamct && playerid==defuserid)		{			defuserid=-1;			defusetick=-1;			SendClientMessage(playerid,red,"Defusing cancelled!");		}		else if(gTeam[playerid]==teamt && playerid==carrierid)		{			planttick=-1;			SendClientMessage(playerid,red,"Planting cancelled!");		}	}	return 1;}public OnPlayerExitVehicle(playerid, vehicleid){	if(IsPlayerInCheckpoint(playerid))	{		if(bombtick>0 && gTeam[playerid]==teamct)		{			if(defuserid==-1)			{				defuserid=playerid;				defusetick=defuseticktime;				SendClientMessage(playerid,green,"Defusing the bomb...");			}			else			{				SendClientMessage(playerid,red,"Somebody is already defusing!");			}		}		else if(gTeam[playerid]==teamt && playerid==carrierid)		{			planttick=plantticktime;			SendClientMessage(playerid,green,"Planting the bomb...");		}	}	return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){	return 1;}public OnPlayerEnterCheckpoint(playerid){	if(bombtick>0 && gTeam[playerid]==teamct)	{		if(defuserid==-1)		{			if(!IsPlayerInAnyVehicle(playerid))			{				defuserid=playerid;				defusetick=defuseticktime;				SendClientMessage(playerid,green,"Defusing the bomb...");			}			else			{				SendClientMessage(playerid,red,"Get out of the vehicle in order to start defusing!");			}		}		else		{			SendClientMessage(playerid,red,"Somebody is already defusing!");		}	}	else if(gTeam[playerid]==teamt && playerid==carrierid)	{		if(!IsPlayerInAnyVehicle(playerid))		{			planttick=plantticktime;			SendClientMessage(playerid,green,"Planting the bomb...");		}		else		{			SendClientMessage(playerid,red,"Get out of the vehicle in order to plant the bomb!");		}	}	return 1;}public OnPlayerLeaveCheckpoint(playerid){	if(!IsPlayerInAnyVehicle(playerid))	{		if(playerid==carrierid)		{			planttick=-1;			SendClientMessage(playerid,red,"Planting cancelled!");		}		else if(playerid==defuserid)		{			defuserid=-1;			defusetick=-1;			SendClientMessage(playerid,red,"Defusing cancelled!");		}	}	return 1;}public planttimer(){	if(planttick!=-1)	{	    if(planttick==0)	   	{	   	    SetPlayerColor(carrierid,yellow);			carrierid=-1;			bombtick=bombticktime;			GameTextForAll("Bomb has been planted!",5000,1);		}		else if(planttick%5==0)		{			new output[256];			format(output,sizeof(output),"%d seconds until the bomb is planted...",planttick);			SendClientMessage(carrierid,green,output);		}		planttick--;	}	return 1;}public bombtimer(){	if(bombtick!=-1)	{		if(bombtick==0)		{			GameTextForAll("~y~Terrorists win!",5000,3);			GameModeExit();		}		else		{			new output[256];			valstr(output,bombtick,false);			if(defuserid!=-1)			{			    format(output,sizeof(output),"(def.: %d) %s",defusetick,output);			}			GameTextForAll(output,3000,1);		}		bombtick--;	}	return 1;}public defusetimer(){    if(defusetick!=-1)	{	    if(defusetick==0)	    {	        GameTextForAll("~b~Counter-Terrorists win!",5000,3);			GameModeExit();        }		defusetick--;	}	return 1;}public votingtimer(){    if(votingtick!=-1)	{		if(votingtick==0)		{			new cpn=0;			new output[256];		    if(polltype==0)		    {		        new a1=0;		        new a2=0;			    for(new n=0;n<GetMaxPlayers();n++)			    {			        if(IsPlayerConnected(n))			        {			            cpn++;			        }			    }			    for(new n=0;n<GetMaxPlayers();n++)			    {			        if(votes[n]==1)			        {			            a1++;			        }			        else if(votes[n]==2)			        {			            a2++;			        }			    }			    SendClientMessageToAll(servermsg,"The voting has just ended!");			    SendClientMessageToAll(servermsg,"Voting results:");			    format(output,sizeof(output),"Question: %s",polldata[0]);			    SendClientMessageToAll(servermsg,output);			    format(output,sizeof(output),"%d players have voted for: %s",a1,polldata[1]);			    SendClientMessageToAll(servermsg,output);			    format(output,sizeof(output),"%d players have voted for: %s",a2,polldata[2]);			    SendClientMessageToAll(servermsg,output);			    if(a1>a2)				{					format(output,sizeof(output),"Option #1 is the winner!");				}				else if(a1<a2)				{	                format(output,sizeof(output),"Option #2 is the winner!");				}				else				{				    format(output,sizeof(output),"It's a draw!");				}				SendClientMessageToAll(servermsg,output);			}			if(polltype==1)		    {		        new a=0;		        new name[256];			    for(new n=0;n<GetMaxPlayers();n++)			    {			        if(IsPlayerConnected(n))			        {			            cpn++;			        }			    }			    for(new n=0;n<GetMaxPlayers();n++)			    {			        if(votes[n]==1)			        {			            a++;			        }			    }			    GetPlayerName(polldata[0][0],name,sizeof(name));			    format(output,sizeof(output),"The voting to ban %s has just ended!",name);			    SendClientMessageToAll(servermsg,output);			    format(output,sizeof(output),"Reason: %s",polldata[1]);			    SendClientMessageToAll(servermsg,output);			    SendClientMessageToAll(servermsg,"Voting results:");			    format(output,sizeof(output),"%d players voted for,",a);			    SendClientMessageToAll(servermsg,output);			    format(output,sizeof(output),"%d against.",cpn-a);			    SendClientMessageToAll(servermsg,output);			    if(a>cpn-a)				{					format(output,sizeof(output),"%s was banned from the server!",name);					Ban(polldata[0][0]);				}				else				{	                format(output,sizeof(output),"%s wasn't banned!",name);				}				SendClientMessageToAll(servermsg,output);			}		}		votingtick--;	}}public synctime(){	new hour;	gettime(hour);	SetWorldTime(hour);}public isnum(string[]){	// the idea on how to do such a check was taken from Spark's "Protect the Prime Minister" - making the script perform a strcmp for every cell of the array would waste the precious CPU, so this is ideal ;)	if(strlen(string)==0)	{	    return 0;	}	for(new n=0;n<strlen(string);n++)	{	    if(string[n]<'0' || string[n]>'9')	    {	        return 0;	    }	}	return 1;}public invchar(string[]){	if(strfind(string,"/",false)!=-1 || strfind(string,"\\",false)!=-1 || strfind(string,".",false)!=-1)	{	    return 1;	}	return 0;}public idmatch(playerid,string[]){    new id=-1;	if(strlen(string)==0)	{	    SendClientMessage(playerid,servermsg,"Input an ID/name!");	    return -1;	}	else	{		new matches=0;		if(isnum(string)==1)		{			new nid=strval(string);			if(IsPlayerConnected(nid))			{				return nid;			}		}		for(new n=0;n<GetMaxPlayers();n++)		{			if(IsPlayerConnected(n))			{				new name[256];				GetPlayerName(n,name,sizeof(name));				if(strcmp(string,name,true)==0)				{					return n;				}				else if(strfind(name,string,true)!=-1)				{				    id=n;					matches++;				}			}		}		if(matches>1)		{		    new output[256];		    format(output,sizeof(output),"There were %d matches found for \"%s\" - aborting.",matches,string);		    SendClientMessage(playerid,servermsg,output);		    return -1;		}		else if(matches==0)		{			new output[256];			format(output,sizeof(output),"There were no matches found for \"%s\" - aborting.",string);			SendClientMessage(playerid,servermsg,output);			return -1;		}	}	return id;}