[Duda]Saber cuando un auto esta en el agua
#4

Un cуdigo simple podrнa ser detectar la posiciуn del jugador:

pawn Код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
Y si la posiciуn "Z" del usuario estб en un nъmero menor a 1 (El nivel del mar, a excepciуn de algunos lugares como la cantera que contienen posiciones mбs bajas); lo coloca en la posiciуn que usted desea.

Algo como:

pawn Код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
new State = GetPlayerState(playerid);
if(Z < 1)
{
if(State == PLAYER_STATE_DRIVER)
{
// Code.
}
return 1;
}
El ъnico problema serнan posiciones muy bajas como la cantera; en casos asн puede usar IsPlayerInRangeOfPoint para hacer una excepciуn en lugares como la cantera.

Se solucionarнa con algo como:

pawn Код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
new State = GetPlayerState(playerid);
if(IsPlayerInRangeOfPoint(playerid, 100.0, "Coordenada X central de la cantera", "Coordenada Y central de la cantera", "Coordenada Z central de la cantera")) return 0;
if(Z < 1)
{
if(State == PLAYER_STATE_DRIVER)
{
// Funciуn para colocar los autos en la posiciуn que usted desea.
}
return 1;
}
Tambiйn podrнa funcionar de forma mбs simple con:

pawn Код:
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 100.0, "Coordenada X central de la cantera", "Coordenada Y central de la cantera", "Coordenada Z central de la cantera")) return 0;
if(Z < 1)
{
if(State == PLAYER_STATE_DRIVER)
{
new Veh = GetPlayerVehicleID(playerid);
SetVehiclePos(Veh, Pox, Poy, Poz);
SetPlayerPos(playerid, Pox, Poy, Poz);
PutPlayerInVehicle(playerid, Veh, 0);
}
return 1;
}
Algo mбs simple serнa OnPlayerEnterDynamicArea (https://sampforum.blast.hk/showthread.php?tid=235122) pero si le es muy complicado mejor use IsPlayerInRangeOfPoint para detectar si el usuario estб en la cantera o en un lugar bajo el nivel del mar.

El cуdigo lo puede colocar en OnPlayerUpdate o en algъn timer (De preferencia el timer para no saturar el servidor )

Suerte, espero le sirva
Reply


Messages In This Thread
[Duda]Saber cuando un auto esta en el agua - by Terremoto - 12.08.2014, 00:08
Re: [Duda]Saber cuando un auto esta en el agua - by Unrea1 - 12.08.2014, 00:24
Respuesta: Re: [Duda]Saber cuando un auto esta en el agua - by aoEXE - 12.08.2014, 00:30
Respuesta - by Ygzeb - 12.08.2014, 00:39
Re: [Duda]Saber cuando un auto esta en el agua - by chusothe41 - 12.08.2014, 00:43
Respuesta: [Duda]Saber cuando un auto esta en el agua - by Glimma - 12.08.2014, 01:48
Respuesta - by Ygzeb - 12.08.2014, 02:31
Respuesta: Respuesta - by Glimma - 12.08.2014, 02:38
Respuesta - by Ygzeb - 12.08.2014, 02:45
Respuesta: [Duda]Saber cuando un auto esta en el agua - by Swedky - 12.08.2014, 03:21

Forum Jump:


Users browsing this thread: 6 Guest(s)