All pastes #295570 Raw Edit

Someone

public text v1 · immutable
#295570 ·published 2006-12-29 15:10 UTC
rendered paste body
#include <a_samp>
#include <dutils>
#include <dudb>
#include <Dini>
#include <uf>

#define TEAM_COP 0
#define TEAM_GANGSTA 1
#define TEAM_CIVILIAN 2
#define TEAM_MEDIC 3
#define TEAM_FIREMAN 4

#define TEAM_COP_COLOR 0x0000FFFF // Blue
#define TEAM_GANGSTA_COLOR 0x0FE403FF // Green
#define TEAM_CIVILIAN_COLOR 0xD9DE0AFF // Yellow
#define TEAM_MEDIC_COLOR 0x1C9D9DFF // Greeny-blue
#define TEAM_FIREMAN_COLOR 0xFF0000FF // Red

new gTeam[MAX_PLAYERS];

new ClassSkin[256];
new PlayerClass[MAX_PLAYERS];


main()
{
	print("\n----------------------------------");
	print("  Code Testing by Ali");
	print("----------------------------------\n");
}

enum JobsEnum
{
	jTitle[256],
	jPay,
	jDescrip[256],
	jMaker,
    jInUse
}
new Jobs[][JobsEnum];

public OnGameModeInit()
{
	print("GameModeInit()");
	SetGameModeText("Code Testing");
	new LoadSkins[] = {
		0, 7, 9, 10, 11, 12, 13, 14, 15, // class 0 - 8
		16, 17, 18, 19, 20, 21, 22, 23, // class 9 - 16
		24, 25, 26, 27, 28, 29, 30, 31, // class 17 - 24
		32, 33, 34, 35, 36, 37, 38, 39, // class 25 - 32
		40, 41, 43, 44, 45, 46, 47, 48, // class 33 - 40
		49, 50, 51, 52, 53, 54, 55, 56, // class 41 - 48
		57, 58, 59, 60, 61, 62, 63, 64, // class 49 - 56
		66, 67, 68, 69, 70, 71, 72, 73, // class 57 - 64
		75, 76, 77, 78, 79, 80, 81, 82, // class 65 - 72
		83, 84, 85, 87, 88, 89, 90, 91, // class 73 - 80
		92, 93, 94, 95, 96, 97, 98, 99, // class 81 - 88
		100, 101, 102, 103, 104, 105,   // class 89 - 94
		106, 107, 108, 109, 110, 111,   // class 95 - 100
		112, 113, 114, 115, 116, 117,   // class 101 - 106
		118, 120, 121, 122, 123, 124,   // class 107 - 112
		125, 126, 127, 128, 129, 130,   // class 113 - 118
		131, 132, 133, 134, 135, 136,   // class 119 - 124
		137, 138, 139, 140, 141, 142,   // class 125 - 130
		143, 144, 145, 146, 147, 148,   // class 131 - 136
		150, 151, 152, 153, 154, 155,   // class 137 - 142
		156, 157, 158, 159, 160, 161,   // class 143 - 148
		162, 163, 164, 165, 166, 167,   // class 149 - 154
		168, 169, 170, 171, 172, 173,   // class 155 - 160
		174, 175, 176, 177, 178, 179,   // class 161 - 166
		180, 181, 182, 183, 184, 185,   // class 167 - 172
		186, 187, 188, 189, 190, 191,   // class 173 - 178
		192, 193, 194, 195, 196, 197,   // class 179 - 184
		198, 199, 200, 201, 202, 203,   // class 185 - 190
		204, 205, 206, 207, 209, 210,   // class 191 - 196
		211, 212, 213, 214, 215, 216,   // class 197 - 202
		217, 218, 219, 220, 221, 222,   // class 203 - 208
		223, 224, 225, 226, 227, 228,   // class 209 - 214
		229, 230, 231, 232, 233, 234,   // class 215 - 220
		235, 236, 237, 238, 239, 240,   // class 221 - 226
		241, 242, 243, 244, 245, 246,   // class 227 - 232
		247, 248, 249, 250, 251, 252,   // class 233 - 238
		253, 254, 255, 274, 275, 276,   // class 239 - 244
		277, 278, 279, 280, 281, 282,   // class 245 - 250
		283, 284, 285, 286, 287, 288,   // class 251 - 256
		290, 291, 292, 293, 294, 295,   // class 257 - 262
		296, 297, 298, 299              // class 263 - 266

		};
	
	for (new i; i < sizeof(LoadSkins); i++)
	{
		AddPlayerClass(LoadSkins[i], 1958.3783, 1343.1572, 15.3746, 269.1425, 22, 3000, 31, 3000, 32, 3000);
	}


	//--------------------------Pickups--------------------------//
	AddStaticPickup(370, 2, 2031.0907,1338.4077,10.8203); // jetpack
    AddStaticPickup(1240, 2, 2023.5238,1338.1635,10.8203); // health
    AddStaticPickup(1242, 2, 2031.2104,1346.2709,10.8203); // armour


	//--------------------------Spawn Cars--------------------------//
	AddStaticVehicle(411,2023.5308,1334.5774,10.1466,270.5545,0,0); // Black Infernus - Spawn
    AddStaticVehicle(411,2021.9280,1351.7144,9.9506,269.4601,0,0); // Black Infernus - Spawn
    AddStaticVehicle(560,2032.0262,1329.8737,10.5258,311.3071,0,0); // Black Sultan - Spawn
    AddStaticVehicle(560,2031.6089,1358.3645,10.5251,220.7157,0,0); // Black Sultan - Spawn
    AddStaticVehicle(602,2027.2617,1329.9399,10.5253,315.6829,0,0); // Black Alpha - Spawn
    AddStaticVehicle(602,2027.2075,1356.5769,10.5255,215.7004,0,0); // Black Alpha - Spawn
    AddStaticVehicle(592,1477.2406,1248.1947,10.6262,0.9756,0,0); // Andromeda
    AddStaticVehicle(411,2002.3323,1544.4202,13.3141,270.3050,0,0); // Black Infernus
	AddStaticVehicle(411,2432.1184,1562.2325,10.4708,359.8570,0,0); // Black Infernus
	AddStaticVehicle(411,2383.9868,1778.4109,10.4709,93.1311,0,0); // Black Infernus
	AddStaticVehicle(411,2154.9912,1953.3461,10.3990,0.0915,0,0); // Black Infernus
	AddStaticVehicle(411,2154.7939,2202.8865,10.3990,0.0261,0,0); // Black Infernus
	AddStaticVehicle(411,2089.4521,2207.0007,10.5474,181.3335,0,0); // Black Infernus
	AddStaticVehicle(411,1711.6814,2258.3472,10.5474,270.9300,0,0); // Black Infernus
	AddStaticVehicle(411,1534.3262,2214.4028,10.5474,180.9206,0,0); // Black Infernus
	AddStaticVehicle(411,1372.8302,2011.7813,10.9077,90.5890,0,0); // Black Infernus
	AddStaticVehicle(411,1512.8772,1999.4934,10.5474,179.9436,0,0); // Black Infernus
	AddStaticVehicle(411,1600.1185,1839.5483,10.5474,180.2976,0,0); // Black Infernus
	AddStaticVehicle(411,1706.7603,1434.9009,10.3596,179.0247,0,0); // Black Infernus
	AddStaticVehicle(411,2039.4781,1071.7966,10.3989,179.2368,0,0); // Black Infernus
	AddStaticVehicle(411,2173.2424,1120.9221,12.3483,332.6398,0,0); // Black Infernus
	AddStaticVehicle(411,2452.3638,1240.0322,10.5474,1.2582,0,0); // Black Infernus
	AddStaticVehicle(411,2489.6328,1407.9973,10.5474,178.9131,0,0); // Black Infernus
	AddStaticVehicle(411,2488.0881,1532.9193,10.4731,49.3365,0,0); // Black Infernus
	AddStaticVehicle(411,2591.0447,1856.3821,10.5474,270.2286,0,0); // Black Infernus
	AddStaticVehicle(411,2599.1423,1681.5332,10.5474,270.6079,0,0); // Black Infernus
	AddStaticVehicle(411,2360.9153,1994.5872,10.3987,358.7874,0,0); // Black Infernus
	AddStaticVehicle(411,2360.7896,2214.1719,10.4076,1.0911,0,0); // Black Infernus
	AddStaticVehicle(411,2623.7500,2206.2979,10.5474,180.0092,0,0); // Black Infernus
	AddStaticVehicle(411,2593.0552,2275.5100,10.5474,89.9927,0,0); // Black Infernus
	AddStaticVehicle(411,2879.4023,2342.2673,10.5474,90.6389,0,0); // Black Infernus
	AddStaticVehicle(411,1975.2076,2657.8181,10.5545,0.0759,0,0); // Black Infernus
	AddStaticVehicle(411,1959.7941,2755.3193,10.5474,0.7571,0,0); // Black Infernus
    AddStaticVehicle(411,-255.6057,2765.9688,62.0906,180.9327,0,0); // Black Infernus
	AddStaticVehicle(411,-201.5001,2595.1074,62.3999,180.4964,0,0); // Black Infernus
	AddStaticVehicle(411,-234.3362,2608.4287,62.3873,0.2706,0,0); // Black Infernus
	AddStaticVehicle(411,-784.9832,2752.6523,45.3305,87.1844,0,0); // Black Infernus
	AddStaticVehicle(411,-878.0573,2757.3979,45.5339,94.4374,0,0); // Black Infernus
	AddStaticVehicle(411,-1275.9562,2705.6831,49.7590,208.4528,0,0); // Black Infernus
	AddStaticVehicle(411,-1400.2727,2643.7561,55.3724,268.7715,0,0); // Black Infernus
	AddStaticVehicle(411,-1522.4243,2525.4658,55.4240,180.1596,0,0); // Black Infernus
	AddStaticVehicle(411,-1936.6404,2383.5608,49.1771,111.5292,0,0); // Black Infernus
	AddStaticVehicle(411,2217.9885,1514.2358,10.5474,179.8335,0,0); // Black Infernus
	AddStaticVehicle(411,2145.3950,1408.8662,10.5474,179.8027,0,0); // Black Infernus
	AddStaticVehicle(411,2302.3384,1444.2339,10.5505,90.1420,0,0); // Black Infernus
	AddStaticVehicle(411,2322.6658,1458.9109,32.5804,90.8245,0,0); // Black Infernus
	AddStaticVehicle(411,2352.2747,1415.8610,42.5475,269.7664,0,0); // Black Infernus
	AddStaticVehicle(411,2502.0728,1648.7139,10.5474,180.4406,0,0); // Black Infernus
	AddStaticVehicle(411,2392.4697,1658.3895,10.5474,0.0458,0,0); // Black Infernus
	AddStaticVehicle(411,2174.8198,1663.8639,10.5467,45.2438,0,0); // Black Infernus
	AddStaticVehicle(411,2175.0420,1693.7356,10.5435,126.1396,0,0); // Black Infernus
	AddStaticVehicle(411,2128.7195,1811.9801,10.3990,333.7710,0,0); // Black Infernus
	AddStaticVehicle(411,2195.9363,1856.6268,10.5474,179.9282,0,0); // Black Infernus
	AddStaticVehicle(411,2279.9233,1952.0791,9.5942,0.2977,0,0); // Black Infernus
	AddStaticVehicle(411,2221.9670,1940.3372,15.0735,90.3717,0,0); // Black Infernus
	AddStaticVehicle(411,2296.1799,1998.5415,15.0735,0.0261,0,0); // Black Infernus
	AddStaticVehicle(411,2243.1526,1951.9006,31.5067,0.2410,0,0); // Black Infernus
	AddStaticVehicle(411,2285.1829,2050.6765,10.5476,270.4582,0,0); // Black Infernus
	AddStaticVehicle(411,2216.8181,2055.8962,10.5474,90.2861,0,0); // Black Infernus
	AddStaticVehicle(411,2486.5654,1991.1296,10.5474,180.6248,0,0); // Black Infernus
	AddStaticVehicle(411,2534.8245,2017.7120,10.5474,270.9470,0,0); // Black Infernus
	AddStaticVehicle(411,2587.9001,2077.9194,10.5419,271.3538,0,0); // Black Infernus
	AddStaticVehicle(411,2649.9214,2009.0410,10.5450,0.4101,0,0); // Black Infernus
	AddStaticVehicle(411,2821.1619,2224.1333,10.5474,271.2679,0,0); // Black Infernus
	AddStaticVehicle(411,2815.9365,2379.5767,10.5474,270.2734,0,0); // Black Infernus
	AddStaticVehicle(411,2802.5608,2582.1997,10.5474,46.5471,0,0); // Black Infernus
	AddStaticVehicle(411,2432.4622,2377.0427,10.4708,179.8026,0,0); // Black Infernus
	AddStaticVehicle(411,2484.3865,2515.2002,21.6072,90.5432,0,0); // Black Infernus
	AddStaticVehicle(411,2423.4016,2529.7483,10.5474,180.9441,0,0); // Black Infernus
	AddStaticVehicle(411,2282.6086,2536.5256,10.5474,182.5611,0,0); // Black Infernus
	AddStaticVehicle(411,2273.7688,2458.9885,10.5474,1.2726,0,0); // Black Infernus
	AddStaticVehicle(411,2246.9937,2430.9141,3.0005,180.7144,0,0); // Black Infernus
	AddStaticVehicle(411,2298.1157,2451.6226,-7.7260,89.0891,0,0); // Black Infernus
	AddStaticVehicle(411,2192.2925,2502.9365,10.5474,0.1871,0,0); // Black Infernus
	AddStaticVehicle(411,2152.8853,2505.6440,10.5474,270.3378,0,0); // Black Infernus
	AddStaticVehicle(411,2103.4736,2413.7559,10.5529,91.3844,0,0); // Black Infernus
	AddStaticVehicle(411,2078.5439,2395.8203,10.5474,270.1641,0,0); // Black Infernus
	AddStaticVehicle(411,2078.4229,2398.7678,14.8443,270.4319,0,0); // Black Infernus
	AddStaticVehicle(411,2069.0518,2419.6096,19.1489,89.6749,0,0); // Black Infernus
	AddStaticVehicle(411,2104.4768,2395.9678,19.1490,90.8223,0,0); // Black Infernus
	AddStaticVehicle(411,2103.7192,2413.8149,23.4521,271.1249,0,0); // Black Infernus
	AddStaticVehicle(411,2077.9082,2416.5066,27.7505,270.4321,0,0); // Black Infernus
	AddStaticVehicle(411,2068.5083,2416.6785,49.2496,89.7032,0,0); // Black Infernus
	AddStaticVehicle(411,1611.9087,1850.1600,10.5474,358.9478,0,0); // Black Infernus
	AddStaticVehicle(411,220.0524,1919.3348,17.3677,180.6596,0,0); // Black Infernus - Army Base
	AddStaticVehicle(411,211.4317,1919.7550,17.3677,180.1478,0,0); // Black Infernus - Army Base
	AddStaticVehicle(411,202.3364,1919.7913,17.3677,179.9155,0,0); // Black Infernus - Army Base
	AddStaticVehicle(411,193.6030,1919.1624,17.3677,180.4622,0,0); // Black Infernus - Army Base


	set(Jobs[0][jTitle],"Testing");
	Jobs[0][jPay] = 10000;
	set(Jobs[0][jDescrip],"You are testing in the correct direction");
	Jobs[0][jMaker] = 0;
    Jobs[0][jInUse] = 1;

	SetTimer("ScoreUpdate", 1000, 1);


	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
	SetPlayerFacingAngle(playerid, 50.1425);
	printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
	SetPlayerPos(playerid, 1961.8290,1593.4952,75.7188);
	SetPlayerCameraPos(playerid, 1960.2369,1594.1226,76.8727);
	SetPlayerCameraLookAt(playerid, 1961.8290,1593.4952,75.7188);
	return 1;
}

public OnGameModeExit()
{
	print("GameModeExit()");
	return 1;
}

public OnPlayerConnect(playerid)
{
	printf("OnPlayerConnect(%d)", playerid);
	GameTextForPlayer(playerid, "~b~ Code Testing ~n~ by Ali", 6000, 1);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	printf("OnPlayerDisconnect(%d)", playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	printf("OnPlayerSpawn(%d)", playerid);
	GivePlayerMoney(playerid, 100000);
    SetPlayerCheckpoint(playerid,2020.8119,1338.3542,10.8203 , 2.0);
    SetPlayerToTeamColor(playerid);
	return 1;
}

public SetPlayerTeamFromClass(playerid, classid)
{
	if (classid > 90 && classid < 116)
	{
		gTeam[playerid] = TEAM_COP;
	}
	else if (classid > 101 && classid < 128)
	{
		gTeam[playerid] = TEAM_GANGSTA;
	}
	else if (classid > 241 && classid < 245)
	{
		gTeam[playerid] = TEAM_MEDIC;
	}
	else if (classid > 244 && classid < 248)
	{
		gTeam[playerid] = TEAM_FIREMAN;
	}
	else
 	{
		gTeam[playerid] = TEAM_CIVILIAN;
	}
}

public SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == TEAM_COP)
	{
		SetPlayerColor(playerid, TEAM_COP_COLOR);
	}
	else if (gTeam[playerid] == TEAM_GANGSTA)
	{
		SetPlayerColor(playerid, TEAM_GANGSTA_COLOR);
	}
	else if (gTeam[playerid] == TEAM_MEDIC)
	{
		SetPlayerColor(playerid, TEAM_MEDIC_COLOR);
	}
	else if (gTeam[playerid] == TEAM_FIREMAN)
	{
		SetPlayerColor(playerid, TEAM_FIREMAN_COLOR);
	}
}

public OnPlayerDeath(playerid, killerid, reason)
{
	printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
	return 1;
}

public OnPlayerText(playerid)
{
	printf("OnPlayerText(%d)", playerid);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new command[256], index;
	command = strtok(cmdtext, index);


	if (strcmp(command, "/help", true) ==0)
		{
            SendPmMsg(playerid, "----------------------------------");
			SendPmMsg(playerid, "Hello and welcome to Ali's Code Testing server!");
	    	SendPmMsg(playerid, "This server is being used by me to learn how to code Pawn, the language");
	    	SendPmMsg(playerid, "used to make scripts for SA-MP");
	    	SendPmMsg(playerid, "----------------------------------");
	    	SendPmMsg(playerid, "Type: /rules for the server rules");
	    	SendPmMsg(playerid, "      /commands for a list of commands");
        	SendPmMsg(playerid, "----------------------------------");
			SendPmMsg(playerid, "That's it for now, but hopefully more coming soon!");
        	SendPmMsg(playerid, "----------------------------------");
			return 1;
		}


		if (strcmp(command, "/rules", true) ==0)
		{
            SendPmMsg(playerid, "----------------------------------");
			SendPmMsg(playerid, "Here is a list of all the rules in this server, don't obey");
	    	SendPmMsg(playerid, "them and you will be punished");
	    	SendPmMsg(playerid, "----------------------------------");
	    	SendPmMsg(playerid, "No Deathmatching");
	    	SendPmMsg(playerid, "No cheats or hacks of any kind");
	    	SendPmMsg(playerid, "No offensive comments");
        	SendPmMsg(playerid, "Be respectful to other players");
			SendPmMsg(playerid, "be respectful to admins");
        	SendPmMsg(playerid, "----------------------------------");
			return 1;
		}

	
		if (strcmp(command, "/commands", true) ==0)
		{
			new commandsnum[256];
			commandsnum = strtok(cmdtext, index);
			
			if(!strlen(commandsnum))
			{
	    		SendErrMsg(playerid, "Usage: /commands <List Number>");
	    	}
	    	else
	    	{
			if (strval(commandsnum) == 1)
			{
				SendPmMsg(playerid, "----------------------------------");
				SendPmMsg(playerid, "Commands List 1");
	    		SendPmMsg(playerid, "/help - See the help menu");
	    		SendPmMsg(playerid, "/giveweapon - Gives you or another player a weapon");
	    		SendPmMsg(playerid, "/sethealth - Sets the health of you or another player");
	    		SendPmMsg(playerid, "/up - raises you up by the defined distance");
	    		SendPmMsg(playerid, "/teleport - teleports you to the specified player");
        		SendPmMsg(playerid, "/goto - CMoves you to a predefined location");
				SendPmMsg(playerid, "/inter - to change your interior");
				SendPmMsg(playerid, "Type /commands2 for the second list");
			}
			if (strval(commandsnum) == 2)
			{
            	SendPmMsg(playerid, "----------------------------------");
				SendPmMsg(playerid, "Commands List 2");
	    		SendPmMsg(playerid, "/remove - removes the player from their vehicle");
	    		SendPmMsg(playerid, "/home - brings you back to the spawnpoint");
	    		SendPmMsg(playerid, "/disarm - to disarm a player");
	    		SendPmMsg(playerid, "/givecash - to givecash to a player");
	    		SendPmMsg(playerid, "/pm - send a private message to another player");
        		SendPmMsg(playerid, "/worldtime - to change the time of the map");
				SendPmMsg(playerid, "/setcolor - to set your player color");
				SendPmMsg(playerid, "Type /commands 3 for the third commands list");
			}
			if (strval(commandsnum) == 3)
			{
				SendPmMsg(playerid, "----------------------------------");
				SendPmMsg(playerid, "Commands List 3");
	    		SendPmMsg(playerid, "/admincash - to give yourself cash (Rcon admin only)");
	    	}
			}
			return 1;
		}

		if (strcmp(command, "/up", true)==0)
		{
			new upnum[256];
			upnum = strtok(cmdtext, index);

	    	if(!strlen(upnum))
			{
	    		SendErrMsg(playerid, "Usage: /up <Amount to go up by>");
	    	}
	    	else
	    	{
  			new Float:x, Float:y, Float:z;
			GetPlayerPos(playerid, x, y, z);
			SendInfMsg(playerid, "You are moved up");
			SetPlayerPos(playerid, x, y, z + strval(upnum));
			}
			return 1;
  		}


		if (strcmp(command, "/giveweapon", true) ==0)
		{
	    	new wplayer[256], weap[256], ammo[256];
			wplayer = strtok(cmdtext, index);
			weap = strtok(cmdtext, index);
	    	ammo = strtok(cmdtext, index);

	    	if(!strlen(wplayer) || !strlen(weap) || !strlen(ammo))
			{
	    		SendErrMsg(playerid, "Usage: /giveweapon <ID/Name> <Weapon ID> <Ammo>");
	    	}
	    	else
	    	{
			GivePlayerWeapon(strval(wplayer), strval(weap), strval(ammo));
			new wname[MAX_WEAPON_NAME];
			GetWeaponName(strval(weap), wname, MAX_WEAPON_NAME);
			new string[256];
        	format(string, sizeof(string),"You have recieved a %s with %d ammo", wname, strval(ammo) );
			SendInfMsg(strval(wplayer), string);
			}
			return 1;
		}

		if (strcmp(command, "/sethealth", true) ==0)
		{
			new hplayer[256], health[256];
			hplayer = strtok(cmdtext, index);
			health = strtok(cmdtext, index);

	    	if(!strlen(hplayer) || !strlen(health))
			{
	    		SendErrMsg(playerid, "Usage: /sethealth <ID/Name> <Health>");
	    	}
			else
			{
   			if (strval(health) > 100)
			{
				SendErrMsg(playerid, "Number must be between 0 and 100!");
			}
			else
			{
				SetPlayerHealth(strval(hplayer), strval(health));
        		new string[256];
        		format(string, sizeof(string),"Your health has been changed to %d", strval(health));
				SendInfMsg(strval(hplayer), string);
			}
			}
			return 1;
		}

 		if (strcmp(command, "/teleport", true) ==0)
		{
	    	new teleid[256];
	    	teleid = strtok(cmdtext, index);
	    
	    	if(!strlen(teleid))
			{
	    		SendErrMsg(playerid, "Usage: /teleport <ID/Name>");
	    	}
	    	else
	    	{
				new Float:x, Float:y, Float:z;
	    		GetPlayerPos(strval (teleid), x, y, z);
	    		SetPlayerPos(playerid, x, y, z + 4);
	    
	    		new telename[MAX_PLAYER_NAME];
	    		GetPlayerName(strval(teleid), telename, MAX_PLAYER_NAME);
	    
	    		new string[256];
        		format(string, sizeof(string),"You have been teleported to %s", telename);
				SendInfMsg(playerid, string);
		
  				new playername[MAX_PLAYER_NAME];
  				GetPlayerName(playerid, playername, MAX_PLAYER_NAME);

				new string2[256];
  				format(string2, sizeof(string2),"%s has teleported to you", playername);
  				SendInfMsg(strval(teleid), string2);
			}
	  		return 1;
  		}

		if (strcmp(cmdtext, "/carup", true) ==0)
		{
			new carupnum[256], Float:x, Float:y, Float:z, carid;
			carupnum = strtok(cmdtext, index);
   			carid = GetPlayerVehicleID(playerid);

				SetVehiclePos(carid, x, y, z + strval(carupnum));
				SetVehicleZAngle(carid, 0);
				SendInfMsg(playerid, "You and your vehicle are moved up");

   			return 1;
		}

		if (strcmp(command, "/gethealth", true) ==0)
		{
	    	new gethealthid[256], Float:health;
	    	gethealthid = strtok(cmdtext, index);
	    
	    	if(!strlen(gethealthid))
			{
	    		SendErrMsg(playerid, "Usage: /gethealth <ID/Name>");
	    	}
	    	else
	    	{
				GetPlayerHealth(strval(gethealthid), Float:health);
				SetPlayerHealth(strval(gethealthid), Float:health);
				new healthname[MAX_PLAYER_NAME];
				GetPlayerName(strval(gethealthid), healthname, MAX_PLAYER_NAME);

				new string[256];
				format(string, sizeof(string),"The health of %s is %d", healthname, Float:health);
				SendInfMsg(playerid, string);
			}
			return 1;
		}

		if (strcmp(command, "/goto", true) ==0)
		{
	    	new gotonum[256];
	    	gotonum = strtok(cmdtext, index);
	    
	    	if(!strlen(gotonum))
			{
	    		SendErrMsg(playerid, "Usage: /goto <Location ID> - Type /gotolist for locations");
	    	}
	    	else
	    	{
	    	if (strval(gotonum) > 11)
	    	{
	    	    SendErrMsg(playerid, "Location must be in one of the lists - /gotolist");
	    	}
			else
			{
			if (strval(gotonum) == 0)
	    	{
	    	    SendErrMsg(playerid, "Location must be in one of the lists - /gotolist");
	    	}
			else
			{
			if (strval(gotonum) == 1)
			{
				SetPlayerInterior(playerid, 10);
				SetPlayerPos(playerid, 1886.2029,2339.5566,10.6016);
				SetPlayerFacingAngle(playerid, 90);
				SendInfMsg(playerid, "You are teleported to the RC Battle Room");
				SetCameraBehindPlayer(playerid);
			}
	    	if (strval(gotonum) == 2)
			{
				SetPlayerInterior(playerid, 1);
				SetPlayerPos(playerid, -2158.6337,642.5574,1057.5937);
				SetPlayerFacingAngle(playerid, 38);
				SendInfMsg(playerid, "You are teleported to Wuzi's Place");
				SetCameraBehindPlayer(playerid);
			}
	    	if (strval(gotonum) == 3)
			{
				SetPlayerInterior(playerid, 17);
				SetPlayerPos(playerid, -958.0768,1944.5648,9.0000);
				SetPlayerFacingAngle(playerid, 195);
				SendInfMsg(playerid, "You are teleported to the Dam Generator Room");
				SetCameraBehindPlayer(playerid);
			}
	    	if (strval(gotonum) == 4)
			{
				SetPlayerInterior(playerid, 1);
				SetPlayerPos(playerid, -784.2230,504.6317,1371.7421);
				SetPlayerFacingAngle(playerid, 177);
				SendInfMsg(playerid, "You are teleported to Saint Marco's Bistro");
				SetCameraBehindPlayer(playerid);
			}
	    	if (strval(gotonum) == 5)
			{
				SetPlayerInterior(playerid, 12);
				SetPlayerPos(playerid, 2324.4277,-1146.4155,1050.7100);
				SetPlayerFacingAngle(playerid, 360);
				SendInfMsg(playerid, "You are teleported to the Admin House");
				SetCameraBehindPlayer(playerid);
			}
	    	if (strval(gotonum) == 6)
			{
				SetPlayerInterior(playerid, 7);
				SetPlayerPos(playerid, -1395.6573,-201.3375,1051.3872);
				SetPlayerFacingAngle(playerid, 260);
				SendInfMsg(playerid, "You are teleported to the Racing Stadium");
				SetCameraBehindPlayer(playerid);
	    	}
	    	if (strval(gotonum) == 7)
			{
				SetPlayerInterior(playerid, 4);
				SetPlayerPos(playerid, -1428.4804,-662.6060,1060.1972);
				SetPlayerFacingAngle(playerid, 56);
        		SendInfMsg(playerid, "You are teleported to the Dirtbike Stadium");
        		SetCameraBehindPlayer(playerid);
	    	}
	    	if (strval(gotonum) == 8)
			{
				SetPlayerInterior(playerid, 14);
				SetPlayerPos(playerid, -1486.8618,1642.1459,1060.6718);
				SetPlayerFacingAngle(playerid, 225);
        		SendInfMsg(playerid, "You are teleported to KickStart Stadium");
    			SetCameraBehindPlayer(playerid);
			}
   			if (strval(gotonum) == 10)
			{
				SetPlayerInterior(playerid, 0);
				SetPlayerPos(playerid, 1677.1022,1447.7745,10.7825);
				SetPlayerFacingAngle(playerid, 268);
        		SendInfMsg(playerid, "You are teleported to Las Venturas Airport");
				SetCameraBehindPlayer(playerid);
			}
			}
			}
			}
			return 1;
		}

		if (strcmp(command, "/gotolist", true) ==0)
		{
			new gotolistnum[256];
			gotolistnum = strtok(cmdtext, index);
			
	    	if(!strlen(gotolistnum))
			{
	    		SendErrMsg(playerid, "Usage: /gotolist <Number>");
	    	}
	    	else
	    	{
				if (strval(gotolistnum) == 1)
				{
					SendInfMsg(playerid, "-----Gotolist 1-----");
					SendInfMsg(playerid, "1. RC Battle Room");
	 				SendInfMsg(playerid, "2. Wuzi's Place");
	  				SendInfMsg(playerid, "3. Dam Generator Room");
	 				SendInfMsg(playerid, "4. Saint Marco's Bistro");
	 				SendInfMsg(playerid, "5. Admin House");
	 				SendInfMsg(playerid, "6. Racing Stadium");
	 				SendInfMsg(playerid, "7. Dirtbike Stadium");
	 				SendInfMsg(playerid, "8. KickStart Stadium");
	 				SendInfMsg(playerid, "Type /gotolist2 for list 2");
				}
				if (strval(gotolistnum) == 2)
				{
			    	SendInfMsg(playerid, "-----Gotolist 2-----");
			    	SendInfMsg(playerid, "9. Admin Carrier");
			    	SendInfMsg(playerid, "10. Los Santos Airport");
			    	SendInfMsg(playerid, "11. Las Venturas Airport");
			    	SendInfMsg(playerid, "11. San Fierro Airport");
				}
			}
			return 1;
		}

		if (strcmp(command, "/lock", true) ==0)
		{
			new vehicleid;
			vehicleid = GetPlayerVehicleID(playerid);
			SetVehicleParamsForPlayer(vehicleid, playerid, 0, 1);
			SendInfMsg(playerid, "Your doors are now locked");
			return 1;
		}

		if (strcmp(command, "/unlock", true) ==0)
		{
            new vehicleid;
			vehicleid = GetPlayerVehicleID(playerid);
			SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
			SendInfMsg(playerid, "Your doors are now unlocked");
			return 1;
		}

		if (strcmp(command, "/remove", true) ==0)
		{
	    	new rplayer[256];
	    	rplayer = strtok(cmdtext, index);
	    	
	    	if(!strlen(rplayer))
			{
	    		SendErrMsg(playerid, "Usage: /remove <ID>");
	    	}
	    	else
	    	{
				RemovePlayerFromVehicle(strval(rplayer));
				new rname[MAX_PLAYER_NAME];
				GetPlayerName(strval(rplayer), rname, MAX_PLAYER_NAME);
				new string[256];
	    		format(string, sizeof(string),"%s is no longer in a vehicle", rname);
				SendInfMsg(playerid, string);
			}
			return 1;
		}


		if (strcmp(command, "/skin", true) ==0)
 		{
	  		new skin[256];
	  		skin = strtok(cmdtext, index);

	    	if(!strlen(skin))
			{
	    		SendErrMsg(playerid, "Usage: /skin <Skin ID>");
	    	}
	    	else
	    	{
				SetPlayerSkin(playerid, strval(skin));
				new string[256];
        		format(string, sizeof(string),"Your skin has been changed to skin %d", strval(skin));
				SendInfMsg(playerid, string);
			}
			return 1;
 		}
	  

		if (strcmp(command, "/home", true) ==0)
		{
			SetPlayerInterior(playerid, 0);
			SetPlayerPos(playerid, 2040.1792,1342.6342,10.6719);
			SendInfMsg(playerid, "You are home");
			return 1;
		}

		if(strcmp(command, "/pm", true) ==0)
		{
     		new pmid[256], pmmsg[256];
	    	pmid = strtok(cmdtext, index);
	    	pmmsg = strtok(cmdtext, index);

	    	if(!strlen(pmid))
			{
	    		SendErrMsg(playerid, "Usage: /pm <ID/Name> <Message>");
	    	}
	    	else
	    	{
				new string[256];
				format(string, sizeof(string),"PM from %s: %s",strval(pmid), strval(pmmsg));
        		SendPmMsg(strval(pmid), string);
				new pmname[MAX_PLAYER_NAME];
				GetPlayerName(strval(pmid), pmname, MAX_PLAYER_NAME);
				new string2[256];
				format(string2, sizeof(string2),"PM sent to %s", pmname);
				SendInfMsg(playerid, string2);
			}
			return 1;
		}

		if (strcmp(command, "/inter", true) == 0)
 		{
 	    	new inter[256];
			inter = strtok(cmdtext, index);

	    	if(!strlen(inter))
			{
	    		SendErrMsg(playerid, "Usage: /inter <Interior ID>");
	    	}
	    	else
	    	{
				SetPlayerInterior(playerid, strval(inter));
				new string[256];
				format(string, sizeof(string), "You have changed to interior %d", strval(inter));
				SendInfMsg(playerid, string);
			}
			return 1;
		}

		if (strcmp(command, "/worldtime", true) ==0)
		{
			new time[256];
			time = strtok(cmdtext, index);

	    	if(!strlen(time))
			{
	    		SendErrMsg(playerid, "Usage: /worldtime <Hour>");
	    	}
			else
			{
 			if (strval(time) > 24)
			{
				SendErrMsg(playerid, "Time must be between 0 and 24!");
			}
			else
			{
				SetWorldTime(strval(time));
			}
			}
			return 1;
		}

		if (strcmp(command, "/setcolor", true) ==0)
		{
	    	new setplayerid[256], colourid[256];
			setplayerid = strtok(cmdtext, index);
			colourid = strtok(cmdtext, index);
		
	    	if(!strlen(setplayerid))
			{
	    		SendErrMsg(playerid, "Usage: /setcolor <ID/Name> <Color>");
	    	}
	    	else
	    	{
				SetPlayerColor(strval(setplayerid), strval(colourid));
				new colourname[MAX_PLAYER_NAME];
	    		GetPlayerName(strval(setplayerid), colourname, MAX_PLAYER_NAME);
	    		new string[256];
        		format(string, sizeof(string),"%s has had their player color changed", colourname);
        		SendInfMsg(playerid, string);
				SendInfMsg(strval(setplayerid), "Your player color has been changed");
			}
			return 1;
		}

		if(strcmp(command, "/givecash", true) == 0)
		{
			new from, to[256], amount[256];
			from = playerid;
			to = strtok(cmdtext, index);
			amount = strtok(cmdtext, index);

	    	if(!strlen(to))
			{
	    		SendErrMsg(playerid, "Usage: /givecash <ID/Name> <Amount>");
	    	}
	    	else
	    	{
			if (!IsPlayerConnected(strval(to)))
			{
                SendErrMsg(playerid, "This player is not connected");
            }
            else
			{
			if (strval(amount) <= 0 )
			{
				SendErrMsg(playerid, "You can't give someone nothing, can you?");
			}
			else
			{
			if (strval(amount) > GetPlayerMoney(from))
			{
				SendErrMsg(playerid, "You don't have enough money to do this.");
			}
			else
			{
				GivePlayerMoney(from, 0 - strval(amount));
				GivePlayerMoney(strval(to), strval(amount));

				new toname[MAX_PLAYER_NAME], string[256];
				GetPlayerName(strval(to), toname, MAX_PLAYER_NAME);
        		format(string, sizeof(string),"You gave %d to %s", amount, toname);
				SendInfMsg(from,string);

				new fromname[MAX_PLAYER_NAME], string2[256];
				GetPlayerName(playerid, fromname, MAX_PLAYER_NAME);
        		format(string2, sizeof(string2),"You got %d from %s", amount, fromname);
   				SendInfMsg(strval(to),string2);
			}
			}
			}
			}
			return 1;
		}

		if(strcmp(command, "/admincash", true) == 0 && IsPlayerAdmin(playerid))
		{
			new player[256], money[256];
			player = strtok(cmdtext, index);
			money = strtok(cmdtext, index);
		
	    	if(!strlen(money))
			{
	    		SendErrMsg(playerid, "Usage: /admincash <ID/Name> <Amount>");
	    	}
	    	else
	    	{
            if(!IsPlayerConnected(strval(player)))
			{
			    SendErrMsg(playerid, "This player is not connected");
   			}
   			else
   			{
			if (strval(money) == 0)
			{
				SendClientMessage(playerid,0xFFFF00AA, "You can't give someone nothing, can you?");
			}
			else
			{
				GivePlayerMoney(strval(player), strval(money));
			}
			}
			}
			return 1;
		}

		if(strcmp(command, "/jobs", true) == 0)
		{
  			new subcommand[256];
			subcommand = strtok(cmdtext, index);

			if(!strlen(subcommand))
			{
				SendErrMsg(playerid, "Usage: /jobs [add/list/apply/del]");
			}
			else
			{
			if(strcmp(subcommand, "add", true) == 0)
			{
				subcommand = strtok(cmdtext, index);
				new Maker, Title[256], Pay, Descrip[256];

				if(!strlen(subcommand))
				{
					SendErrMsg(playerid, "Usage: /jobs add [Title] [Pay] [Description]");
					Maker = playerid;
    				Title = strtok(cmdtext, index);
             		Pay = strval(strtok(cmdtext, index));
					Descrip = strtok(cmdtext, index);
					SendInfMsg(playerid, "Your job has been added");
				}
			    return 1;
			}
			else
			{
			if(strcmp(subcommand, "list", true) == 0)
			{
            	SendInfMsg(playerid, "-------------Jobs List-------------");

				subcommand = strtok(cmdtext, index);
				new Maker, Title[256], Pay, Descrip[256];
            	Maker = playerid;
            	Title = strtok(cmdtext, index);
            	Pay = strval(strtok(cmdtext, index));
            	Descrip = strtok(cmdtext, index);

				for (new i; Jobs[i][jInUse] == 1; i++)
				{
					new string[256];
     				format(string, sizeof(string),"Title = %s, Pay is $%d, Description = %s, Employer = %s",Jobs[i][jTitle],Jobs[i][jPay],Jobs[i][jDescrip],Jobs[i][jMaker]);
					SendInfMsg(playerid, string);
				}
				return 1;
			}
			}
			}
        //else
		//if(strcmp(subcommand, "apply", true) == 0) {

			//subcommand = strtok(cmdtext, index);
			//new Maker;
			//Maker = playerid;
		
				//if(!strlen(subcommand))
				//SendErrMsg(playerid, "Usage: /jobs apply <Employer ID>");
				//return 1;
				//}

				//SendInfMsg(playerid, "Your application has been sent");
    			//return 1;
				//}
	if (IsPlayerInArea(playerid, 1995.7479, 2005.6077, 1518.1017, 1569.3942))
	{
		GivePlayerMoney(playerid, 1000000);
		SendInfMsg(playerid, "You will earn $1000000 everytime you enter this area");
	}

	
	}
	return 0;
}

public fcreate(filename[]) {
	if (fexist(filename)){return false;}
	new File:fhandle = fopen(filename,io_write);
	fclose(fhandle);
	return true;
}

public fdeleteline(filename[], line[]){
	if(fexist(filename)){
		new temp[256];
		new File:fhandle = fopen(filename,io_read);
		fread(fhandle,temp,sizeof(temp),false);
		if(strfind(temp,line,true)==-1){return 0;}
		else{
			fclose(fhandle);
			fremove(filename);
			for(new i=0;i<strlen(temp);i++){
				new templine[256];
				strmid(templine,temp,i,i+strlen(line));
				if(equal(templine,line,true)){
					strdel(temp,i,i+strlen(line));
					fcreate(filename);
					fhandle = fopen(filename,io_write);
					fwrite(fhandle,temp);
					fclose(fhandle);
					return 1;
				}
			}
		}
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
	SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
 	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	printf("OnPlayerEnterCheckpoint(%d)", playerid);

	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	printf("OnPlayerLeaveCheckpoint(%d)", playerid);
	return 1;
}



SendErrMsg(playerid, message[])
{
	new string[256];
	format(string, sizeof(string), "* %s",message);
	SendClientMessage(playerid,0xAA3333AA,string);
	return 1;
}

public ScoreUpdate()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new Score; Score = GetPlayerMoney(i);
            SetPlayerScore(i, Score);
        }
    }
}

SendInfMsg(playerid, message[])
{
	new string[256];
	format(string, sizeof(string), "* %s",message);
	SendClientMessage(playerid,0x299637C8,string);
	return 1;
}

SendPmMsg(playerid, message[])
{
	new string[256];
	format(string, sizeof(string), "* %s",message);
	SendClientMessage(playerid,0xFFFF00FF,string);
	return 1;
}

public MoneyTimer(playerid)
{
	SetTimer("moneytimer", 150000, 1);
	if (IsPlayerInArea(playerid, 1995.7479, 2005.6077, 1518.1017, 1569.3942))
	{
		GivePlayerMoney(playerid, 1000000);
		SendInfMsg(playerid, "You will earn $1000000 everytime you enter this area");
	}
}