SA-MP Forums Archive
[Pedido] Motor - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Motor (/showthread.php?tid=628231)



Motor - Phone - 07.02.2017

Alguem poderia me passar um sistema, que quando a vida do veiculo chegar por exemplo em 100.0, o veiculo nгo andar mais, ate o mecanico reparar o veiculo, alguem poderia me passar??


Re: Motor - GuiKommander - 07.02.2017

mano Pesquisa ae.
https://sampforum.blast.hk/showthread.php?tid=324711


Re: Motor - Phone - 07.02.2017

Quote:
Originally Posted by GuiKommander
Посмотреть сообщение
Pesquisei sim, e cheguei nesse mesmo tуpico ae, porem esse sistema que esta neste topнco esta todo bugado, por isso vim aki fazer o PEDIDO


Re: Motor - RodrigoMSR - 07.02.2017

Aqui estб uma base:
Код:
public OnGameModeInit()
{
    SetTimer("CheckVehicles", 1000, true);
	return 1;
}

forward CheckVehicles();
public CheckVehicles()
{
	for(new i = 0, m = GetPlayerPoolSize()+1; i < m; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
	        {
	            new v = GetPlayerVehicleID(i), Float:health;
	            new engine, lights, alarm, doors, bonnet, boot, objective;
				GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);
				GetVehicleHealth(v, health);
				
				if(health <= 100.0 && engine == VEHICLE_PARAMS_ON)
				{
					SetVehicleParamsEx(v, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
					SendClientMessage(i, -1, "O motor do seu veнculo parou de funcionar");
				}
	        }
	    }
	}
	return 1;
}

stock RepararMotor(vehicleid)
{
	SetVehicleHealth(vehicleid, 1000);
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
	return 1;
}



Re: Motor - Felipe1241421 - 07.02.2017

@edit
nгo li o tуpico direto