SetParam("use_window", "1")
SetParam("window", "GTA:SA:MP")
DestroyAllVisual()
global Positions_O := []
global PositionCount := 0
global TimerStarted := 0
global Radius := 30
global Pause_Status := 0
if(FileExist("Positions.ini")){
IniRead, PositionCount_Rout, Positions.ini, Information, Count
PositionCount := PositionCount_Rout
if(PositionCount >= 1){
Loop, %PositionCount%
{
IniRead, TEXT_%A_Index%, Positions.ini, Position_%A_Index%, Text
IniRead, XPOS_%A_Index%, Positions.ini, Position_%A_Index%, X
IniRead, YPOS_%A_Index%, Positions.ini, Position_%A_Index%, Y
IniRead, ZPOS_%A_Index%, Positions.ini, Position_%A_Index%, Z
Positions_O.Push(Object("Text", TEXT_%A_Index%, "Count", A_Index, "XPOS", XPOS_%A_Index%, "YPOS", YPOS_%A_Index%, "ZPOS", ZPOS_%A_Index%, "Visible", !Pause_Status, "Disabled", 0))
createPositionText(TEXT_%A_Index%, A_Index, XPOS_%A_Index%, YPOS_%A_Index%, ZPOS_%A_Index%)
}
if(Pause_Status == 0){
SetTimer, Update, 20
TimerStarted := 1
}
} else {
addChatMessage(-1, "Es konnte keine Position ausgelesen werden.")
addChatMessage(-1, "Es wird darauf gewartet, dass die Funktion addPosition() aufgerufen wird.")
}
} else {
IniWrite, 0, Positions.ini, Information, Count
addChatMessage(-1, "Es konnte keine Position ausgelesen werden.")
addChatMessage(-1, "Es wird darauf gewartet, dass die Funktion addPosition() aufgerufen wird.")
}
addPosition(Text, XPOS, YPOS, ZPOS) {
PositionCount++
IniWrite, %Text%, Positions.ini, Position_%PositionCount%, Text
IniWrite, %PositionCount%, Positions.ini, Information, Count
IniWrite, %XPOS%, Positions.ini, Position_%PositionCount%, X
IniWrite, %YPOS%, Positions.ini, Position_%PositionCount%, Y
IniWrite, %ZPOS%, Positions.ini, Position_%PositionCount%, Z
Positions_O.Push(Object("Text", Text, "Count", PositionCount, "XPOS", XPOS, "YPOS", YPOS, "ZPOS", ZPOS, "Visible", !Pause_Status, "Disabled", 0))
createPositionText(Text, PositionCount, XPOS, YPOS, ZPOS)
if(!TimerStarted && Pause_Status == 0) {
TimerStarted := 1
SetTimer, Update, 20
}
return
}
areCordsOnScreen(X, Y) {
if(X > 0 && X < 800 && Y > 0 && Y < 600){
return true
} else {
return false
}
}
createPositionText(Text, Count, XPOS, YPOS, ZPOS) {
global
WTS := worldToScreen(XPOS, YPOS, ZPOS)
px1 := WTS[1] / (1920 / 800)
px2 := WTS[2] / (1080 / 600)
Position_Text_%Count% := TextCreate("Geneva", 7, 1, 0, px1, px2, 0xFFFFFFFF, "", 1, !Pause_Status)
TextSetString(Position_Text_%Count%, Text)
}
getClosestLabel() {
closestDist := 99999999
for i, o in Positions_O {
if(o.Disabled)
continue
POS1 := [o.XPOS, o.YPOS, o.ZPOS]
POS2 := getCoordinates()
Dist := getDist(POS1, POS2)
Count_ := o.Count
if(closestDist > Dist){
closestDist := Dist
closestDist_Label := o
continue
} else {
continue
}
}
if(!closestDist)
return false
return closestDist_Label
}
disableClosestLabel(closestDist_Label) {
global
if(!closestDist_Label.Count)
return false
closestDist_Label.Visible := 0
closestDist_Label.Disabled := 1
Count__ := closestDist_Label.Count
;addChatMessage(-1, "Disabled: Text: " closestDist_Label.Text " Id: "closestDist_Label.Count)
TextSetShown(Position_Text_%Count__%, 0)
}
enableAllLabels() {
global
for i, o in Positions_O {
if(o.Disabled) {
o.Disabled := 0
}
}
return
}
Update:
if(Pause_Status)
return
for i, o in Positions_O {
if(o.Disabled == 1){
continue
}
curr_pos := o.Count
WTS := worldToScreen(o.XPOS, o.YPOS, o.ZPOS)
px1 := WTS[1] / (1920 / 800)
px2 := WTS[2] / (1080 / 600)
if(!areCordsOnScreen(px1, px2) || !isPlayerInRangeOfPoint(o.XPOS, o.YPOS, o.ZPOS, Radius)){
if(o.Visible == 1){
TextSetShown(Position_Text_%curr_pos%, 0)
o.Visible := 0
continue
}
continue
}
if(!o.Visible){
TextSetShown(Position_Text_%curr_pos%, 1)
o.Visible := 1
}
TextSetPos(Position_Text_%curr_pos%, px1, px2)
}
return
/*
Numpad0::
addPosition("Neu", 1783.3811, -1908.6150, 13.3918)
return
*/
Numpad1::
disableClosestLabel(getClosestLabel())
return
Numpad5::
enableAllLabels()
return
:?:/pause::
if(Pause_Status == 1) {
SetTimer, Update, 20
Pause_Status := !Pause_Status
return
} else {
SetTimer, Update, Off
for i, o in Positions_O {
curr_pos := o.Count
if(o.Visible) {
TextSetShown(Position_Text_%curr_pos%, 0)
o.Visible := 0
}
}
Pause_Status := !Pause_Status
return
}
return
Alles anzeigen
Sollte eigentlich alles selbsterklärend sein.
Einfach fragen, wenn etwas unverständlich ist, oder nicht funktioniert.