Ok is in portuguese but i could show you>
PHP код:
new Float:vida, Float: distance, Float: x, Float: y, Float: z, Float: a;
new carro;
if(!IsPlayerInAnyVehicle(playerid))
{
carro = GetClosestVehicleFromPlayer(playerid);
GetPlayerPos(playerid, x, y, z);
distance = GetVehicleDistanceFromPoint(carro, x, y, z);
if(distance > 4) return SendClientMessage(playerid, -1, "Deves estar perto de um veнculo!");
GetVehicleHealth(carro, vida);
if(vida >= 1000) return SendClientMessage(playerid, -1, "O veнculo nгo precisa de ser reparado.");
SetTimerEx("RepararCarro", 10000, 0, "ii", playerid, carro);
TimerSomRepararCarro[playerid] = SetTimerEx("SomRepararCarro", 2500, 1, "i", playerid);
GameTextForPlayer(playerid,"~w~Reparando...",10000,3);
TogglePlayerControllable(playerid,0);
SetPlayerFacingAngle(playerid, a+90);
ApplyAnimation(playerid,"CAR","Fixn_Car_Loop",5.0,0,1,1,0,10000,1);
for(new i = 1; i < MAX_PLAYERS ; i++)
{
distance = GetPlayerDistanceFromPoint(i, x, y, z);
if(distance < 15)
{
PlayerPlaySound(i, 32000, 0, 0, 0);
}
}
return 1;
}
return 1;
}
And the functions
PHP код:
public SomRepararCarro(playerid)
{
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
for(new i = 1; i < MAX_PLAYERS ; i++)
{
new Float:distance = GetPlayerDistanceFromPoint(i, x, y, z);
if(distance < 15)
{
PlayerPlaySound(i, 32000, 0, 0, 0);
}
}
return 1;
}
PHP код:
public RepararCarro(playerid, carro)
{
KillTimer(TimerSomRepararCarro[playerid]);
SetVehicleHealth(carro,1000);
RepairVehicle(carro);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, -1,"Carro reparado com sucesso!");
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
for(new i = 1; i < MAX_PLAYERS ; i++)
{
new Float:distance = GetPlayerDistanceFromPoint(i, x, y, z);
if(distance < 15)
{
PlayerPlaySound(i, 1133, 0, 0, 0);
}
}
return 1;
}
EDIT
I will try this to see if i get the correct id
PHP код:
new string[128];
format(string, sizeof(string), "%d", carro);
SendClientMessage(playerid, -1, string);