[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
#2

Nice one!

With 2 Errors
Code:
C:\PLRP\gamemodes\PLRP.pwn(39788) : error 017: undefined symbol "playerid"
C:\PLRP\gamemodes\PLRP.pwn(39796) : error 030: compound statement not closed at the end of file (started at line 39768)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#3

Try to replace "Playerid" with "i"

Add a bracket at the end of the part with 'Public StopCrashCall

Sorry for the inconvience.
Reply
#4

and what is this?
Code:
C:\PLRP\gamemodes\PLRP.pwn(39805) : error 030: compound statement not closed at the end of file (started at line 39777)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
No more nonrp driving xD
Reply
#5

I can't do anything without getting the line which gives the errors, please paste it here.
Reply
#6

39805 this line dont exist i have in my script 39804 lines

Will try like FS
Reply
#7

Exactly what i needed thanks alot man
Reply
#8

Quote:
Originally Posted by Niicky_Andrews
I can't do anything without getting the line which gives the errors, please paste it here.
It means it needs another }
Reply
#9

Hi, how to fix this?
Code:
erp1b.pwn(34618) : error 029: invalid expression, assumed zero
erp1b.pwn(34618) : error 004: function "CrashCar" is not implemented
erp1b.pwn(34649) : error 029: invalid expression, assumed zero
erp1b.pwn(34649) : error 004: function "StopCrashCall" is not implemented
erp1b.pwn(34672) : error 017: undefined symbol "backupask"
Reply
#10

Quote:
Originally Posted by Mixman
Hi, how to fix this?
Code:
erp1b.pwn(34618) : error 029: invalid expression, assumed zero
erp1b.pwn(34618) : error 004: function "CrashCar" is not implemented
erp1b.pwn(34649) : error 029: invalid expression, assumed zero
erp1b.pwn(34649) : error 004: function "StopCrashCall" is not implemented
erp1b.pwn(34672) : error 017: undefined symbol "backupask"
Add this at the bottom of the 'forward list' in your gamemode.

forward StopCrashCall();
forward CrashCar();

And this at the bottom of the 'new list' which is at the top of your script.

new backupask;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)