[Ajuda] JFS Velocimetro - 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: [Ajuda] JFS Velocimetro (
/showthread.php?tid=537437)
JFS Velocimetro -
alexandrealx - 15.09.2014
Olá.. Estou usando o JFS Velocimetro
e quando a gasolina acaba, aparece que pra sair do veiculo precisa digitar: /sairveiculo
Codigo Original:
Код:
public CheckGas()
{
for(new i=0;i<MAXPLAYERSJFS;i++)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(Gas[vehicle] >= 1)
{
Gas[vehicle]--;
}
if(Gas[vehicle] < 1)
{
SemGasolina[i] = 1;
TogglePlayerControllable(i, 0);
SendClientMessage(i, -1, "[INFO] Acabou a Gasolina ! Use: /sairveiculo");
}
}
}
}
return 1;
}
Ai eu editei para que o quando acabar o player seja retirado do veiculo:
Код:
new playerid;
public CheckGas()
{
for(new i=0;i<MAXPLAYERSJFS;i++)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(Gas[vehicle] >= 1)
{
Gas[vehicle]--;
}
if(Gas[vehicle] < 1)
{
SemGasolina[i] = 1;
TogglePlayerControllable(i, 0);
SendClientMessage(i, -1, "[INFO] Acabou a Gasolina ! Chame um Mecanico /servico mecanico");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
Até ai, tudo certo, porem testando, quando acaba a gasolina, o player é expulso do carro só que fica congelado
Alguém pode ajudar ?
Re: JFS Velocimetro -
JonathanFeitosa - 15.09.2014
pawn Код:
new playerid;
public CheckGas()
{
for(new i=0;i<MAXPLAYERSJFS;i++)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(Gas[vehicle] >= 1)
{
Gas[vehicle]--;
}
if(Gas[vehicle] < 1)
{
SemGasolina[i] = 1;
TogglePlayerControllable(i, 1);
SendClientMessage(i, -1, "[INFO] Acabou a Gasolina ! Chame um Mecanico /servico mecanico");
RemovePlayerFromVehicle(playerid);
}
}
}
}
return 1;
}
TogglePlayerControllable (Wiki)
Parameters:
(playerid, toggle)
playerid The ID of the player to toggle the controllability of
toggle 0 to make them uncontrollable, 1 to make them controllable.
Re: JFS Velocimetro -
alexandrealx - 15.09.2014
Obg Jonathan.. (Ótimo FS +Rep)