All pastes #624958 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-18 17:31 UTC
rendered paste body
#include <a_samp>
#include <core>
#include <float>

#define CHECKPOINT_NONE 0 //No Checkpoint Status
#define CP_LVRBDONUTS 1 //Las Venturas Rusty Brown's Donuts Location
#define CP_RBDONUTSINTERIOR 3 //Rusty Brown's Interior

new gPlayerClass[MAX_PLAYERS];
new gClassSelection[MAX_PLAYERS];
new gPlayerCheckpointStatus[MAX_PLAYERS];
new gSpawnMoneyDoOnce[MAX_PLAYERS];
new gPlayerColorArray[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};

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" [LVRPG]LVPD Los Santos RPG Filterscript by TheShehanigan");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("[LVRPG]LVPD Los Santos RPG Gamemode by TheShehanigan");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript

//-------------------------------------------------------- Basic Commands and Options -------------------------------------------------------

	SetGameModeText("[LVRPG]LVPD's Los Santos RPG"); //This is the Gamemode name show on the Server Selection Screen
	EnableTirePopping(1); //Enables tires popping with gunfire
	EnableZoneNames(1); //Enables zones showing their names
	AllowInteriorWeapons(1); //Enables weapon use in interiors
	ShowPlayerMarkers(1); //Hides blips
	ShowNameTags(1); //Shows name tags over player's heads
	
//----------------------------------------------------------------- Skin and Role List -----------------------------------------------------

	AddPlayerClass(186, 2220.8135, -1139.1678, 1027.7969, 180.5835, 0, 0, 0, 0, 0, 0); // Brown Suit Man Civilian - Civilian Spawn Point
 	AddPlayerClass(56, 2220.8135, -1139.1678, 1027.7969, 180.5835, 0, 0, 0, 0, 0, 0); // Green Shirt, Denim Skirt Girl Civilian - Civilian Spawn Point
 	AddPlayerClass(45, 608.5903, -1879.2307, 4.1443, 172.8595, 0, 0, 0, 0, 0, 0); // Green Water Pants Beach Man - Beach Spawn Point
	
//------------------------------------------------ Car Spawn List: 03 Total Models, 007 Total Spawns --------------------------------------

	AddStaticVehicleEx(432, 277.6690, 1955.8132, 17.6485, 272.4355, -1, -1, 300); // Rhino #1 at Hangar #1, Area 69
	AddStaticVehicleEx(432, 275.9400, 2023.4467, 17.6535, 270.5404, -1, -1, 300); // Rhino #2 at Hangar #3 Area 69
 	AddStaticVehicleEx(425, 208.2863, 1960.1870, 17.6587, 302.3892, -1, -1, 300); // Hunter #1 at Area 69
	AddStaticVehicleEx(425, 204.1164, 2020.3153, 17.6535, 290.6042, -1, -1, 300); // Hunter #2 at Area 69
 	AddStaticVehicleEx(520, -1271.6094, 497.0687, 18.9641, 44.5926, -1, -1, 300); // Hydra #1 at Aircraft Carrier in Easter Basin, San Fierro
    AddStaticVehicleEx(520, -1294.5513, 493.0646, 18.9647, 49.8889, -1, -1, 300); // Hydra #2 at Aircraft Carrier in Easter Basin, San Fierro
    AddStaticVehicleEx(520, -1421.5414, 493.1858, 18.9621, 50.2000, -1, -1, 300); // Hydra #3 at Aircraft Carrier in Easter Basin, San Fierro
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	PlayerClassMemoryAllocator(playerid, classid);
	SetPlayerFacingAngle(playerid, 50.1425); //This is the code which sets up the Player Request. **ROLE & TEAMS NEED TO BE ADDED*
	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 OnPlayerRequestSpawn(playerid)
{
	if (gClassSelection[playerid] == 1)
	{
	SetPlayerInterior(playerid, 15);
	return 1;
	}
	else
	{
	return 1;
	}
}

public OnPlayerConnect(playerid)
{
	GameTextForPlayer(playerid,"~w~[LVRPG]~b~LVPD's ~r~Los Santos RPG~n~ ~g~By TheShehanigan", 4000, 1);
	SetPlayerColor(playerid, gPlayerColorArray[playerid]);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(gSpawnMoneyDoOnce[playerid] == 0) //This is the script which sets Pocket Money for the Server
	{
	    GivePlayerMoney(playerid, 2500);
	    gSpawnMoneyDoOnce[playerid]= 1;
	    return 1;
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
	return 1;
}
public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

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

    if (strcmp(command, "/kill", true) == 0) //Kill Command
    {
    	SetPlayerHealth(playerid, 0);
    	return 1;
   	}
   	if (strcmp(command, "/iamthearmy", true) == 0) //Army Teleporter
   	{
   		SetPlayerPos(playerid, 346.1250, 2025.1053, 22.6406);
   	    return 1;
    }
    if(strcmp(command, "/me", true) ==0) //Me Command
    {
        new tmp[256];
		tmp = strrest(cmdtext, index);
		if(!strlen(tmp))
		{
		    SendClientMessage(playerid,0xAA3333AA,"Usage: /me <Actions");
		    return 1;
		}
		new pname[24];
		GetPlayerName(playerid, pname, 24);
		format(tmp,256,"%s%s", pname, tmp);
		SendClientMessageToAll(GetPlayerColor(playerid), tmp);
		return 1;
	}
    return 1;
}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

//--------------------------------------------------------- Functions and Other Useful Snippets --------------------------------------------

stock PlayerClassMemoryAllocator(playerid, classid)
{
	if (classid == 0 || classid == 1)
	{
	    gClassSelection[playerid] = 1;
	}
	else
	{
	    gClassSelection[playerid] = 0;
	}
}

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

strrest(const string[], index)
{
	new length = strlen(string);

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