02/11/2021 18:07
(02/11/2021 17:40)MrThúúG Escreveu: Poste o seu SetPlayerAttachedObject para eu ver uma coisa.
Código:
#include <a_samp>
#include <streamer>
#include <zcmd>
main() { print("| INFO | A sua gamemode foi carregada!"); }
new GPS_OBJ[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
if(IsValidDynamicObject(GPS_OBJ[playerid]))
{
new
Float:X = GetPVarFloat(playerid, "GPS:X"),
Float:Y = GetPVarFloat(playerid, "GPS:Y"),
Float:CurrentX, Float:CurrentY, Float:angle
;
GetVehiclePos(GetPlayerVehicleID(playerid), CurrentX, CurrentY, angle);
GetAngleToXY(X, Y, CurrentX, CurrentY, angle);
Streamer_SetFloatData(0, GPS_OBJ[playerid], E_STREAMER_ATTACH_R_Z, angle);
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(IsValidDynamicObject(GPS_OBJ[playerid]))
{
DestroyDynamicObject(GPS_OBJ[playerid]);
}
return 1;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
SetPVarInt(playerid, "OnClick", 1);
SetPVarFloat(playerid, "GPS:X", fX);
SetPVarFloat(playerid, "GPS:Y", fY);
return 1;
}
CMD:gps(playerid, params[])
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsValidDynamicObject(GPS_OBJ[playerid]))
{
DestroyDynamicObject(GPS_OBJ[playerid]);
SendClientMessage(playerid, 0x00FF00FF, "| INFO | {FFFFFF}O GPS do seu veiculo foi desativado!");
}
else
{
if(GetPVarInt(playerid, "OnClick") == 1)
{
GPS_OBJ[playerid] = CreateDynamicObject(1318, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, playerid);
AttachDynamicObjectToVehicle(GPS_OBJ[playerid], vehicleid, 0.0, 0.0, 1.0, 0.0, -90.0, 0.0);
SendClientMessage(playerid, 0x00FF00FF, "| INFO | {FFFFFF}O GPS do seu veiculo foi ativado!");
}
else SendClientMessage(playerid, 0xFF0000FF, "| GPS | {FFFFFF}Voce precisa marcar o local no GPS!");
}
}
else SendClientMessage(playerid, 0xFF0000FF, "| ERRO | {FFFFFF}Voce precisa estar dentro de um veiculo!");
return 1;
}
GetAngleToXY(Float:X, Float:Y, Float:CurrentX, Float:CurrentY, &Float:Angle)
{
Angle = atan2(Y-CurrentY, X-CurrentX);
Angle = floatsub(Angle, 90.0);
if(Angle < 0.0) Angle = floatadd(Angle, 360.0);
}