All pastes #1927830 Raw Edit

Gara a circuito

public text v1 · immutable
#1927830 ·published 2010-08-28 17:14 UTC
rendered paste body
#include <a_samp>

//---------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------
forward ccd1();
forward ccd2();
forward ccd3();
forward ccd4();
forward Checkpoint1();
forward Checkpoint2();
forward Checkpoint3();
forward Checkpoint4();
new Checkpointf1[MAX_PLAYERS];
new Checkpointf1a[MAX_PLAYERS];
new Checkpointf1b[MAX_PLAYERS];
//------------------------------------------------------------------------------

//---- COLORI ------------------------------------------------------------------
#define ROSSO 0xFF0000AA
#define ROSA 0xFF8080AA
#define NERO 0x000000AA
#define VERDE 0x00FF00AA
#define AZZURRO 0x0080FFAA
#define BLU 0x0000FFAA
#define ARANCIONE 0xFF8000AA
#define GRIGIO 0xC0C0C0AA
#define GIALLO_CHIARO 0xFFFF80AA
#define MARRONE 0x400000AA
#define VIOLA 0x400040AA
#define MARRONCINO 0x808000AA
#define VERDE_SCURO 0x008000AA
#define BIANCO 0xFFFFFFAA
#define BLU_CHIARO 0x00FFFFAA
#define ROSSO_SCURO 0x800000AA
//---------------------------------------------------------------------------------------------------------------------------------------------------------


public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	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 OnPlayerCommandText(playerid, cmdtext[])
{
//------------------------------------------------------------------------------
new PlayerName[MAX_PLAYER_NAME];
new string[256];
//---- CIRCUITO F1 -------------------------------------------------------------
if (strcmp("/f1", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid, -571.16,-0.55,284.38);
		SetPlayerInterior(playerid, 1);
		SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid,100);
		ResetPlayerWeapons(playerid);
		GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[TELE] %s è alla al circuito di F1 (/f1).", PlayerName);
        SendClientMessageToAll(VERDE, string);
        SendClientMessage(playerid, ARANCIONE, "[F1] Spawna un veicolo (/v) e usa /go per startare la corsa.");
        return 1;
        }
if(strcmp("/go", cmdtext, true) == 0)
{
SendClientMessageToAll(ARANCIONE,"[INFO] Sta per iniziare la gara nel circuito di F1 (3 giri)!");
Checkpoint1();
return 1;
}
//------------------------------------------------------------------------------
return 0;
}

//----- CHECKPOINT -------------------------------------------------------------
public OnPlayerEnterCheckpoint(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
		{
if(Checkpointf1[i] == 1)
{
GameTextForPlayer(playerid,"~s~SEI PRIMO!", 2000, 4);
DisablePlayerCheckpoint(i);
SetTimerEx("Checkpoint3",22000,0,"i",i, false);
}
if(Checkpointf1a[i] == 1)
{
GameTextForPlayer(playerid,"~r~ULTIMO GIRO!", 2000, 4);
DisablePlayerCheckpoint(i);
SetTimerEx("Checkpoint4",22000,0,"i",i, false);
}
if(Checkpointf1b[i] == 1)
{
new PlayerName[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string,sizeof(string),"[F1] %s vince la gara! (/f1)", PlayerName);
SendClientMessageToAll(ARANCIONE,string);
GameTextForPlayer(playerid,"~r~HAI VINTO!", 3000, 4);
GivePlayerMoney(playerid, 10000);
DisablePlayerCheckpoint(i);
SetTimerEx("Checkpointdis",23000,0,"i",i, false);
}
}
}
return 1;
}

//------------------------------------------------------------------------------
public Checkpoint1() {
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
		{
ccd1();
SetTimerEx("Checkpoint2",24000,0,"i",i, false);
}
}
return 1;
}
//-----
public Checkpoint2() {
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
		{
		   Checkpointf1[i] = 1;
SetPlayerCheckpoint(i,-563.8751,-11.0554,282.3867, 25);
}
}
return 1;
}
//----
public Checkpoint3() {
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
		{
		   Checkpointf1a[i] = 1;
SetPlayerCheckpoint(i,-563.8751,-11.0554,282.3867, 25);
}
}
return 1;
}
//----
public Checkpoint4() {
for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
		{
		   Checkpointf1b[i] = 1;
SetPlayerCheckpoint(i,-563.8751,-11.0554,282.3867, 25);
}
}
return 1;
}
//------------------------------------------------------------------------------
//-----------------------------------------------------------------------------//
public ccd1() {
for(new i = 0; i < MAX_PLAYERS; i++)    {
new Float:x, Float:y, Float:z;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,7.0,x,y,z))
{
GameTextForAll("~r~tre", 500, 4);
TogglePlayerControllable(i,false);
PlayerPlaySound(i,1056, 0.0, 0.0, 0.0);
SetTimer("ccd2", 900, 0);
}
}
}

public ccd2() {
for(new i = 0; i < MAX_PLAYERS; i++)    {
new Float:x, Float:y, Float:z;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,7.0,x,y,z))
{
PlayerPlaySound(i,1056, 0.0, 0.0, 0.0);
TogglePlayerControllable(i,false);
GameTextForAll("~y~due", 500, 4);
SetTimer("ccd3", 900, 0);
}
}
}

public ccd3() {
for(new i = 0; i < MAX_PLAYERS; i++)    {
new Float:x, Float:y, Float:z;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,7.0,x,y,z))
{
PlayerPlaySound(i,1056, 0.0, 0.0, 0.0);
TogglePlayerControllable(i,false);
GameTextForAll("~g~uno", 500, 4);
SetTimer("ccd4", 900, 0);
}
}
}

public ccd4() {
for(new i = 0; i < MAX_PLAYERS; i++)    {
new Float:x, Float:y, Float:z;
GetPlayerPos(i,x,y,z);
if(IsPlayerInRangeOfPoint(i,7.0,x,y,z))
{
PlayerPlaySound(i,1057, 0.0, 0.0, 0.0);
TogglePlayerControllable(i,true);
GameTextForAll("~b~!! Via !!", 1000, 4);
}
}
}
//------------------------------------------------------------------------------