[ADD-ON] The Godfather: Crash Car Script! (Stop NON-RP Driving)
#1

A while ago i was being thinking of a script that would stop the non RP driving in city's.
I started scripting and made a add-on that would stop it.

If your driving in your car and your car gets damaged for at least 25%, you will be frozen in your car and you won't be able to get out.
A message will be send to the Ambulance team and the Mechanics online, They can accept your request and if they do accept it they will get a marker on the mini-map with your location.
The Mechanic has to be at the location within 3 minutes, or the driver will be able to get out his car (he can't drive it anymore)
If the Ambulance/Mechanic makes it to be there within 3 minutes, he is able to repair the car and the driver can drive with it again.

I'm releasing this because i never used it and not really finished it completely because i didn't had time, if someone finds any bugs reply it here and i will fix it.

Code:
forward StopCrashCall();
forward CrashCar();
new carcrashed[MAX_PLAYERS];
new crashtimer[MAX_PLAYERS];
new helpcar;


public CrashCar()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
   	  if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
	{
 					new vehicle[MAX_PLAYERS];
					vehicle[i] = GetPlayerVehicleID(i);
					new Float:health;
					GetVehicleHealth(vehicle[i], health);
					if (health <= 750)
					{
					if (carcrashed[i] == 0)
					{
					TogglePlayerControllable(i, 0);
					GameTextForPlayer(i, "~w~Your car is~n~~p~Broken", 3500, 1);
					SendClientMessage(i, COLOR_YELLOW, "Your car is broken down, you aren't available to drive anymore. You became unconscious");
					SendClientMessage(i, COLOR_YELLOW, "A message has been sent to all Mechanics and SAES Members available.");
		 			SendRadioMessage(4, TEAM_ORANGE_COLOR, "** The car of someone broke down, use /helpcar to help this person in need ! **");
					SendRadioMessage(4, TEAM_ORANGE_COLOR, "** Help him ! **");
			 		SendJobMessage(7, TEAM_ORANGE_COLOR, "** The car of someone broke down, use /helpcar to help this person in need ! **");
					SendJobMessage(7, TEAM_ORANGE_COLOR, "** Help him ! **");
					SetTimerEx("StopCrashCall", 180000, 0, "i", i);
					crashtimer[i] = 1;
			 		carcrashed[i] = 1;
					helpcar = i;
					}
					}
					}
					}
  }
public StopCrashCall()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
	if (crashtimer[i] == 1)
	{
SendClientMessage(i, COLOR_YELLOW, "You decided to get out of the car, it took to long");
SendClientMessage(i, COLOR_YELLOW, "TIP: Do not enter the vehicle again, it's still broken !");
TogglePlayerControllable(i, 1);
RemovePlayerFromVehicle(i);
carcrashed[i] = 0;
crashtimer[i] = 0;
}
}
}

			if (strcmp(cmdtext, "/helpcar", true)==0)
		{
		  if(IsPlayerConnected(playerid))
			{
			if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
			{
		 	GetPlayerName(playerid, sendername, sizeof(sendername));
 			GetPlayerName(backupask, giveplayer, sizeof(giveplayer));
			new Float:X,Float:Y,Float:Z;
			GetPlayerPos(helpcar, X, Y, Z);
			SetPlayerCheckpoint(playerid, X, Y, Z, 5);
			SetPlayerMarkerForPlayer(playerid,helpcar, 0xFF0000FF );
			format(string, sizeof(string), "* %s has accepted a emergency call", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			printf("%s", string);
			GameTextForPlayer(playerid, "~w~You accepted the question to help in a car crash~n~~r~Goto redmarker", 5000, 1);
		  format(string, sizeof(string), "** %s has accepted the crash call, he's on his way, use /cancelhelpcar to cancel!", sendername);
			SendRadioMessage(4, TEAM_BLUE_COLOR, string);
			SendJobMessage(7, TEAM_BLUE_COLOR, string);
			format(string, sizeof(string), "%s has accepted the crash call, he's on his way, stay calm!", sendername);
			SendClientMessage(helpcar, TEAM_ORANGE_COLOR, string);
			
			}
			if (IsPlayerInCheckpoint(playerid))
			{
			DisablePlayerCheckpoint(playerid);
			return 1;
			}
			}
			}
			if (strcmp(cmdtext, "/cancelhelpcar", true)==0)
			{
			if(IsPlayerConnected(playerid))
			{
			if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
			{
	 	  GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s cancelled the emergency call", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			printf("%s", string);
		  format(string, sizeof(string), "** %s has cancelled the emergency call!", sendername);
			SendRadioMessage(4, TEAM_BLUE_COLOR, string);
			SendJobMessage(7, TEAM_BLUE_COLOR, string);
			SetPlayerMarkerForPlayer(playerid, helpcar, 0xFFFFFF00 );
			DisablePlayerCheckpoint(playerid);
			return 1;
			}
			}
			}
Feel free to add it in your server, but leave some credits please.

Nicky Andrews

Please check forums.avenuestudios.org for more scripts/designs
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)