All pastes #254456 Raw Edit

Ali2

public text v1 · immutable
#254456 ·published 2006-11-21 21:56 UTC
rendered paste body
#include <a_samp>


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

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

public OnGameModeInit()
{
	print("GameModeInit()");
	SetGameModeText("Code Testing");
	new LoadSkins[] = {
		0, 9, 10, 11, 12, 13, 14, 15,
		16, 17, 18, 19, 20, 21, 22,
		23, 24, 25, 26, 27, 28, 29,
		30, 31, 32, 33, 34, 35, 36,
		37, 38, 38, 39, 40, 41, 43,
		44, 45, 46, 47, 48, 49, 50,
		51, 52, 53, 54, 55, 56, 57,
		58, 59, 60, 61, 62, 63, 64,
		66, 67, 68, 69, 70, 71, 72,
		73, 75, 76, 77, 78, 79, 80,
		81, 82, 83, 84, 85, 87, 88,
		89, 90, 91, 92, 93, 94, 95,
		96, 97, 98, 99, 100, 101,
		102, 103, 104, 105, 106, 107,
		108, 109, 110, 111, 112, 113,
		114, 115, 116, 117
	};
	
	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



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

    return 1;
}

public OnPlayerRequestClass(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);
	return 1;
}

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

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

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[])
{
    SetTimer("ScoreUpdate", 1000, 1);

	new command[256], index;
	command = strtok(cmdtext, index);

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

		if (to < 0 || amount <= 0 || !IsPlayerConnected(to))
		{
			SendClientMessage(playerid,0xAA3333AA,"Usage: /givecash <ID> <Amount>");
			return 1;
		}

		if (amount > GetPlayerMoney(from))
		{
			SendClientMessage(playerid,0xAA3333AA,"You dont have enough money to do this.");
			return 1;
		}

		GivePlayerMoney(from, 0 - amount);
		GivePlayerMoney(to, amount);
		SendClientMessage(from,0xFFFF00AA,"You gave money away to someone");
		SendClientMessage(to,0xFFFF00AA,"You got money from someone");
        return 1;
	}

	if(strcmp(command, "/admincash", true) == 0 && IsPlayerAdmin(playerid))
	{
		new money;
		money = strval(strtok(cmdtext, index));
		
		if (money == 0)
		{
			SendClientMessage(playerid,0xFFFF00AA, "STUPID FUCK HOW AM I SUPPOSED TO GIVE YOU NOTHING");
		}
        GivePlayerMoney(playerid, 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]");
		return 1;
		}
		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;
				return 1;
				}
				if(!strlen(subcommand)) {
				SendErrMsg(playerid, "Usage: /jobs add [Title] [Pay] [Description]");
				Title[1] = strval(strtok(cmdtext, index));
                return 1;
				}
                if(!strlen(subcommand)) {
				SendErrMsg(playerid, "Usage: /jobs add [Title] [Pay] [Description]");
				Pay = strval(strtok(cmdtext, index));
                return 1;
				}
                if(!strlen(subcommand)) {
				SendErrMsg(playerid, "Usage: /jobs add [Title] [Pay] [Description]");
				Descrip[1] = strval(strtok(cmdtext, index));
                return 1;
				}
				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[10] = strval(strtok(cmdtext, index));
            Pay = strval(strtok(cmdtext, index));
            Descrip[10] = strval(strtok(cmdtext, index));

			for (new i; strlen(Jobs[i][jTitle][0]) > 0; i++)
            for (new i; strlen(Jobs[i][jPay][0]) > 0; i++)
            for (new i; strlen(Jobs[i][jDescrip][0]) > 0; i++)
            for (new i; strlen(Jobs[i][jMaker][0]) > 0; i++)
			{
  			new string[256];
	  		format(string, sizeof(string),"Title = %s, Pay is $%d, Description = %s,Maker = %d",Jobs[i][jTitle],Jobs[i][jPay],Jobs[i][jDescrip],Jobs[i][jMaker]);
			
   			SendInfMsg(playerid, string);
			}

		return 1;
		}

		return 1;
	}

	return 1;
}

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

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')){index++;}
    new offset = index,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 set(dest[],source[])
{
	new count = strlen(source);
	new i=0;
	for (i=0;i<count;i++) {
		dest[i]=source[i];
	}
	dest[count]=0;
}

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