gps em 3dlabel - distributor - 05/09/2022
alguem manja como cria um gps em 3dlabel que atualiza a distancia do destino?
ele fica marcado no local de destino e quanto mais perto vc chega vai diminuindo os metros
fiz dessa forma mais ele acaba entrando em conflito com outros 3d ![Dodgy Dodgy](https://portalsamp.com/images/smilies/dodgy.png)
new Text3D:Gps[MAX_PLAYERS];
format(string, sizeof(string), ""));
Gps[playerid] = CreateDynamic3DTextLabel(string, -1, x[playerid], y[playerid], z[playerid], 999.0, .playerid = playerid, .streamdistance = 999.0);
TimerGPS[playerid] = SetTimerEx("AtualizarGPS", 500, true, "d", playerid);
public AtualizarGPS(playerid)
{
if(IsValidDynamic3DTextLabel(GpsLabel[playerid]))
{
format(string, sizeof(string), "%s\nFaltam: %.0f metros para chegar no seu destino", Destino[playerid], Metros(playerid, x[playerid], y[playerid], z[playerid]));
UpdateDynamic3DTextLabelText(Gps[playerid], -1, string);
}
}
meu codigo ta errado?
RE: gps em 3dlabel - Maycon_Felipe - 05/09/2022
Tente colocar o priority em 10 ou maior..
Ele vai da prioridade maior ao Text3D do GPS..
Gps[playerid] = CreateDynamic3DTextLabel(string, -1, x[playerid], y[playerid], z[playerid], 999.0, .playerid = playerid, .streamdistance = 999.0, .priority = 10);
RE: gps em 3dlabel - xbruno1000x - 05/09/2022
Você verifica se o 3DTextLabel GpsLabel[playerid] é válido.
Código: if(IsValidDynamic3DTextLabel(GpsLabel[playerid]))
Porém a variável utilizada para a criação do Label é Gps[playerid].
Pelo menos no código postado, essa variável nem é mencionada... dá uma olhada nisso, talvez a verificação não esteja retornando true.
RE: gps em 3dlabel - distributor - 05/09/2022
(05/09/2022 17:28)Maycon_Felipe Escreveu: Tente colocar o priority em 10 ou maior..
Ele vai da prioridade maior ao Text3D do GPS..
Gps[playerid] = CreateDynamic3DTextLabel(string, -1, x[playerid], y[playerid], z[playerid], 999.0, .playerid = playerid, .streamdistance = 999.0, .priority = 10);
valeu mas n funcionou, acho q o problema e no update
(05/09/2022 20:07)xbruno1000x Escreveu: Você verifica se o 3DTextLabel GpsLabel[playerid] é válido.
Código: if(IsValidDynamic3DTextLabel(GpsLabel[playerid]))
Porém a variável utilizada para a criação do Label é Gps[playerid].
Pelo menos no código postado, essa variável nem é mencionada... dá uma olhada nisso, talvez a verificação não esteja retornando true.
erro meu na hora q tava copiando o codigo e passando p post, na gm ta certinho uso a variavel GPS e verifico ela mesmo
RE: gps em 3dlabel - White_Blue - 05/09/2022
(05/09/2022 20:31)distributor Escreveu: (05/09/2022 17:28)Maycon_Felipe Escreveu: Tente colocar o priority em 10 ou maior..
Ele vai da prioridade maior ao Text3D do GPS..
Gps[playerid] = CreateDynamic3DTextLabel(string, -1, x[playerid], y[playerid], z[playerid], 999.0, .playerid = playerid, .streamdistance = 999.0, .priority = 10);
valeu mas n funcionou, acho q o problema e no update
(05/09/2022 20:07)xbruno1000x Escreveu: Você verifica se o 3DTextLabel GpsLabel[playerid] é válido.
Código: if(IsValidDynamic3DTextLabel(GpsLabel[playerid]))
Porém a variável utilizada para a criação do Label é Gps[playerid].
Pelo menos no código postado, essa variável nem é mencionada... dá uma olhada nisso, talvez a verificação não esteja retornando true.
erro meu na hora q tava copiando o codigo e passando p post, na gm ta certinho uso a variavel GPS e verifico ela mesmo
Conseguiu resolver o problema?
RE: gps em 3dlabel - distributor - 05/09/2022
(05/09/2022 21:16)White_Blue Escreveu: (05/09/2022 20:31)distributor Escreveu: (05/09/2022 17:28)Maycon_Felipe Escreveu: Tente colocar o priority em 10 ou maior..
Ele vai da prioridade maior ao Text3D do GPS..
Gps[playerid] = CreateDynamic3DTextLabel(string, -1, x[playerid], y[playerid], z[playerid], 999.0, .playerid = playerid, .streamdistance = 999.0, .priority = 10);
valeu mas n funcionou, acho q o problema e no update
(05/09/2022 20:07)xbruno1000x Escreveu: Você verifica se o 3DTextLabel GpsLabel[playerid] é válido.
Código: if(IsValidDynamic3DTextLabel(GpsLabel[playerid]))
Porém a variável utilizada para a criação do Label é Gps[playerid].
Pelo menos no código postado, essa variável nem é mencionada... dá uma olhada nisso, talvez a verificação não esteja retornando true.
erro meu na hora q tava copiando o codigo e passando p post, na gm ta certinho uso a variavel GPS e verifico ela mesmo
Conseguiu resolver o problema?
ainda nao
RE: gps em 3dlabel - White_Blue - 05/09/2022
Teste assim.
Código PHP: // Global new Float:posgps[3], Text3D:GPS[MAX_PLAYERS], timergps[MAX_PLAYERS];
CMD:marcargps(playerid, params[]) { new Float:CorX, Float:CorY, Float:CorZ, str1[128], Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); if(sscanf(params, "p<,>fff", CorX, CorY, CorZ)) { SendClientMessage(playerid, -1, "/marcargps [X, Y, Z]"); return 1; }
posgps[0] = CorX; posgps[1] = CorY; posgps[2] = CorZ; format(str1, sizeof(str1), "Você está a %0.1f metros de distância do seu destino!", GetDistanceBetweenPoints(posgps[0], posgps[1], posgps[2], pos[0], pos[1], pos[2])); GPS[playerid] = CreateDynamic3DTextLabel(str1, -1, CorX, CorY, CorZ, 99999.0, .playerid = playerid, .streamdistance = 99999.0);
timergps[playerid] = SetTimerEx("AttGPS", 500, true, "d", playerid); return 1; }
forward AttGPS(playerid); public AttGPS(playerid) { new stratt[128], Float:pos[3]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); if(IsValidDynamic3DTextLabel(GPS[playerid])) { format(stratt, sizeof(stratt), "Você está a %0.1f metros de distância do seu destino!", GetDistanceBetweenPoints(posgps[0], posgps[1], posgps[2], pos[0], pos[1], pos[2])); UpdateDynamic3DTextLabelText(GPS[playerid], -1, stratt); if(GetDistanceBetweenPoints(posgps[0], posgps[1], posgps[2], pos[0], pos[1], pos[2]) < 5.0) { DestroyDynamic3DTextLabel(GPS[playerid]); SendClientMessage(playerid, Verde, "Você chegou ao seu destino!"); KillTimer(timergps[playerid]); } } return 1; }
Float:GetDistanceBetweenPoints(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ) { new Float:Distance; Distance = floatabs(floatsub(X, PointX))+floatabs(floatsub(Y, PointY))+floatabs(floatsub(Z, PointZ)); return Distance; }
|