Car Crash system
#1

I want to make a Car Crash system
like this: http://www.youtube.com/watch?v=ROtK_HYHO7g#

Here is the script:
Код:
#include <a_samp>
#define FILTERSCRIPT

#define COLOR 0xC2A2DAAA

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward Velocidad(playerid);
forward Check(playerid);
forward Rojo(playerid);
forward Camara(playerid);

new Timer[MAX_PLAYERS];
new TRojo[MAX_PLAYERS];
new TCamara[MAX_PLAYERS];
new Choque[MAX_PLAYERS];
new Si[MAX_PLAYERS];
new Text: FlashR;
enum Info
{
	Manejando,
};
new Informacion[MAX_PLAYERS][Info];

public OnPlayerSpawn(playerid)
{
	FlashR = TextDrawCreate(1.000000,1.000000,"_");
	TextDrawTextSize(FlashR,640.000000,10.000000);
	TextDrawLetterSize(FlashR,3.600000,47.600010);
	TextDrawUseBox(FlashR,1);
	TextDrawAlignment(FlashR,0);
	TextDrawFont(FlashR,3);
	TextDrawSetOutline(FlashR,1);
	TextDrawSetProportional(FlashR,1);
	TextDrawSetShadow(FlashR,1);
	TextDrawBackgroundColor(FlashR,0xD20000FF);
	TextDrawColor(FlashR,0xD20000FF);
	TextDrawBoxColor(FlashR,0xD20000FF);
	Timer[playerid] = SetTimerEx("Check", 100, 1, "i", playerid);
	Informacion[playerid][Manejando] = 0;
}

public OnPlayerDisconnect(playerid)
{
	KillTimer(Timer[playerid]);
    KillTimer(Choque[playerid]);
    Informacion[playerid][Manejando] = 0;
	return 1;
}

public Velocidad(playerid)
{
	new Float:Vx, Float:Vy, Float:Vz;
	if(IsPlayerInAnyVehicle(playerid) && Informacion[playerid][Manejando])
	{
		GetVehicleVelocity(GetPlayerVehicleID(playerid), Vx, Vy, Vz);
		if(Vx > -0.1 && Vx < 0.1 && Vy > -0.1 && Vy < 0.1)
		{
		    new Float:Vida;
		    GetPlayerHealth(playerid, Vida);
		    SetPlayerHealth(playerid, Vida-11.0);
		    SetPlayerDrunkLevel(playerid, 500000);
		    TextDrawShowForPlayer(playerid, FlashR);
		    Informacion[playerid][Manejando] = 0;
	  		new String[256];
			new Nombre[MAX_PLAYER_NAME];
		    GetPlayerName(playerid,Nombre,sizeof(Nombre));
    		format(String, sizeof(String), "* %s has been in a collision.", Nombre);
    		ProxDetector(30.0, playerid, String, COLOR,COLOR,COLOR,COLOR,COLOR);
			TRojo[playerid] = SetTimerEx("Rojo", 250, 1, "i", playerid);
			TCamara[playerid] = SetTimerEx("Camara", 10000, 1, "i", playerid);
		}
	}
	return 1;
}

public Rojo(playerid)
{
	TextDrawHideForPlayer(playerid, FlashR);
	return 1;
}

public Camara(playerid)
{
	KillTimer(TCamara[playerid]);
	SetPlayerDrunkLevel(playerid, 0);
	return 1;
}

public Check(playerid)
{
	new Float:Cx, Float:Cy, Float:Cz;
	if(IsPlayerInAnyVehicle(playerid))
	{
		GetVehicleVelocity(GetPlayerVehicleID(playerid), Cx, Cy, Cz);
		if(Cx < -0.4 || Cx > 0.4 || Cy < -0.4 || Cy > 0.4 && !Informacion[playerid][Manejando])
		{
		    Choque[playerid] = SetTimerEx("Velocidad", 100, 1, "i", playerid);
		    Informacion[playerid][Manejando] = 1;
		}
		else
		{
		    KillTimer(Choque[playerid]);
		    Informacion[playerid][Manejando] = 0;
		}
	}
	return 1;
}


public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
	if(IsPlayerConnected(playerid))
	{
		new Float:posx, Float:posy, Float:posz;
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
			{
    			if(!Si[i])
				{
					GetPlayerPos(i, posx, posy, posz);
					tempposx = (oldposx -posx);
					tempposy = (oldposy -posy);
					tempposz = (oldposz -posz);
					if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
					{
						SendClientMessage(i, col1, string);
					}
					else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
					{
						SendClientMessage(i, col2, string);
					}
					else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
					{
						SendClientMessage(i, col3, string);
					}
					else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
					{
						SendClientMessage(i, col4, string);
					}
					else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
					{
						SendClientMessage(i, col5, string);
					}
				}
				else
				{
					SendClientMessage(i, col1, string);
				}
			}
		}
	}
	return 1;
}
PAWN Compiler Output:
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
and there was NO errors and warnings

But this script doesnґt work, there is no such effects like video!
Please, Somebody help me!

Here is the link, where i download the script:
https://sampforum.blast.hk/showthread.php?tid=145977
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)