All pastes #813855 Raw Edit

Something

public text v1 · immutable
·published 2007-12-12 21:12 UTC
rendered paste body
#include <a_samp>
#include <core>
#include <float>

#pragma tabsize 0

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA

#define FILTERSCRIPT
#define CP_BANK 		0
#define CP_PIRATE 		1
#define CP_SKYSCARPER 	2
#define CP_ZOMBOTECH 	3
#define CP_AMMU     	4
#define CP_AMMU_2     	5
#define CP_BANK_2 		6
#define CP_BANK_3 		7
#define CP_LS_AIR 		8
#define CP_SF_AIR 		9
#define CP_LV_AIR 		10
#define CP_ALAHAM   	11
#define CP_DIDERSACHS   12
#define CP_BAR      	13
#define CP_HAIRSTUD 	14
#define CP_ZIP      	15
#define CP_BINCO    	16
#define CP_TATOO    	17
#define CP_GOLF 		18
#define CP_WANG 		19
#define CP_HOTEL 		20
#define CP_OTTOS 		21
#define CP_DRAGON       22
#define CP_CALIGULA     23
#define CP_SEXSHOP      24
#define CP_CATHAY     	25
#define CP_VERONA     	26
#define CP_ZERORC     	27
#define CP_JIZZYS     	28
#define CP_PIRAMID     	29
#define P_ALAHAM    	0
#define P_DIDERSACHS  	1
#define P_BAR       	2
#define P_HAIRSTUD  	3
#define P_ZIP       	4
#define P_BINCO     	5
#define P_TATOO     	6
#define P_GOLF 			7
#define P_WANG 			8
#define P_HOTEL 		9
#define P_OTTOS 		10
#define P_DRAGON      	11
#define P_CALIGULA   	12
#define P_SEXSHOP    	13
#define P_CATHAY      	14
#define P_VERONA      	15
#define P_ZERORC     	16
#define P_JIZZYS      	17
#define P_PIRAMID     	18

#define NUMVALUES 4

#define P_OFFSET    11


forward PlayerLeaveGang(playerid);
forward getCheckpointType(playerID);
forward isPlayerInArea(playerID, Float:data[4]);
forward PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash);
forward PirateShipScoreUpdate();
forward checkpointUpdate();
forward PropertyScoreUpdate();
forward SendPlayerFormattedText(playerid, const str[], define);
forward SendAllFormattedText(playerid, const str[], define);
new playerCheckpoint[MAX_PLAYERS];

new playerColors[100] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0x3FE65CFF
};

#define MAX_POINTS 30
new Float:checkCoords[MAX_POINTS][4] = {
{},     	//BANK
{1894.6128,1445.3431, 2084.9739,1637.8186}, 	//LV_PIRATE
{1526.1332,-1370.5281,1558.4066,-1346.3019}, 	//LS_SKYSCARPER
{-2020.2151,593.7877,-1882.4504,745.5773}, 		//SF_ZOMBOTECH
{285.5186,-40.8558, 299.3870,-30.2428},     	//AMMUNATION
{284.0546,-86.4384, 302.9315,-56.6674},     	//AMMUNATION_2
{},      	//BANK_2
{},     		//BANK_3
{},    //LS_AIRPORT
{},    //SF_AIRPORT
{},      //LV_AIRPORT
{473.8677,-24.4651, 503.5214,-10.7020},  		//ALHAMBRA
{200.4548,-168.0065, 211.3137,-156.5380},     	//DIDERSACHS
{487.6558,-88.5900, 512.0635, -67.7503},    	//BAR
{410.9893,-24.1658,415.1630,-12.6853}, 			//HAIRSTUD
{144.9131,-96.0927, 177.4128,-70.7923},    		//ZIP
{201.4462,-112.4556, 218.5237,-95.1238},    	//BINCO
{-204.7587,-27.0317, -200.2572,-22.7652},   	//TATOO
{-2815.8892,-330.0380,-2637.8352,-202.6930}, 	//SF GOLF CLUB
{-2014.8904,218.3705,-1900.5179,327.4985}, 		//SF WANG CARS
{-1804.7817,904.1232,-1682.8546,979.6241,}, 	//SF HOTEL
{-1681.0754,1168.9130,-1554.2562,1254.3335},  	//OTTO'S AUTOS
{1925.1511,968.2358, 2019.0715,1067.4276},  	//DRAGONS
{2216.7971,1638.0493, 2255.2097,1714.0806}, 	//CALIGULA
{-115.9544,-24.2706, -99.1631,-7.1391},     	//SEXSHOP
{954.5639,-1158.5366,1073.8862,-1086.4647},     //CATHAY
{1020.2889,-1581.0238,1214.4883,-1387.2167},    //VERONA
{-2240.6978,128.3114,-2224.1711,137.5221},     //ZERORC
{-2689.9849,1389.1598,-2631.0308,1431.7599},     //JIZZYS
{2208.6492,2214.2271,1287.3967,1291.3939}     //PIRAMID
};

new Float:checkpoints[MAX_POINTS][30] = {
{},
{2000.3132,1538.6012,13.5859},
{1544.3478,	-1356.1665,	329.469},
{-1951.9886,686.6917,46.5625},
{291.1157,-39.9011,1001.5156},
{291.0004,-84.5168,1001.5156},
{},
{},
{},
{},
{},
{475.2822,-18.4801,1003.6953},
{204.0677,-157.7979,1000.5234},
{501.4927,-75.4323,998.7578},
{411.9587,-17.9706,1001.8047},
{161.1875,-79.9915,1001.8047},
{207.5640,-97.8188,1005.2578},
{-201.5237,-26.2863,1002.2734},
{-2724.3921,-314.7957,7.1861},
{-1957.3124,302.8924,35.4688},
{-1754.2139,960.2347,24.8828},
{-1660.4781,1218.4636,7.2500},
{1994.7078,1017.6371,994.8906},
{2235.5408,1679.0402,1008.3594},
{-103.9330,-21.0203,1000.7188},
{1022.7669,-1124.1028,23.8708},
{1129.0569,-1489.0812,22.7690},
{-2233.7097,133.7087,1035.4210},
{-2650.8259,1410.2885,906.2734},
{2211.4485,1288.9395,10.8203} //PIRAMID
};

new checkpointType[MAX_POINTS] = {
	CP_BANK,
	CP_PIRATE,
	CP_SKYSCARPER,
	CP_ZOMBOTECH,
	CP_AMMU,
	CP_AMMU_2,
	CP_BANK_2,
	CP_BANK_3,
	CP_LS_AIR,
	CP_SF_AIR,
	CP_LV_AIR,
	CP_ALAHAM,
	CP_DIDERSACHS,
	CP_BAR,
	CP_HAIRSTUD,
	CP_ZIP,
	CP_BINCO,
	CP_TATOO,
	CP_GOLF,
	CP_WANG,
	CP_HOTEL,
	CP_OTTOS,
	CP_DRAGON,
	CP_CALIGULA,
	CP_SEXSHOP,
	CP_CATHAY,
	CP_VERONA,
	CP_ZERORC,
	CP_JIZZYS,
	CP_PIRAMID
};

#define MAX_PROPERTIES 19

new propertyNames[MAX_PROPERTIES][32] = {
	"LS Alhambra Club",
	"Dider Sachs Boutiques",
	"Ten Green Bottles, Shithole Bar",
	"Hair Studios",
	"Zip Shops",
	"Binco Shops",
	"Tatoo Parlors",
	"SF Country Club",
	"SF Wang Cars",
	"SF Hotel",
	"SF Otto's Autos",
	"LV Four Dragons Casino",
	"LV Caligula Casino",
	"LV Sexshop",
	"LS Kathay Chineese Theatre",
	"LS Verona Mall",
	"SF Zero RC Shop",
	"SF Jizzy's Club",
	"Jerbob92's Pool"
};

new propertyValues[MAX_PROPERTIES] = {

	70000,
	100000,
	20000,
	30000,
	15000,
	15000,
	10000,
	220000,
	1500000,
	200000,
	190000,
	75000,
	100000,
	25000,
	130000,
	150000,
	25000,
	70000,
	70000
};

new propertyEarnings[MAX_PROPERTIES] = {
	4500,
	7000,
	1500,
	4000,
	1000,
	1000,
	700,
	14000,
	95000,
	12000,
	10000,
	5000,
	7000,
	2000,
	8500,
	9000,
	1500,
	4500,
	4500
};
#define MAX_WEAPONS 30
new weaponNames[MAX_WEAPONS][30] = {
	"Brass Knuckles",
	"Golf Club",
	"Nite Stick",
	"Knife",
	"Baseball Bat",
	"Shovel",
	"Pool Cue",
	"Katana",
	"Chainsaw",
	"Purple Dildo",
	"Small White Vibrator",
	"Large White Vibrator",
	"Silver Vibrator",
	"Flowers",
	"Cane",
	"Frag Grenade",
	"Tear Gas",
	"Molotov Cocktail",
	"Combat Shotgun",
	"Rocket Launcher",
	"HS Rocket Launcher",
	"Flamethrower",
	"Minigun",
	"Spraycan",
	"Fire Extinguisher",
	"Camera",
	"Nightvision Goggles",
	"Infrared Vision",
	"Parachute",
	"Fake Pistol"
};
new weaponIDs[MAX_WEAPONS] = {
	1,     //Shotgun
	2,     //Combat shotgun
	3,     //Micro Uzi
	4,     //Tec9
	5,     //MP5
	6,     //AK47
	7,     //M4
	8,      //Maxed Micro Uzi
	9,
	10,
	11,
	12,
	13,
	14,
	15,
	16,
	17,
	18,
	27,
	35,
	36,
	37,
	38,
	41,
	42,
	43,
	44,
	45,
	46,
	47,
};
new weaponCost[MAX_WEAPONS] = {
	100,
	100,
	100,
	1000,
	200,
	200,
	100,
	200,
	1000,
	50,
	50,
	100,
	50,
	10,
	100,
	10000,
	1000,
	10000,
	100000,
	1000000,
	2000000,
	1000000,
	10000000,
	1000,
	1000,
	1000,
	1000,
	1000,
	100,
	10000,
};
new weaponAmmo[MAX_WEAPONS] = {
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	1,
	10,
	10,
	10,
	1000,
	10,
	10,
	1000,
	10000,
	10000,
	10000,
	10000,
	1,
	1,
	1,
	100,
};
new playerWeapons[MAX_PLAYERS][MAX_WEAPONS];
new propertyOwner[MAX_PROPERTIES] = {999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999};
#define MAX_GANGS    100
#define MAX_GANG_MEMBERS 100
#define MAX_GANG_NAME       100
new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
new gangNames[MAX_GANGS][MAX_GANG_NAME];
new gangInfo[MAX_GANGS][3]; //0-created,1-members,2-color
new gangBank[MAX_GANGS];
new playerGang[MAX_PLAYERS];
new gangInvite[MAX_PLAYERS];


main()
{
	print("\n--------------------------------------");
	print(" BANK+PROPS+GANGS+BOUNTY");
	print("--------------------------------------\n");
}
public checkpointUpdate()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i)) {
	        for(new j=0; j < MAX_POINTS; j++) {
	            if(isPlayerInArea(i, checkCoords[j])) {
	                if(playerCheckpoint[i]!=j) {
	                    DisablePlayerCheckpoint(i);
						SetPlayerCheckpoint(i, checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],2);
						playerCheckpoint[i] = j;
					}
	            } else {
	            	if(playerCheckpoint[i]==j) {
	            	    DisablePlayerCheckpoint(i);
	            	    playerCheckpoint[i] = 999;
         	    	}
	            }
	        }
		}
	}
}
public getCheckpointType(playerID) {
	return checkpointType[playerCheckpoint[playerID]];
}
public PlayerLeaveGang(playerid) {
	new string[256];
	new playername[MAX_PLAYER_NAME];
	new gangnum = playerGang[playerid];

    if(gangnum > 0) {
		for(new i = 0; i < gangInfo[gangnum][1]; i++) {
			if(gangMembers[gangnum][i]==playerid) {

			    //One less gang member
			    gangInfo[gangnum][1]--;

      		    for(new j = i; j < gangInfo[gangnum][1]; j++) {
				    //Shift gang members
				    gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
	    		}

			    //Disband gang if no more members
			    if(gangInfo[gangnum][1]<1) {
			        gangInfo[gangnum][0]=0;
			        gangInfo[gangnum][1]=0;
			        gangBank[gangnum]=0;
       			}

				//Notify other members
				for(new j = 0; j < gangInfo[gangnum][1]; j++) {
				    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
					format(string, sizeof(string),"%s has quit your gang.", playername);
					SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
				}

				format(string, sizeof(string),"You have quit the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
				SendClientMessage(playerid, COLOR_ORANGE, string);

				playerGang[playerid]=0;

				SetPlayerColor(playerid,playerColors[playerid]);

				return;
			}
		}
	} else {
		SendClientMessage(playerid, COLOR_RED, "You are not in a gang.");
	}
}



public isPlayerInArea(playerID, Float:data[4])
{
	new Float:X, Float:Y, Float:Z;

	GetPlayerPos(playerID, X, Y, Z);
	if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
		return 1;
	}
	return 0;
}

public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash)
{

	if(IsPlayerConnected(playerID))
	{
		new Float:X, Float:Y, Float:Z;

		GetPlayerPos(playerID, X, Y, Z);
		if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
		{
			GivePlayerMoney(playerID, cash);
			return 1;
		}
	}
	return 0;
}
//------------------------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------------------

public PirateShipScoreUpdate()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		PayPlayerInArea(i, 1995.5, 1518.0, 2006.0, 1569.0, 200);
		PayPlayerInArea(i, 1516.1332, -1380.5281, 1568.4066, -1336.3019, 200);
		PayPlayerInArea(i, -1988.4744, 639.1348, -1917.0579, 715.5820, 200);
//		{
//            SendClientMessage(i, COLOR_YELLOW, "You earned money for holding pirate ship area.");
//		}
	}
}

//------------------------------------------------------------------------------------------------------

public PropertyScoreUpdate()
{
	new owners[MAX_PROPERTIES];
	new payments[MAX_PROPERTIES];

	for(new i=0; i < MAX_PROPERTIES; i++)
	    owners[i]=999;

	for(new i=0; i < MAX_PROPERTIES; i++)
	{
		if(propertyOwner[i] < 999) {

			for(new j=0; j < MAX_PROPERTIES; j++) {
			    if(owners[j]==propertyOwner[i]) {
			        payments[j]+=propertyEarnings[i];
			        j = MAX_PROPERTIES;
			    } else if (owners[j]==999) {
					owners[j]=propertyOwner[i];
					payments[j]+=propertyEarnings[i];
			        j = MAX_PROPERTIES;
				}
			}

		}
	}

	for(new i=0; i < MAX_PROPERTIES; i++) {
		if(owners[i] < 999 && IsPlayerConnected(owners[i])) {
			new string[256];

			GivePlayerMoney(owners[i], payments[i]);

			format(string, sizeof(string), "You earned $%d from your properties.", payments[i]);
			SendClientMessage(owners[i], COLOR_GREEN, string);
		}
	}

}

//------------------------------------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
	new string[256];
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new cmd[256];
	new giveplayerid, idx;

	cmd = strtok(cmdtext, idx);

		
	if(strcmp(cmd, "/gang", true) == 0) {
	    new tmp[256];
	    new gangcmd, gangnum;
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
			return 1;
		}
		giveplayerid = strval(tmp);

		if(strcmp(tmp, "create", true)==0)
		    gangcmd = 1;
		else if(strcmp(tmp, "invite", true)==0)
		    gangcmd = 2;
		else if(strcmp(tmp, "join", true)==0)
		    gangcmd = 3;
		else if(strcmp(tmp, "quit", true)==0)
		    gangcmd = 4;

		tmp = strtok(cmdtext, idx);
		if(gangcmd < 3 && !strlen(tmp)) {
		    if(gangcmd==0)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
			else if(gangcmd==1)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create] [name]");
			else if(gangcmd==2)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [invite] [playerID]");
			return 1;
		}

		//Create Gang//
		if(gangcmd==1) {
		    if(playerGang[playerid]>0) {
				SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
				return 1;
		    }

			for(new i = 1; i < MAX_GANGS; i++) {
				if(gangInfo[i][0]==0) {
				    //name gang
					format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
					//Gang exists
					gangInfo[i][0]=1;
					//There is one member
					gangInfo[i][1]=1;
					//Gang color is player's color
					gangInfo[i][2]=playerColors[playerid];

					//Player is the first gang member
					gangMembers[i][0] = playerid;
					format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
					SendClientMessage(playerid, COLOR_GREEN, string);

					playerGang[playerid]=i;

					return 1;
				}
			}

			return 1;

		//Join Gang//
		} else if (gangcmd==3) {
	 		gangnum = gangInvite[playerid];

		    if(playerGang[playerid]>0) {
				SendClientMessage(playerid, COLOR_RED, "You are already in a gang!");
				return 1;
		    }
	 		if(gangInvite[playerid]==0) {
				SendClientMessage(playerid, COLOR_RED, "You have not been invited to a gang.");
				return 1;
			}
			if(gangInfo[gangnum][0]==0) {
				SendClientMessage(playerid, COLOR_RED, "That gang does not exist!");
				return 1;
			}

			if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
			    new i = gangInfo[gangnum][1];

				gangInvite[playerid]=0;

				gangMembers[gangnum][i] = playerid;

			    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
				for(new j = 0; j < gangInfo[gangnum][1]; j++) {
					format(string, sizeof(string),"%s has joined your gang.", sendername);
					SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
				}

				gangInfo[gangnum][1]++;
				playerGang[playerid] = gangnum;

				SetPlayerColor(playerid,gangInfo[gangnum][2]);

				format(string, sizeof(string),"You have joined the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
				SendClientMessage(playerid, COLOR_GREEN, string);

				return 1;
			}

			SendClientMessage(playerid, COLOR_RED, "That gang is full.");
			return 1;

		//Invite to Gang//
		} else if (gangcmd==2) {
	 		giveplayerid = strval(tmp);

			if(playerGang[playerid]==0) {
				SendClientMessage(playerid, COLOR_RED, "You are not in a gang!");
				return 1;
			}
//			if(gangMembers[playerGang[playerid]][0]!=playerid) {
//				SendClientMessage(playerid, COLOR_RED, "You need to be the gang leader to send an invite.");
//				return 1;
//			}

			if(IsPlayerConnected(giveplayerid)) {
				GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				GetPlayerName(playerid, sendername, sizeof(sendername));

				format(string, sizeof(string),"You have sent a gang invite to %s.", giveplayer);
				SendClientMessage(playerid, COLOR_GREEN, string);
				format(string, sizeof(string),"You have recieved a gang invite from %s to '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
				SendClientMessage(giveplayerid, COLOR_GREEN, string);

				gangInvite[giveplayerid]=playerGang[playerid];

			} else
				SendClientMessage(playerid, COLOR_RED, "No such player exists!");

		//Leave Gang//
		} else if (gangcmd==4) {
		    PlayerLeaveGang(playerid);
		}

		return 1;
	}

	//------------------- /ganginfo

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

		if(!strlen(tmp) && playerGang[playerid]==0) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ganginfo [number]");
			return 1;
		} else if (!strlen(tmp))
			gangnum = playerGang[playerid];
		else
			gangnum = strval(tmp);

		if(gangInfo[gangnum][0]==0) {
			SendClientMessage(playerid, COLOR_RED, "No such gang exists!");
			return 1;
		}

		format(string, sizeof(string),"'%s' Gang Members (id: %d)", gangNames[gangnum], gangnum);
		SendClientMessage(playerid, COLOR_GREEN, string);

		for(new i = 0; i < gangInfo[gangnum][1]; i++) {
			GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
			format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}
if(strcmp(cmd, "/pirktig", true) == 0) {
		new weaponid;
		new tmp[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "Rasykite: /pirktig [ginklo numeris]");
			return 1;
		}
		weaponid = strval(tmp);

		if(IsPlayerInCheckpoint(playerid)==0) {
			SendClientMessage(playerid, COLOR_YELLOW, "Jus turite buti Ammunation, kad galetumete pirkti ginklus.");
			return 1;
		}
		if(playerCheckpoint[playerid]!=CP_AMMU && playerCheckpoint[playerid]!=CP_AMMU_2) {
			SendClientMessage(playerid, COLOR_YELLOW, "Jus turite buti Ammunation, kad galetumete pirkti ginklus.");
			return 1;
		}
		if(GetPlayerMoney(playerid) < weaponCost[weaponid]) {
			SendClientMessage(playerid, COLOR_RED, "Jus neturite pakankamai pinigu!");
			return 1;
		}
		if(weaponid < 0 || weaponid > MAX_WEAPONS-1){
			SendClientMessage(playerid, COLOR_RED, "Neteisingas ginklo numeris.");
			return 1;
		}

		format (string, sizeof(string), "Jus nusipirkote %s.",weaponNames[weaponid]);
		SendClientMessage(playerid, COLOR_GREEN, string);

		GivePlayerWeapon(playerid, weaponIDs[weaponid], weaponAmmo[weaponid]);
		playerWeapons[playerid][weaponid]++;

		GivePlayerMoney(playerid, 0-weaponCost[weaponid]);

		return 1;
	}
	
	if(strcmp(cmd, "/pirkti", true) == 0) {
		new property=999;

		if(IsPlayerInCheckpoint(playerid)) {
			switch (playerCheckpoint[playerid]) {
				case CP_ALAHAM:{
					property = P_ALAHAM;
				}
				case CP_DIDERSACHS:{
					property = P_DIDERSACHS;
				}
				case CP_BAR:{
					property = P_BAR;
				}
				case CP_HAIRSTUD:{
					property = P_HAIRSTUD;
				}
				case CP_ZIP:{
					property = P_ZIP;
				}
				case CP_BINCO:{
					property = P_BINCO;
				}
				case CP_TATOO:{
					property = P_TATOO;
				}
				case CP_GOLF:{
					property = P_GOLF;
				}
				case CP_WANG:{
					property = P_WANG;
				}
				case CP_HOTEL:{
					property = P_HOTEL;
				}
				case CP_OTTOS:{
					property = P_OTTOS;
				}
				case CP_DRAGON:{
					property = P_DRAGON;
				}
				case CP_CALIGULA:{
					property = P_CALIGULA;
				}
				case CP_SEXSHOP:{
					property = P_SEXSHOP;
				}
				case CP_CATHAY:{
					property = P_CATHAY;
				}
				case CP_VERONA:{
					property = P_VERONA;
				}
				case CP_ZERORC:{
					property = P_ZERORC;
				}
				case CP_JIZZYS:{
					property = P_JIZZYS;
				}
				case CP_PIRAMID:{
					property = P_PIRAMID;
				}
			}

			if(property==999) {
				SendClientMessage(playerid, COLOR_YELLOW, "Tu turi buti checkpointe, kad galetum pirkti pastata.");
				return 1;
			}

//			property--;

			if(GetPlayerMoney(playerid) < propertyValues[property]) {
				SendClientMessage(playerid, COLOR_RED, "Tu neturi pakankamai pinigu.");
				return 1;
			}
			if(propertyOwner[property]==playerid) {
				SendClientMessage(playerid, COLOR_RED, "Tu jau nusipirkes sita pastata.");
				return 1;
			}

			if(propertyOwner[property] < 999) {
				GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
				GivePlayerMoney(propertyOwner[property], propertyValues[property]);
				format (string, sizeof(string), "Tavo %s pastata nupirko %s (id: %d).",propertyNames[property],giveplayer,playerid);
				SendClientMessage(propertyOwner[property], COLOR_RED, string);
			}

			GivePlayerMoney(playerid, 0-propertyValues[property]);

			propertyOwner[property]=playerid;

			format(string, sizeof(string), "Tu nusipirkai %s!", propertyNames[property]);
			SendClientMessage(playerid, COLOR_GREEN, string);

		} else {
			SendClientMessage(playerid, COLOR_YELLOW, "Tu turi buti checkpointe, kad galetum pirkti pastata.");
			return 1;
		}


		return 1;
	}

	//------------------- /properties

	if(strcmp(cmd, "/pastatai", true) == 0) {
		SendClientMessage(playerid, COLOR_GREEN, "Pastatu savininku sarasas 1:");
		for(new i = 0; i < 8; i++) {
			if(propertyOwner[i] < 999) {
				GetPlayerName(propertyOwner[i], giveplayer, sizeof(giveplayer));
				format(string, sizeof(string), "%d. %s - %s", i, propertyNames[i], giveplayer);
			} else
				format(string, sizeof(string), "%d. %s - Niekas", i, propertyNames[i]);

			SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}

	if(strcmp(cmd, "/pastatai2", true) == 0) {
		SendClientMessage(playerid, COLOR_GREEN, "Pastatu savininku sarasas 2:");
		for(new i = 9; i < 18; i++) {
			if(propertyOwner[i] < 999) {
				GetPlayerName(propertyOwner[i], giveplayer, sizeof(giveplayer));
				format(string, sizeof(string), "%d. %s - %s", i, propertyNames[i], giveplayer);
			} else
				format(string, sizeof(string), "%d. %s - Niekas", i, propertyNames[i]);

			SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}
	//------------------- /gangs

	if(strcmp(cmd, "/gangs", true) == 0)
	{
		new x;

		SendClientMessage(playerid, COLOR_GREEN, "Current Gangs:");
	    for(new i=0; i < MAX_GANGS; i++) {
			if(gangInfo[i][0]==1) {
				format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

				x++;
				if(x > 2) {
				    SendClientMessage(playerid, COLOR_YELLOW, string);
				    x = 0;
					format(string, sizeof(string), "");
				} else {
					format(string, sizeof(string), "%s, ", string);
				}
			}
		}

		if(x <= 2 && x > 0) {
			string[strlen(string)-2] = '.';
		    SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}

	return 0;
}

//------------------------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------
   public OnPlayerEnterCheckpoint(playerid)
   {
    new string[256];
	new ownplayer[MAX_PLAYER_NAME];

	switch(getCheckpointType(playerid))
	{
		case CP_PIRATE: {
			SendClientMessage(playerid, COLOR_GREEN, "Tu gali buti piratu laive, gautum pinigu.");
		}
		case CP_SKYSCARPER: {
			SendClientMessage(playerid, COLOR_GREEN, "Tu gali buti Skyscarper, kad gautum pinigu.");
		}
		case CP_ZOMBOTECH: {
			SendClientMessage(playerid, COLOR_GREEN, "Tu gali buti Zombotech Corp. lobby, kad gautum pinigu.");
            SendClientMessage(playerid, COLOR_GREEN, "----------------------------------------------------------------------------");

  }
  }
	if(getCheckpointType(playerid)>= P_OFFSET) {
		format(string, sizeof(string), "Tu gali pirkti %s uz $%d su komanda /pirkti.", propertyNames[playerCheckpoint[playerid]-P_OFFSET], propertyValues[playerCheckpoint[playerid]-P_OFFSET]);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		format(string, sizeof(string), "Tu gausi po $%d.", propertyEarnings[playerCheckpoint[playerid]-P_OFFSET]);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		if(propertyOwner[playerCheckpoint[playerid]-P_OFFSET]<999) {
			GetPlayerName(propertyOwner[playerCheckpoint[playerid]-P_OFFSET], ownplayer, sizeof(ownplayer));
			format(string, sizeof(string), "Sitas pastatas yra nupirktas %s.", ownplayer);
			SendClientMessage(playerid, COLOR_RED, string);
		}
	}
}
//------------------------------------------------------------------------------------------------------

public OnFilterScriptInit()
{
	SetTimer("PirateShipScoreUpdate", 2001, 1);
	SetTimer("checkpointUpdate", 1100, 1);
	SetTimer("PropertyScoreUpdate", 420000, 1);
	return 1;
}
public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFFFF00AA, tmpbuf);
}

public SendAllFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessageToAll(0xFFFF00AA, tmpbuf);
}

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;
}



public OnFilterScriptExit()
{
	return 1;
}