SA-MP Forums Archive
[HELP]I just edited my /engine system and when i do /engine it says "unknown - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]I just edited my /engine system and when i do /engine it says "unknown (/showthread.php?tid=143969)



[HELP]I just edited my /engine system and when i do /engine it says "unknown - Lilcuete - 25.04.2010

Ok when i do /engine ingame it says "unknown command" please help me heres code
Code:
	if(!strcmp(cmd, "/engine", true))
{

new name[MAX_PLAYER_NAME];
    	new sendername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, sendername, sizeof(sendername));
    new vehicleid = GetPlayerVehicleID(playerid);
     new Float:Vehhp;
	GetVehicleHealth(vehicleid, Vehhp);
		if(pToolkit[playerid] == 1)
		{
		if(VehicleInfo[vehicleid][vAlarm] == 1)
			{
			  VehicleTimer[playerid] = 60;
			  vehiclets[playerid] =SetTimerEx("Vehicles", 1000, 1, "d", playerid);
			  }
			  	if(VehicleInfo[vehicleid][vAlarm] == 2)
			{
			  VehicleTimer[playerid] = 120;
			  vehiclets[playerid] =SetTimerEx("Vehicles", 1000, 1, "d", playerid);
			  }
			   	if(VehicleInfo[vehicleid][vAlarm] == 3)
			{
			  VehicleTimer[playerid] = 180;
			  vehiclets[playerid] =SetTimerEx("Vehicles", 1000, 1, "d", playerid);
			  }
			     	if(VehicleInfo[vehicleid][vAlarm] == 4)
			{
			  VehicleTimer[playerid] = 300;
			  vehiclets[playerid] =SetTimerEx("Vehicles", 1000, 1, "d", playerid);
			  }
			     	if(VehicleInfo[vehicleid][vAlarm] == 5)
			{
			  VehicleTimer[playerid] = 500;
			  vehiclets[playerid] =SetTimerEx("Vehicles", 1000, 1, "d", playerid);
			  }
  	if(VehicleInfo[vehicleid][vOwned] == 1)
	  	{
	   GetPlayerName(playerid, name, sizeof(name));
      if(strcmp(name, VehicleInfo[vehicleid][vOwner], true) == 0)
      {
    if(Engine[vehicleid] == 0)
    {
    	if(Vehhp <= 400)
		 {
				Engine[vehicleid] = 0;
 		TogglePlayerControllable(playerid, 0);
		  SendClientMessage(playerid, COLOR_RED, "Status: Engine light indicates Repairs needed.");
      SendClientMessage(playerid, COLOR_RED, "Status:You will need to call a mechanic /call 555.");
      return 1;
      		}
    	new playerveh = GetPlayerVehicleID(playerid);
					PutPlayerInVehicle(playerid, playerveh, 0);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s starts the engine of the %s", sendername,VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
					ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
					Engine[vehicleid] = 0;
          engineOn[GetPlayerVehicleID(playerid)] = true;
          TogglePlayerControllable(playerid, true);
					SetTimerEx("CheckCarHealth",1500,0,"i",playerid);
					GameTextForPlayer(playerid, "~g~Engine On.",1500,3);
					Engine[vehicleid] = 1;
					return 1;
    }
    else if(Engine[vehicleid] == 1)
    {
    	if(VehicleInfo[vehicleid][vOwned] == 1)
	  	{
	  	 GetPlayerName(playerid, name, sizeof(name));
      if(strcmp(name, VehicleInfo[vehicleid][vOwner], true) == 0)
      {
	  
    Engine[vehicleid] = 0;
    	format(string, sizeof(string), "* %s turns off the engine of the %s .", sendername,VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
	  ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	  GameTextForPlayer(playerid, "~r~Engine Off.",1500,3);
    TogglePlayerControllable(playerid,0);
     	}
	else
	{
  GameTextForPlayer(playerid, "~r~You don't have a toolkit.",1500,3);
    return 1;
}
}
}
}
}
}
}



Re: [HELP]I just edited my /engine system and when i do /engine it says "unknown - pierhs - 25.04.2010

You should put this line Engine[MAX_VEHICLES] = 0; to OnGameModeInit() so when the server starts all cars engine will be defined as zero.


Re: [HELP]I just edited my /engine system and when i do /engine it says "unknown - MadeMan - 25.04.2010

Add return 1; at the end of this command.