Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gk(id, store := "", showGK := false) {
- result := URLDownloadToVar(baseURL . "api/newgk.php?gk=" . id)
- if (result == "ERROR_CONNECTION") {
- SendClientMessage(PREFIX . "{FF0000}Fehler bei der Verbindung zum Server!")
- } else if (result == "ERROR_BAD_LINK") {
- SendClientMessage(PREFIX . "{FF0000}Fehlerhafte Parameterübergabe!")
- } else if (result == "ERROR_ACCESS_DENIED") {
- SendClientMessage(PREFIX . "{FF0000}Zugriff verweigert, das Passwort ist falsch!")
- } else if (result == "ERROR_WRONG_FORMAT") {
- SendClientMessage(PREFIX . "{FF0000}Fehlerhaftes Format!")
- } else if (result == "ERROR_NOT_FOUND") {
- SendClientMessage(PREFIX . "{FF0000}Der Komplex wurde nicht in der Datenbank gefunden!")
- } else {
- if (store == "") {
- SendClientMessage(PREFIX . "Gebäudekomplex {FF0000}" . id . "{FFFFFF}:")
- }
- try {
- data := JSON.Load(result)
- } catch {
- SendClientMessage(PREFIX . "{FF0000}Es ist ein unbekannter Fehler aufgetreten!")
- FormatTime, time, , dd.MM.yyyy HH:mm:ss
- FileAppend, [%time%] Beim Laden des GK ist ein Fehler aufgetreten: %result%`n, log.txt
- return
- }
- for index, entry in data {
- name := entry["name"]
- location := ""
- if (entry["type"] == "public") {
- color := "{00FF00}"
- location := " (" . calculateZone(entry["x"], entry["y"], 0.0) . ", " . calculateCity(entry["x"], entry["y"], 0.0) . ")"
- } else if (entry["type"] == "house") {
- color := "{00FFFF}"
- if (name == "Nobody") {
- name := "Haus (frei)"
- } else if (name == "Auktion im CP") {
- name := "Haus (" . name . ")"
- } else {
- name := "Haus von " . name
- }
- location := " (" . calculateZone(entry["x"], entry["y"], 0.0) . ", " . calculateCity(entry["x"], entry["y"], 0.0) . ")"
- } else if (entry["type"] == "faction") {
- color := "{7F00FF}"
- location := " (" . calculateZone(entry["x"], entry["y"], 0.0) . ", " . calculateCity(entry["x"], entry["y"], 0.0) . ")"
- } else if (entry["type"] == "vehicle") {
- color := "{FF00FF}"
- }
- if (entry["x"] == -5000 || entry["y"] == -5000) {
- location := ""
- }
- if (store != "") {
- if (store == "BS" && name == "Burger Shot") {
- } else if (store == "SM" && name == "24/7") {
- } else if (store == "CB" && name == "Clucking Bell") {
- } else if (store == "CS" && name == "Binco") {
- } else if (store == "PS" && name == "Well Stacked Pizza") {
- } else {
- continue
- }
- SendClientMessage(PREFIX . SECCOL . "[GK " . id . "] " . color . "[ID: " . entry["type"] . "." . entry["id"] . "] " . name . location)
- if (showGK) {
- Sleep, 50
- showGK(entry["type"] . "." . entry["id"], true)
- }
- } else {
- SendClientMessage(PREFIX . SECCOL . "[GK] " . color . "[ID: " . entry["type"] . "." . entry["id"] . "] " . name . location)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement