All pastes #895118 Raw Edit

Untitled

public text v1 · immutable
·published 2008-02-07 16:04 UTC
rendered paste body
#include <a_samp>//This is used for all the native functions which you see on the right tab.
#pragma tabsize 0//This can be used to take out "Loose Indentation" warnings. But it is always recommended to have perfect indentation!

#define FILTERSCRIPT//This is now making it be defined as a filterscript.

#if defined FILTERSCRIPT//This is doing an IF you defined it as a filterscript, run that.

//Forward for timer function
forward Advert();
//Part 3: Go to line 247

public OnFilterScriptInit()//This is called when the filterscript loads
{
	print("\n--------------------------------------");
	print(" Woot my fs test yoke");//This makes these words print into your SA-MP server log.
	print("--------------------------------------\n");
	//Example: Im not sure what these are but I was originally making this compile for someone, but decided to make it into a tutorial, this is how objects can be created with a simple filterscript!
	//These are the createobjects, they will be created when the filterscript is unloaded!
   CreateObject(1308, 543.05, 1893.26, 36.00, 0.00, 0.00, 0.00);
   CreateObject(1308, 551.65, 1885.08, 36.00, 0.00, 0.00, 0.00);
   CreateObject(3277, 237.68, 1696.88, 22.38, 0.00, 0.00, 0.00);
   CreateObject(16209, 205.49, 1730.35, 17.83, 0.00, 0.00, 0.00);
   CreateObject(16293, 238.07, 1697.55, 21.63, 0.00, 0.00, 0.00);
   CreateObject(16293, -209.16, 1783.14, 100.00, 0.00, 0.00, 0.00);
   CreateObject(16323, 199.34, 1943.88, 18.20, 0.00, 0.00, 0.00);
   CreateObject(3244, -365.05, 1754.59, 42.59, 0.00, 0.00, -38.50);
   CreateObject(3244, -213.00, 1753.78, 96.00, 0.00, 0.00, 0.00);
   CreateObject(3366, 276.66, 1989.55, 16.63, 180.00, 0.00, -180.00);
   CreateObject(3366, -185.94, 1777.96, 97.00, 0.00, 0.00, 0.00);
   CreateObject(16713, -125.52, 1904.19, 13.89, 0.00, 0.00, 0.00);
   CreateObject(16713, -239.04, 1773.47, 96.00, 0.00, 0.00, 0.00);
   CreateObject(3277, 15.60, 1719.17, 22.38, 0.00, 0.00, 0.00);
   CreateObject(3277, -199.61, 1799.34, 100.00, 0.00, 0.00, 0.00);
   CreateObject(3267, -199.40, 1799.37, 100.00, 0.00, 0.00, 0.00);
   CreateObject(3279, 267.06, 1895.30, 16.82, 0.00, 0.00, 0.00);
   CreateObject(3279, -225.01, 1801.33, 102.00, 0.00, 0.00, 0.00);
   CreateObject(3279, -188.62, 1759.49, 98.00, 0.00, 0.00, 0.00);
   CreateObject(16146, -97.23, 1373.20, 12.41, 0.00, 0.00, 170.00);
   CreateObject(16778, -79.94, 1385.59, 9.00, 0.00, 0.00, 170.00);
   CreateObject(16778, -198.67, 1478.31, 72.00, 0.00, 0.00, 0.00);
   CreateObject(16781, -144.05, 1227.30, 18.90, 0.00, 0.00, 0.00);
   CreateObject(9939, -1951.69, 660.02, 89.51, 0.00, 0.00, 0.00);
   CreateObject(9939, -974.47, 652.17, 16.00, 0.00, 0.00, 0.00);
   //Lets make a small advertisment to go to our site, ill use my site as an example.
   SetTimer("Advert",430000,1);//This will make an advert appear every several minites. For Part 2: go to line 9.Part 3: Go to line 247!
	
	return 1;
}

public OnFilterScriptExit()//This is called when the filterscript is unloaded
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript<< If you are defining this as a filterscript, dont use these lines.
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)//This is called when a player connects
{//Example: This will send a simple connect message!
new string[256];
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"%s has joined the server!",playername,string);
SendClientMessageToAll(0xAFAFAFAA,string);
//There, its that easy, the same can be done for Disconnecting players!
	return 1;
}

public OnPlayerDisconnect(playerid, reason)//This is called when a player leaves the server
{
	return 1;
}

public OnPlayerSpawn(playerid)//This is called when a player spawns.
{//Example: Lets say we are making a simple fun deathmatch, lets set the players health to 100 and his armour to 100 and give him a deagle!
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerWeapon(playerid,24,140);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)//This is called when a player die.
{//Example: Lets add some points to the player score, lets say 1 point for 1 kill!
SetPlayerScore(playerid,GetPlayerScore(playerid)+1);//This sets the players score to one, by getting his old score and adding 1 to it!
//Lets also add a custom message for the player when he dies!
GameTextForPlayer(playerid,"You got owned",3000,3);
//=-===-----------------------------------------------
SendDeathMessage(killerid,playerid,reason);//Example: Lets also add a death message that appears on the right of the screen.
	return 1;
}

public OnVehicleSpawn(vehicleid)//This is called when a vehicle spawns
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)//This is called when a vehicle explodes.
{
	return 1;
}

public OnPlayerText(playerid, text[])//IMPORTANT: This is called when a player types something into the chat box.
{//Example: This will send a message to the player, of the message he sent, this is a good example for strings!
new string[256];
format(string,sizeof(string),"You have sent the message %s",text,string);//We use this to save what will be sent into the string.
SendClientMessage(playerid,0x33AA33AA,string);//This time we put string at the end instead of the message, now it will display whats in format.
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])//This is called when a player /pm someone.
{
//Example: This will send a message to the player confirming a message has been sent!
SendClientMessage(playerid,0x33AA33AA,"Your message has been sent!");
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])//This is called when a player uses a / in the chat box for a command.
{
	if (strcmp("/health", cmdtext, true, 10) == 0)//This will be called when a player types /health.
	{
		SetPlayerHealth(playerid,100);//This will set the players health to 100!
		return 1;
	}
	
	if(strcmp(cmdtext,"/healall",true)==0)
	{
	if(IsPlayerAdmin(playerid))//Simple Admin Command to heal everyone
	{
	SendClientMessageToAll(0xAA3333AA,"Admin has healed everyone!");
	for(new i = 0; i < MAX_PLAYERS; i++)//This makes it so that it runs a varible so when you use i instead of playerid, it will do the action to everyone in the server.
	{
	SetPlayerHealth(i,100);//This will heal all players!
	}
	}
	return 1;
	}
	
	
	return 0;
}

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[])//This is called when someone has used an RCON cmd.
{//Example: Lets make it print a simple message that someone used an rcom command into the server log.
print("An RCON command has been used!");
	return 1;
}

public OnObjectMoved(objectid)//This is called when an Object has been moved.
{
	return 1;
}

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

public OnPlayerPickUpPickup(playerid, pickupid)//This is called when someone picks up a Pickup
{
	return 1;
}

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

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public Advert()
{//Part 3: Finishing the advert
SendClientMessageToAll(0x99FFFFAA,"Try our site at www.domination-gaming.com");
//That will send a message based on how long we set the timer to.
   return 1;
}