diff --git a/UCDaccounts/login/client.lua b/UCDaccounts/login/client.lua index de7b9d7..5f2ad89 100644 --- a/UCDaccounts/login/client.lua +++ b/UCDaccounts/login/client.lua @@ -109,7 +109,7 @@ addEventHandler("onClientMouseLeave", guiRoot, function drawElements() dxDrawRectangle(0, 0, sX, sY, tocolor(0, 0, 0, 75), false, false, false, false) if (login.button.visible) then - dxDrawText("Remember my credentials", (1086 / nX) * sX, (595 / nY) * sY, (1329 / nX) * sX, (612 / nY) * sY, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center", false, false, false, false, true) + dxDrawText("Remember my credentials", (1086 / nX) * sX, (595 / nY) * sY, (1329 / nX) * sX, (612 / nY) * sY, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center", false, false, false, false, true) dxDrawText("Account Name", (1047 / nX) * sX, (433 / nY) * sY, (1329 / nX) * sX, (463 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) dxDrawText("Password", (1047 / nX) * sX, (513 / nY) * sY, (1329 / nX) * sX, (543 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) end @@ -118,18 +118,7 @@ function drawElements() dxDrawText("Email", (1047 / nX) * sX, (413 / nY) * sY, (1329 / nX) * sX, (443 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) dxDrawText("Password", (1047 / nX) * sX, (493 / nY) * sY, (1329 / nX) * sX, (523 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) dxDrawText("Confirm Password", (1047 / nX) * sX, (573 / nY) * sY, (1329 / nX) * sX, (603 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) - - --dxDrawText("Account Name", (1047 / nX) * sX, (383 / nY) * sY, (1329 / nX) * sX, (413 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) - --dxDrawText("Email", (1047 / nX) * sX, (463 / nY) * sY, (1329 / nX) * sX, (493 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) - --dxDrawText("Password", (1047 / nX) * sX, (543 / nY) * sY, (1329 / nX) * sX, (573 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) - --dxDrawText("Confirm Password", (1047 / nX) * sX, (623 / nY) * sY, (1329 / nX) * sX, (653 / nY) * sY, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "center", false, false, false, false, true) - end - - --dxDrawRectangle((567 / nX) * sX, (433 / nY) * sY, dxGetTextWidth("Login", 2, "default-bold"), (30 / nY) * sY, tocolor(0, 0, 0, 255), false, false, false, false) - --dxDrawRectangle((567 / nX) * sX, (483 / nY) * sY, dxGetTextWidth("Register", 2, "default-bold"), (30 / nY) * sY, tocolor(0, 0, 0, 255), false, false, false, false) - --dxDrawRectangle((567 / nX) * sX, (533 / nY) * sY, dxGetTextWidth("About UCD", 2, "default-bold"), (30 / nY) * sY, tocolor(0, 0, 0, 255), false, false, false, false) - --dxDrawRectangle((567 / nX) * sX, (583 / nY) * sY, dxGetTextWidth("Admins Online", 2, "default-bold"), (30 / nY) * sY, tocolor(0, 0, 0, 255), false, false, false, false) - --dxDrawRectangle((567 / nX) * sX, (633 / nY) * sY, dxGetTextWidth("Disconnect", 2, "default-bold"), (30 / nY) * sY, tocolor(0, 0, 0, 255), false, false, false, false) + end dxDrawText("Login", (567 / nX) * sX, (433 / nY) * sY, (725 / nX) * sX, (463 / nY) * sY, tocolor(255, 255, 255, 255), scale[1], "default-bold", "left", "center", false, false, false, false, true) dxDrawText("Register", (567 / nX) * sX, (483 / nY) * sY, (725 / nX) * sX, (513 / nY) * sY, tocolor(255, 255, 255, 255), scale[2], "default-bold", "left", "center", false, false, false, false, true) @@ -156,11 +145,15 @@ function onClientClick(button, state, aX, aY) end -- Login button if (aX >= lX and aX <= lW and aY >= lY and aY <= lH) then - for k, v in pairs(RPE) do - v.visible = false + if (RPE) then + for k, v in pairs(RPE) do + v.visible = false + end end - for k, v in pairs(LPE) do - v.visible = true + if (LPE) then + for k, v in pairs(LPE) do + v.visible = true + end end end end @@ -182,7 +175,6 @@ addEventHandler("onClientResourceStart", resourceRoot, if (not isPlayerLoggedIn(localPlayer)) then triggerServerEvent("UCDaccounts.removeLoginText", resourceRoot) triggerServerEvent("UCDadmin.banCheck", resourceRoot) - --triggerServerEvent("UCDaccounts.fetchUpdates", resourceRoot) guiSetInputEnabled(true) @@ -192,16 +184,17 @@ addEventHandler("onClientResourceStart", resourceRoot, b.alpha = 0 end - login.button = GuiButton((1047 / nX) * sX, (622 / nY) * sY, (272 / nX) * sX, (42 / nY) * sY, "Login", false) - login.checkbox = GuiCheckBox((1061 / nX) * sX, (595 / nY) * sY, (15 / nX) * sX, (17 / nY) * sY, "", false, false) - login.edit["usr"] = GuiEdit((1037 / nX) * sX, (467 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - login.edit["passwd"] = GuiEdit((1037 / nX) * sX, (549 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - login.edit["passwd"].masked = true - login.memo = GuiMemo((577 / nX) * sX, (719 / nY) * sY, (740 / nX) * sX, (316 / nY) * sY, "", false) - login.memo.readOnly = true - login.memo.text = "Fetching updates.." - fetchRemote("http://ucdmta.com/updates.txt", displayUpdates) - login.button.enabled = true + login.button = GuiButton((1047 / nX) * sX, (622 / nY) * sY, (272 / nX) * sX, (42 / nY) * sY, "Login", false) + login.checkbox = GuiCheckBox((1061 / nX) * sX, (595 / nY) * sY, (15 / nX) * sX, (17 / nY) * sY, "", false, false) + login.edit["usr"] = GuiEdit((1037 / nX) * sX, (467 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + login.edit["passwd"] = GuiEdit((1037 / nX) * sX, (549 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + login.memo = GuiMemo((577 / nX) * sX, (719 / nY) * sY, (740 / nX) * sX, (316 / nY) * sY, "", false) + login.memo.text = "Fetching updates..." + login.memo.readOnly = true + login.edit["passwd"].masked = true + login.button.enabled = true + + fetchRemote("http://ucdmta.com/updates.php", displayUpdates) LPE = {login.button, login.checkbox, login.edit["usr"], login.edit["passwd"]} for k, v in pairs(LPE) do @@ -212,13 +205,13 @@ addEventHandler("onClientResourceStart", resourceRoot, --addEventHandler("onClientGUIClick", login.button[2], onClickRegister, false) --addEventHandler("onClientGUIChanged", guiRoot, onLoginEditsChanged) - registration.button = GuiButton((1047/ nX) * sX, (657 / nY) * sY, (272 / nX) * sX, (42 / nY) * sY, "Register", false) - registration.edit["usr"] = GuiEdit((1037/ nX) * sX, (367 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - registration.edit["email"] = GuiEdit((1037/ nX) * sX, (447 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - registration.edit["passwd"] = GuiEdit((1037/ nX) * sX, (527 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - registration.edit["passwd_confirm"] = GuiEdit((1037/ nX) * sX, (607 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) - registration.edit["passwd"].masked = true - registration.edit["passwd_confirm"].masked = true + registration.button = GuiButton((1047/ nX) * sX, (657 / nY) * sY, (272 / nX) * sX, (42 / nY) * sY, "Register", false) + registration.edit["usr"] = GuiEdit((1037/ nX) * sX, (367 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + registration.edit["email"] = GuiEdit((1037/ nX) * sX, (447 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + registration.edit["passwd"] = GuiEdit((1037/ nX) * sX, (527 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + registration.edit["passwd_confirm"] = GuiEdit((1037/ nX) * sX, (607 / nY) * sY, (292 / nX) * sX, (40 / nY) * sY, "", false) + registration.edit["passwd"].masked = true + registration.edit["passwd_confirm"].masked = true --[[ registration.button = GuiButton((1047/ nX) * sX, (707 / nY) * sY, (272 / nX) * sX, (42 / nY) * sY, "Register", false) @@ -453,13 +446,17 @@ function onClickRegister(button, state, login) --guiBringToFront(registration.window[1]) --guiSetInputEnabled(true) - for _, v in pairs(RPE) do - v.visible = true + if (RPE) then + for _, v in pairs(RPE) do + v.visible = true + end end -- Hide other login elements - for _, v in pairs(LPE) do - v.visible = false + if (LPE) then + for _, v in pairs(LPE) do + v.visible = false + end end if (not isCursorShowing()) then showCursor(true) end @@ -536,7 +533,7 @@ addEvent("UCDaccounts.login.destroyInterface", true) addEventHandler("UCDaccounts.login.destroyInterface", root, destroyInterface) function toggleLogin() - if (login.button and isElement(login.button)) then + if (login and login.button and isElement(login.button)) then login.button.enabled = not login.button.enabled end end @@ -591,4 +588,4 @@ function xmllol() end end addEvent("UCDaccounts.login.saveAccountCredentials", true) -addEventHandler("UCDaccounts.login.saveAccountCredentials", root, xmllol) \ No newline at end of file +addEventHandler("UCDaccounts.login.saveAccountCredentials", root, xmllol) diff --git a/UCDaccounts/login/server.lua b/UCDaccounts/login/server.lua index 4d41bcc..6707372 100644 --- a/UCDaccounts/login/server.lua +++ b/UCDaccounts/login/server.lua @@ -20,7 +20,7 @@ local matrixViewPositions = { {1862.90833, -1452.45300, 140.37985, 1528.33813, -1258.09937, 215.22653}, {1674.29980, -895.24408, 531.87439, 1659.51709, -982.78577, 39.61652}, {-903.80847, 1740.82678, 171.57216, -720.15826, 2015.47437, 56.53033}, - -- My own bc I am god + -- My own bc I am [s]god[/s] I told you I don't believe in christmas kid - Risk (yes, bbc) {1380.4105, -748.9726, 104.6013, 1460.8162, -1051.0956, 95.9769}, {2139.718, 1899.7533, 12.9899, 2034.3885, 1921.8209, 14.3957}, {-1211.5592, -2928.3223, 67.2434, -1071.653, -2823.7144, 46.9938}, diff --git a/UCDadmin/GUI/UCDatm/HEAD b/UCDadmin/GUI/UCDatm/HEAD new file mode 100644 index 0000000..cb089cd --- /dev/null +++ b/UCDadmin/GUI/UCDatm/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/UCDadmin/GUI/UCDatm/config b/UCDadmin/GUI/UCDatm/config new file mode 100644 index 0000000..07d359d --- /dev/null +++ b/UCDadmin/GUI/UCDatm/config @@ -0,0 +1,4 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true diff --git a/UCDadmin/GUI/UCDatm/description b/UCDadmin/GUI/UCDatm/description new file mode 100644 index 0000000..498b267 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/UCDadmin/GUI/UCDatm/hooks/applypatch-msg.sample b/UCDadmin/GUI/UCDatm/hooks/applypatch-msg.sample new file mode 100755 index 0000000..a5d7b84 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/UCDadmin/GUI/UCDatm/hooks/commit-msg.sample b/UCDadmin/GUI/UCDatm/hooks/commit-msg.sample new file mode 100755 index 0000000..b58d118 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/UCDadmin/GUI/UCDatm/hooks/post-update.sample b/UCDadmin/GUI/UCDatm/hooks/post-update.sample new file mode 100755 index 0000000..ec17ec1 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/UCDadmin/GUI/UCDatm/hooks/pre-applypatch.sample b/UCDadmin/GUI/UCDatm/hooks/pre-applypatch.sample new file mode 100755 index 0000000..4142082 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/UCDadmin/GUI/UCDatm/hooks/pre-commit.sample b/UCDadmin/GUI/UCDatm/hooks/pre-commit.sample new file mode 100755 index 0000000..68d62d5 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/UCDadmin/GUI/UCDatm/hooks/pre-push.sample b/UCDadmin/GUI/UCDatm/hooks/pre-push.sample new file mode 100755 index 0000000..6187dbf --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/UCDadmin/GUI/UCDatm/hooks/pre-rebase.sample b/UCDadmin/GUI/UCDatm/hooks/pre-rebase.sample new file mode 100755 index 0000000..33730ca --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/UCDadmin/GUI/UCDatm/hooks/prepare-commit-msg.sample b/UCDadmin/GUI/UCDatm/hooks/prepare-commit-msg.sample new file mode 100755 index 0000000..f093a02 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/prepare-commit-msg.sample @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff --git a/UCDadmin/GUI/UCDatm/hooks/update.sample b/UCDadmin/GUI/UCDatm/hooks/update.sample new file mode 100755 index 0000000..80ba941 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/UCDadmin/GUI/UCDatm/info/exclude b/UCDadmin/GUI/UCDatm/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/UCDadmin/GUI/UCDatm/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/UCDadmin/GUI/actions_s.lua b/UCDadmin/GUI/actions_s.lua index a8af9ea..92b62dd 100644 --- a/UCDadmin/GUI/actions_s.lua +++ b/UCDadmin/GUI/actions_s.lua @@ -174,7 +174,9 @@ addEvent("UCDadmin.freeze", true) addEventHandler("UCDadmin.freeze", root, freezePlayer) function shoutToPlayer(plr, text) - -- Have to make this post GUI + if (not plr or not isElement(plr) or not text or not tostring(text)) then return end + exports.UCDdx:shout(plr, text) -- POST GUI'ED + exports.UCDlogging:adminLog(client.account.name, client.name.." has shouted '"..text.."' at "..plr.name) end addEvent("UCDadmin.shout", true) addEventHandler("UCDadmin.shout", root, shoutToPlayer) @@ -223,12 +225,16 @@ addEventHandler("UCDadmin.rename", root, renamePlayer) function takeScreenshotOfPlayer(plr) -- This one will take a while + -- If this'd be spammed we'd get rekt... end addEvent("UCDadmin.takeScreenshot", true) addEventHandler("UCDadmin.takeScreenshot", root, takeScreenshotOfPlayer) function setPlayerMoney_(plr, newAmount) - + if (not newAmount or not tonumber(newAmount) or tonumber(newAmount) == plr.money) then return end + -- if (plr == client) then return end for further use + plr.money = newAmount + exports.UCDlogging:adminLog(client.account.name, client.name.." has set "..plr.name.."'s money from $"..exports.UCDutil:tocomma(plr.money).." to $"..exports.UCDutil:tocomma(newAmount)) end addEvent("UCDadmin.setMoney", true) addEventHandler("UCDadmin.setMoney", root, setPlayerMoney_) @@ -314,7 +320,12 @@ function giveVehicle(plr, vehicle) local spawnedVehicle -- We're dealing with a vehicle ID - if tostring(vehicle):match("%d") and tonumber(vehicle) ~= false and tonumber(vehicle) ~= nil then + if (vehicle:gsub(" ", "") == "" or not Vehicle.getNameFromModel(vehicle)) then + exports.UCDdx:new(client, "You must specify a valid vehicle name or ID", 255, 0, 0) + return false + end + + if (tostring(vehicle):match("%d") and tonumber(vehicle) ~= false and tonumber(vehicle) ~= nil) then if (not Vehicle.getNameFromModel(vehicle) or Vehicle.getNameFromModel(vehicle) == "" or Vehicle.getNameFromModel(vehicle) == " ") then exports.UCDdx:new(client, "You must specify a valid vehicle name or ID", 255, 0, 0) return @@ -356,17 +367,22 @@ function fixVehicle_(plr, vehicle) return end if (vehicle:getData("vehicleID") and type(vehicle:getData("vehicleID")) == number) then - if (getPlayerAdminRank(client) < 4) then - exports.UCDdx:new(client, "You are not allowed to fix player vehicles until L4", 255, 0, 0) - return + --if (getPlayerAdminRank(client) < 4) then + -- exports.UCDdx:new(client, "You are not allowed to fix player vehicles until L4", 255, 0, 0) + -- return + --end + local vehicleID = vehicle:getData("vehicleID") + if (exports.UCDvehicles:getVehicleData(vehicleID, "owner") == client.account.name and not canAdminDoAction(client, 14)) then + exports.UCDdx:new(client, "You are not allowed to repair your own purchased vehicles", 255, 0, 0) + return false end - exports.UCDvehicles:setVehicleData(vehicle:getData("vehicleID"), "health", 1000) + exports.UCDvehicles:setVehicleData(vehicleID, "health", 1000) end exports.UCDvehicles:fix(vehicle) vehicle.health = 1000 - exports.UCDdx:new(client, "You have fixed "..plr.name.."'s "..vehicle.name, 0, 255, 0) - exports.UCDdx:new(plr, client.name.." has fixed your "..vehicle.name, 0, 255, 0) - exports.UCDlogging:adminLog(client.account.name, client.name.." has fixed "..plr.name.."'s "..vehicle.name) + exports.UCDdx:new(client, "You have fixed "..tostring(plr.name).."'s "..tostring(vehicle.name), 0, 255, 0) + exports.UCDdx:new(plr, client.name.." has fixed your "..tostring(vehicle.name), 0, 255, 0) + exports.UCDlogging:adminLog(client.account.name, tostring(client.name).." has fixed "..tostring(plr.name).."'s "..tostring(vehicle.name)) end end addEvent("UCDadmin.fixVehicle", true) @@ -378,9 +394,9 @@ function ejectPlayerFromVehicle(plr, vehicle) return end plr:removeFromVehicle(vehicle) - exports.UCDdx:new(client, "You have ejected "..plr.name.." from their "..vehicle.name, 0, 255, 0) - exports.UCDdx:new(plr, "You have been ejected from your "..vehicle.name.." by "..plr.name, 0, 255, 0) - exports.UCDlogging:adminLog(client.account.name, client.name.." has ejected "..plr.name.." from their vehicle") + exports.UCDdx:new(client, "You have ejected "..tostring(plr.name).." from their "..tostring(vehicle.name), 0, 255, 0) + exports.UCDdx:new(plr, "You have been ejected from your "..tostring(vehicle.name).." by "..tostring(client.name), 0, 255, 0) + exports.UCDlogging:adminLog(client.account.name, tostring(client.name).." has ejected "..tostring(plr.name).." from their "..tostring(vehicle.name)) end end addEvent("UCDadmin.ejectPlayer", true) @@ -389,19 +405,26 @@ addEventHandler("UCDadmin.ejectPlayer", root, ejectPlayerFromVehicle) function destroyVehicle(plr, vehicle) if (plr and client and isPlayerAdmin(client)) then -- The vehicle may have been a player vehicle and hence already destroyed client-side - if vehicle then + exports.UCDdx:new(plr, "Your "..tostring(vehicle.name).." has been destroyed by "..tostring(client.name), 0, 255, 0) + exports.UCDdx:new(client, "You have destroyed "..tostring(plr.name).."'s "..tostring(vehicle.name), 0, 255, 0) + exports.UCDlogging:adminLog(client.account.name, tostring(client.name).." has destroyed "..tostring(plr.name).."'s "..tostring(vehicle.name)) + if (vehicle) then vehicle:destroy() end - exports.UCDdx:new(plr, "Your vehicle has been destroyed by "..client.name, 0, 255, 0) - exports.UCDdx:new(client, "You have destroyed "..plr.name.."'s vehicle", 0, 255, 0) - exports.UCDlogging:adminLog(client.account.name, client.name.." has destroyed "..plr.name.."'s vehicle") end end addEvent("UCDadmin.destroyVehicle", true) addEventHandler("UCDadmin.destroyVehicle", root, destroyVehicle) function disableVehicle(plr, vehicle) - + if (plr and client and vehicle and isPlayerAdmin(client)) then + if (vehicle and isElement(vehicle) and vehicle.type == "vehicle") then + vehicle.health = 250 -- Events are automatically triggered in UCDvehicles/vehicleDamage_s.lua and UCDvehicles/vehicleDamage.lua + exports.UCDdx:new(plr, "Your "..tostring(vehicle.name).." has been disabled by "..tostring(client.name), 0, 255, 0) + exports.UCDdx:new(client, "You have disabled "..tostring(plr.name).."'s "..tostring(vehicle.name), 0, 255, 0) + exports.UCDlogging:adminLog(client.account.name, tostring(client.name).." has disabled "..tostring(plr.name).."'s "..tostring(vehicle.name)) + end + end end addEvent("UCDadmin.disableVehicle", true) addEventHandler("UCDadmin.disableVehicle", root, disableVehicle) @@ -411,3 +434,25 @@ function blowVehicle_(plr, vehicle) end addEvent("UCDadmin.blowVehicle", true) addEventHandler("UCDadmin.blowVehicle", root, blowVehicle_) + +function viewPunishments(plr) + if (not exports.UCDaccounts:isPlayerLoggedIn(plr)) then return end + local temp + for _, v in ipairs(punishments) do + if (plr.account.name == v[1] or plr.serial == v[4]) then + if (not temp) then temp = {} end + if (v[1] == plr.account.name) then + if (not temp.accPunishments) then temp.accPunishments = {} end + table.insert(temp.accPunishments, {v[4], v[7]}) + end + if (v[4] == plr.serial) then + if (not temp.serialPunishments) then temp.serialPunishments = {} end + table.insert(temp.serialPunishments, {v[1], v[7]}) + end + end + end + if (not temp) then return end -- To save bandwidth -for you, sir Noki-, if not no calling back + triggerClientEvent(client, "UCDadmin.viewPunishments.callback", client, temp) +end +addEvent("UCDadmin.viewPunishments.call", true) +addEventHandler("UCDadmin.viewPunishments.call", root, viewPunishments) -- calls back to insertPunishments in punishments/punishments_c.lua, if you are wonderin' \ No newline at end of file diff --git a/UCDadmin/GUI/c_panel.lua b/UCDadmin/GUI/c_panel.lua index d030bbb..e404408 100644 --- a/UCDadmin/GUI/c_panel.lua +++ b/UCDadmin/GUI/c_panel.lua @@ -34,176 +34,286 @@ local actions = { "Unjail", } -adminPanel.window[1] = GuiWindow(697, 262, 665, 504, "UCD | Administrative & Management Panel", false) -guiWindowSetSizable(adminPanel.window[1], false) -guiSetVisible(adminPanel.window[1], false) -exports.UCDutil:centerWindow(adminPanel.window[1]) -adminPanel.window[1].alpha = 1 - -adminPanel.tabpanel[1] = guiCreateTabPanel(10, 24, 645, 470, false, adminPanel.window[1]) - -adminPanel.tab[1] = guiCreateTab("Players", adminPanel.tabpanel[1]) - -adminPanel.gridlist[1] = guiCreateGridList(10, 40, 151, 395, false, adminPanel.tab[1]) -guiGridListAddColumn(adminPanel.gridlist[1], "Player Name", 0.9) -guiGridListSetSortingEnabled(adminPanel.gridlist[1], false) - -adminPanel.edit[1] = GuiEdit(10, 10, 151, 26, "", false, adminPanel.tab[1]) -adminPanel.label[1] = GuiLabel(170, 26, 290, 20, "Name: ", false, adminPanel.tab[1]) -adminPanel.label[2] = GuiLabel(170, 86, 290, 20, "IP: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[2], "right", false) -adminPanel.label[3] = GuiLabel(170, 66, 290, 20, "Serial: ", false, adminPanel.tab[1]) -adminPanel.label[4] = GuiLabel(171, 86, 289, 20, "Version: ", false, adminPanel.tab[1]) -adminPanel.label[5] = GuiLabel(170, 46, 290, 20, "Account Name: ", false, adminPanel.tab[1]) -adminPanel.label[6] = GuiLabel(171, 375, 289, 21, "Playtime: ", false, adminPanel.tab[1]) -adminPanel.label[7] = GuiLabel(170, 126, 290, 22, "Country: ", false, adminPanel.tab[1]) -adminPanel.label[9] = GuiLabel(170, 210, 290, 20, "Location: ", false, adminPanel.tab[1]) -adminPanel.label[10] = GuiLabel(170, 230, 290, 20, "Dimension: ", false, adminPanel.tab[1]) -adminPanel.label[11] = GuiLabel(170, 230, 290, 20, "Interior: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[11], "right", false) -adminPanel.label[12] = GuiLabel(170, 106, 290, 20, "Email: ", false, adminPanel.tab[1]) -adminPanel.label[13] = GuiLabel(170, 270, 290, 20, "Health: ", false, adminPanel.tab[1]) -adminPanel.label[14] = GuiLabel(170, 270, 290, 20, "Armour: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[14], "right", false) -adminPanel.label[15] = GuiLabel(171, 355, 289, 20, "Money: ", false, adminPanel.tab[1]) -adminPanel.label[16] = GuiLabel(170, 355, 290, 20, "Bank: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[16], "right", false) -adminPanel.label[17] = GuiLabel(170, 396, 291, 20, "Occupation: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[17], "right", false) -adminPanel.label[18] = GuiLabel(171, 396, 290, 20, "Class: ", false, adminPanel.tab[1]) -adminPanel.label[19] = GuiLabel(171, 335, 289, 20, "Group: ", false, adminPanel.tab[1]) -adminPanel.label[20] = GuiLabel(171, 375, 289, 21, "Team: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[20], "right", false) -adminPanel.label[21] = GuiLabel(170, 250, 267, 20, "Model: ", false, adminPanel.tab[1]) -adminPanel.label[22] = GuiLabel(171, 250, 290, 20, "Weapon: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[22], "right", false) -adminPanel.label[23] = GuiLabel(170, 26, 290, 20, "Ping: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[23], "right", false) -adminPanel.label[24] = GuiLabel(170, 416, 290, 20, "Vehicle: ", false, adminPanel.tab[1]) -adminPanel.label[25] = GuiLabel(170, 416, 290, 20, "Vehicle Health: ", false, adminPanel.tab[1]) -guiLabelSetHorizontalAlign(adminPanel.label[25], "right", false) -adminPanel.label[26] = GuiLabel(170, 190, 290, 20, "X: N/A; Y: N/A; Z: N/A", false, adminPanel.tab[1]) -adminPanel.label[27] = GuiLabel(170, 168, 49, 22, "Locality", false, adminPanel.tab[1]) -guiSetFont(adminPanel.label[27], "default-bold-small") -guiLabelSetColor(adminPanel.label[27], 255, 0, 0) -adminPanel.label[28] = GuiLabel(170, 4, 49, 22, "Player", false, adminPanel.tab[1]) -guiSetFont(adminPanel.label[28], "default-bold-small") -guiLabelSetColor(adminPanel.label[28], 255, 0, 0) -adminPanel.label[29] = GuiLabel(170, 313, 49, 22, "Misc", false, adminPanel.tab[1]) -guiSetFont(adminPanel.label[29], "default-bold-small") -guiLabelSetColor(adminPanel.label[29], 255, 0, 0) -adminPanel.button[1] = GuiButton(488, 52, 147, 18, "Warp to player", false, adminPanel.tab[1]) -adminPanel.button[2] = GuiButton(488, 10, 147, 36, "Punish", false, adminPanel.tab[1]) -adminPanel.button[3] = GuiButton(488, 144, 72, 18, "Spectate", false, adminPanel.tab[1]) -adminPanel.button[4] = GuiButton(488, 76, 147, 18, "Warp player to", false, adminPanel.tab[1]) -adminPanel.button[5] = GuiButton(488, 100, 72, 18, "Reconnect", false, adminPanel.tab[1]) -adminPanel.button[6] = GuiButton(563, 100, 72, 18, "Kick", false, adminPanel.tab[1]) -adminPanel.button[7] = GuiButton(488, 122, 72, 18, "Freeze", false, adminPanel.tab[1]) -adminPanel.button[8] = GuiButton(563, 122, 72, 18, "Shout", false, adminPanel.tab[1]) -adminPanel.button[9] = GuiButton(563, 144, 72, 18, "Slap", false, adminPanel.tab[1]) -adminPanel.button[10] = GuiButton(488, 167, 72, 18, "Rename", false, adminPanel.tab[1]) -adminPanel.button[11] = GuiButton(488, 318, 147, 20, "View punishments", false, adminPanel.tab[1]) -adminPanel.button[12] = GuiButton(563, 167, 72, 18, "Screenshot", false, adminPanel.tab[1]) -adminPanel.button[13] = GuiButton(563, 195, 72, 18, "Set Model", false, adminPanel.tab[1]) -adminPanel.button[14] = GuiButton(488, 195, 72, 18, "Money", false, adminPanel.tab[1]) -adminPanel.button[15] = GuiButton(488, 220, 72, 18, "Set Health", false, adminPanel.tab[1]) -adminPanel.button[16] = GuiButton(563, 220, 72, 18, "Set Armour", false, adminPanel.tab[1]) -adminPanel.button[17] = GuiButton(488, 244, 72, 18, "Dimension", false, adminPanel.tab[1]) -adminPanel.button[18] = GuiButton(563, 244, 72, 18, "Interior", false, adminPanel.tab[1]) -adminPanel.button[19] = GuiButton(488, 369, 72, 18, "Fix", false, adminPanel.tab[1]) -adminPanel.button[20] = GuiButton(563, 369, 72, 18, "Eject", false, adminPanel.tab[1]) -adminPanel.button[21] = GuiButton(488, 392, 72, 18, "Destroy", false, adminPanel.tab[1]) -adminPanel.button[22] = GuiButton(563, 392, 72, 18, "Disable", false, adminPanel.tab[1]) -adminPanel.button[23] = GuiButton(563, 266, 72, 18, "Set Job", false, adminPanel.tab[1]) -adminPanel.button[24] = GuiButton(488, 341, 72, 18, "Anticheat", false, adminPanel.tab[1]) -adminPanel.button[25] = GuiButton(563, 341, 72, 18, "View Weps", false, adminPanel.tab[1]) -adminPanel.button[26] = GuiButton(488, 290, 72, 18, "Weapons", false, adminPanel.tab[1]) -adminPanel.button[27] = GuiButton(488, 266, 72, 18, "Give Vehicle", false, adminPanel.tab[1]) -adminPanel.button[28] = GuiButton(488, 416, 72, 18, "Blow", false, adminPanel.tab[1]) -adminPanel.button[29] = GuiButton(563, 416, 72, 18, "Freeze", false, adminPanel.tab[1]) -adminPanel.button[30] = GuiButton(563, 290, 72, 18, "Last Logins", false, adminPanel.tab[1]) - --- Disable all at first -for i = 1, #adminPanel.button do - adminPanel.button[i].enabled = false +adminPanel.window = GuiWindow(697, 262, 665, 504, "UCD | Administrative & Management Panel", false) +guiWindowSetSizable(adminPanel.window, false) +guiSetVisible(adminPanel.window, false) +exports.UCDutil:centerWindow(adminPanel.window) +adminPanel.window.alpha = 1 + +adminPanel.tabpanel = guiCreateTabPanel(10, 24, 645, 470, false, adminPanel.window) + +adminPanel.tab["players"] = guiCreateTab("Players", adminPanel.tabpanel) + + adminPanel.gridlist[1] = guiCreateGridList(10, 40, 151, 395, false, adminPanel.tab["players"]) + guiGridListAddColumn(adminPanel.gridlist[1], "Player Name", 0.9) + guiGridListSetSortingEnabled(adminPanel.gridlist[1], false) + + adminPanel.edit[1] = GuiEdit(10, 10, 151, 26, "", false, adminPanel.tab["players"]) + adminPanel.label[1] = GuiLabel(170, 26, 290, 20, "Name: ", false, adminPanel.tab["players"]) + adminPanel.label[2] = GuiLabel(170, 86, 290, 20, "IP: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[2], "right", false) + adminPanel.label[3] = GuiLabel(170, 66, 290, 20, "Serial: ", false, adminPanel.tab["players"]) + adminPanel.label[4] = GuiLabel(171, 86, 289, 20, "Version: ", false, adminPanel.tab["players"]) + adminPanel.label[5] = GuiLabel(170, 46, 290, 20, "Account Name: ", false, adminPanel.tab["players"]) + adminPanel.label[6] = GuiLabel(171, 375, 289, 21, "Play time: ", false, adminPanel.tab["players"]) + adminPanel.label[7] = GuiLabel(170, 126, 290, 22, "Country: ", false, adminPanel.tab["players"]) + adminPanel.label[9] = GuiLabel(170, 210, 290, 20, "Location: ", false, adminPanel.tab["players"]) + adminPanel.label[10] = GuiLabel(170, 230, 290, 20, "Dimension: ", false, adminPanel.tab["players"]) + adminPanel.label[11] = GuiLabel(170, 230, 290, 20, "Interior: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[11], "right", false) + adminPanel.label[12] = GuiLabel(170, 106, 290, 20, "Email: ", false, adminPanel.tab["players"]) + adminPanel.label[13] = GuiLabel(170, 270, 290, 20, "Health: ", false, adminPanel.tab["players"]) + adminPanel.label[14] = GuiLabel(170, 270, 290, 20, "Armour: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[14], "right", false) + adminPanel.label[15] = GuiLabel(171, 355, 289, 20, "Money: ", false, adminPanel.tab["players"]) + adminPanel.label[16] = GuiLabel(170, 355, 290, 20, "Bank: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[16], "right", false) + adminPanel.label[17] = GuiLabel(170, 396, 291, 20, "Occupation: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[17], "right", false) + adminPanel.label[18] = GuiLabel(171, 396, 290, 20, "Class: ", false, adminPanel.tab["players"]) + adminPanel.label[19] = GuiLabel(171, 335, 289, 20, "Group: ", false, adminPanel.tab["players"]) + adminPanel.label[20] = GuiLabel(171, 375, 289, 21, "Team: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[20], "right", false) + adminPanel.label[21] = GuiLabel(170, 250, 267, 20, "Model: ", false, adminPanel.tab["players"]) + adminPanel.label[22] = GuiLabel(171, 250, 290, 20, "Weapon: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[22], "right", false) + adminPanel.label[23] = GuiLabel(170, 26, 290, 20, "Ping: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[23], "right", false) + adminPanel.label[24] = GuiLabel(170, 416, 290, 20, "Vehicle: ", false, adminPanel.tab["players"]) + adminPanel.label[25] = GuiLabel(170, 416, 290, 20, "Vehicle Health: ", false, adminPanel.tab["players"]) + guiLabelSetHorizontalAlign(adminPanel.label[25], "right", false) + adminPanel.label[26] = GuiLabel(170, 190, 290, 20, "X: N/A; Y: N/A; Z: N/A", false, adminPanel.tab["players"]) + adminPanel.label[27] = GuiLabel(170, 168, 49, 22, "Locality", false, adminPanel.tab["players"]) + guiSetFont(adminPanel.label[27], "default-bold-small") + guiLabelSetColor(adminPanel.label[27], 255, 0, 0) + adminPanel.label[28] = GuiLabel(170, 4, 49, 22, "Player", false, adminPanel.tab["players"]) + guiSetFont(adminPanel.label[28], "default-bold-small") + guiLabelSetColor(adminPanel.label[28], 255, 0, 0) + adminPanel.label[29] = GuiLabel(170, 313, 49, 22, "Misc", false, adminPanel.tab["players"]) + guiSetFont(adminPanel.label[29], "default-bold-small") + guiLabelSetColor(adminPanel.label[29], 255, 0, 0) + adminPanel.button[1] = GuiButton(488, 52, 147, 18, "Warp to player", false, adminPanel.tab["players"]) + adminPanel.button[2] = GuiButton(488, 10, 147, 36, "Punish", false, adminPanel.tab["players"]) + adminPanel.button[3] = GuiButton(488, 144, 72, 18, "Spectate", false, adminPanel.tab["players"]) + adminPanel.button[4] = GuiButton(488, 76, 147, 18, "Warp player to", false, adminPanel.tab["players"]) + adminPanel.button[5] = GuiButton(488, 100, 72, 18, "Reconnect", false, adminPanel.tab["players"]) + adminPanel.button[6] = GuiButton(563, 100, 72, 18, "Kick", false, adminPanel.tab["players"]) + adminPanel.button[7] = GuiButton(488, 122, 72, 18, "Freeze", false, adminPanel.tab["players"]) + adminPanel.button[8] = GuiButton(563, 122, 72, 18, "Shout", false, adminPanel.tab["players"]) + adminPanel.button[9] = GuiButton(563, 144, 72, 18, "Slap", false, adminPanel.tab["players"]) + adminPanel.button[10] = GuiButton(488, 167, 72, 18, "Rename", false, adminPanel.tab["players"]) + adminPanel.button[11] = GuiButton(488, 318, 147, 20, "View Punishments", false, adminPanel.tab["players"]) + adminPanel.button[12] = GuiButton(563, 167, 72, 18, "Screenshot", false, adminPanel.tab["players"]) + adminPanel.button[13] = GuiButton(563, 195, 72, 18, "Set Model", false, adminPanel.tab["players"]) + adminPanel.button[14] = GuiButton(488, 195, 72, 18, "Set Money", false, adminPanel.tab["players"]) + adminPanel.button[15] = GuiButton(488, 220, 72, 18, "Set Health", false, adminPanel.tab["players"]) + adminPanel.button[16] = GuiButton(563, 220, 72, 18, "Set Armour", false, adminPanel.tab["players"]) + adminPanel.button[17] = GuiButton(488, 244, 72, 18, "Dimension", false, adminPanel.tab["players"]) + adminPanel.button[18] = GuiButton(563, 244, 72, 18, "Interior", false, adminPanel.tab["players"]) + adminPanel.button[19] = GuiButton(488, 369, 72, 18, "Fix", false, adminPanel.tab["players"]) + adminPanel.button[20] = GuiButton(563, 369, 72, 18, "Eject", false, adminPanel.tab["players"]) + adminPanel.button[21] = GuiButton(488, 392, 72, 18, "Destroy", false, adminPanel.tab["players"]) + adminPanel.button[22] = GuiButton(563, 392, 72, 18, "Disable", false, adminPanel.tab["players"]) + adminPanel.button[23] = GuiButton(563, 266, 72, 18, "Set Job", false, adminPanel.tab["players"]) + adminPanel.button[24] = GuiButton(488, 341, 72, 18, "Anticheat", false, adminPanel.tab["players"]) + adminPanel.button[25] = GuiButton(563, 341, 72, 18, "View Weps", false, adminPanel.tab["players"]) + adminPanel.button[26] = GuiButton(488, 290, 72, 18, "Give Wep", false, adminPanel.tab["players"]) + adminPanel.button[27] = GuiButton(488, 266, 72, 18, "Give Vehicle", false, adminPanel.tab["players"]) + adminPanel.button[28] = GuiButton(488, 416, 72, 18, "Blow", false, adminPanel.tab["players"]) + adminPanel.button[29] = GuiButton(563, 416, 72, 18, "Freeze", false, adminPanel.tab["players"]) + adminPanel.button[30] = GuiButton(563, 290, 72, 18, "Last Logins", false, adminPanel.tab["players"]) + + -- Disable all at first + for i = 1, #adminPanel.button do + adminPanel.button[i].enabled = false + end + + confirm.window[1] = GuiWindow(792, 480, 324, 111, "UCD | Admin - ", false) + confirm.window[1].sizable = false + confirm.window[1].visible = false + confirm.button[1] = GuiButton(58, 82, 101, 19, "Confirm", false, confirm.window[1]) + confirm.button[2] = GuiButton(169, 82, 101, 19, "Cancel", false, confirm.window[1]) + confirm.edit[1] = GuiEdit(35, 47, 260, 25, "", false, confirm.window[1]) + confirm.label[1] = GuiLabel(36, 21, 259, 20, "Set the motherfucking label text nigga", false, confirm.window[1]) + guiLabelSetHorizontalAlign(confirm.label[1], "center", false) + guiLabelSetVerticalAlign(confirm.label[1], "center") + + WPT.window[1] = GuiWindow(850, 390, 201, 348, "UCD Admin | Warp Player To", false) + WPT.window[1].sizable = false + WPT.window[1].visible = false + WPT.button[1] = GuiButton(10, 304, 85, 34, "Warp Player To", false, WPT.window[1]) + WPT.label[1] = GuiLabel(10, 24, 179, 21, "Select a player from the grid", false, WPT.window[1]) + guiLabelSetHorizontalAlign(WPT.label[1], "center", false) + WPT.gridlist[1] = guiCreateGridList(10, 45, 178, 249, false, WPT.window[1]) + guiGridListAddColumn(WPT.gridlist[1], "Player", 0.9) + WPT.button[2] = GuiButton(103, 304, 85, 34, "Close", false, WPT.window[1]) + + local weapons = { + "Colt 45", "Silenced", "Deagle", "Shotgun", "Sawed-off", "Combat Shotgun", + "Uzi", "MP5", "Tec-9", "AK-47", "M4", "Rifle", "Sniper", + "Minigun", "Grenade", "Satchel", "Teargas", "Parachute" + } + giveWeapon_.window[1] = GuiWindow(244, 682, 317, 160, "UCD | Admin - Give Weapon", false) + giveWeapon_.window[1].sizable = false + giveWeapon_.window[1].visible = false + giveWeapon_.edit[1] = GuiEdit(226, 48, 81, 25, "", false, giveWeapon_.window[1]) + giveWeapon_.combobox[1] = GuiComboBox(10, 48, 197, 100, "", false, giveWeapon_.window[1]) + for _, wep in ipairs(weapons) do + guiComboBoxAddItem(giveWeapon_.combobox[1], wep) + end + giveWeapon_.label[1] = GuiLabel(10, 24, 197, 19, "Weapon", false, giveWeapon_.window[1]) + guiLabelSetHorizontalAlign(giveWeapon_.label[1], "center", false) + guiLabelSetVerticalAlign(giveWeapon_.label[1], "center") + giveWeapon_.label[2] = GuiLabel(226, 24, 81, 19, "Ammo", false, giveWeapon_.window[1]) + guiLabelSetHorizontalAlign(giveWeapon_.label[2], "center", false) + guiLabelSetVerticalAlign(giveWeapon_.label[2], "center") + giveWeapon_.button[1] = GuiButton(66, 120, 87, 22, "Confirm", false, giveWeapon_.window[1]) + giveWeapon_.button[2] = GuiButton(168, 120, 87, 22, "Close", false, giveWeapon_.window[1]) + + -- Punish window + punish.window = GuiWindow(535, 156, 272, 358, "UCD | Admin - Punish", false) + punish.window.visible = false + punish.window.sizable = false + punish.window.alpha = 255 + punish.combobox["rules"] = GuiComboBox(9, 73, 253, 240, "Select rule", false, punish.window) + for _, reason in ipairs(reasons) do + guiComboBoxAddItem(punish.combobox["rules"], tostring(reason)) + end + punish.edit["custom"] = GuiEdit(9, 38, 253, 25, "", false, punish.window) + punish.button["cancel"] = GuiButton(10, 310, 105, 38, "Cancel", false, punish.window) + punish.button["punish"] = GuiButton(157, 310, 105, 38, "Punish", false, punish.window) + punish.checkbox["custom_duration"] = GuiCheckBox(9, 141, 16, 16, "", false, false, punish.window) + punish.label[1] = GuiLabel(34, 141, 228, 16, "Use custom duration (otherwise it's auto)", false, punish.window) + punish.edit["min"] = GuiEdit(10, 167, 65, 29, "", false, punish.window) + punish.edit["hour"] = GuiEdit(99, 167, 65, 29, "", false, punish.window) + punish.edit["day"] = GuiEdit(188, 167, 65, 29, "", false, punish.window) + punish.radiobutton[1] = GuiRadioButton(10, 206, 15, 15, "", false, punish.window) + punish.label[2] = GuiLabel(35, 206, 40, 15, "Mins", false, punish.window) + punish.radiobutton[2] = GuiRadioButton(99, 206, 15, 15, "", false, punish.window) + punish.label[3] = GuiLabel(124, 206, 40, 15, "Hours", false, punish.window) + punish.radiobutton[3] = GuiRadioButton(187, 206, 15, 15, "", false, punish.window) + punish.label[4] = GuiLabel(212, 206, 40, 15, "Days", false, punish.window) + punish.combobox["punishtype"] = GuiComboBox(9, 231, 253, 117, "Select punish type", false, punish.window) + for _, action in ipairs(actions) do + guiComboBoxAddItem(punish.combobox["punishtype"], tostring(action)) + end + punish.edit["reason"] = GuiEdit(9, 106, 253, 25, "", false, punish.window) + punish.label[5] = GuiLabel(9, 21, 253, 16, "Manual syntax: acc:name or serial (bans only)", false, punish.window) + guiLabelSetHorizontalAlign(punish.label[5], "center", false) + punish.label[6] = GuiLabel(9, 271, 252, 16, "-1 minutes = permanent (bans only)", false, punish.window) + guiLabelSetHorizontalAlign(punish.label[6], "center", false) + + setJob = {} + setJob.window = GuiWindow(362, 112, 614, 376, "UCD | Set Job", false) + setJob.window.sizable = false + setJob.window.visible = false + setJob.window.alpha = 1 + setJob.playersGrid = GuiGridList(9, 25, 187, 281, false, setJob.window) + setJob.playersGrid:addColumn("Player:", 0.9) + setJob.jobsGrid = GuiGridList(213, 25, 187, 281, false, setJob.window) + setJob.jobsGrid:addColumn("Job:", 0.9) + setJob.skinsGrid = GuiGridList(416, 25, 187, 281, false, setJob.window) + setJob.skinsGrid:addColumn("Skin:", 0.5) + setJob.skinsGrid:addColumn("Skin ID:", 0.4) + setJob.setButton = GuiButton(9, 316, 187, 46, "Set player job", false, setJob.window) + setJob.removeButton = GuiButton(213, 316, 187, 46, "Remove player from job", false, setJob.window) + setJob.cancelButton = GuiButton(416, 316, 187, 46, "Cancel", false, setJob.window) + + viewPunish = {} + viewPunish.window = GuiWindow(0, 0, 825, 515, "UCD | Admin - View Punishments", false) + viewPunish.window.sizable = false + viewPunish.window.visible = false + viewPunish.tabPanel = GuiTabPanel(0, 20, 825, 455, false, viewPunish.window) + viewPunish.serialPunishTab = GuiTab("Serial punishments", viewPunish.tabPanel) + viewPunish.accountPunishTab = GuiTab("Account punishments", viewPunish.tabPanel) + viewPunish.serialPunishGrid = GuiGridList(10, 10, 790, 410, false, viewPunish.serialPunishTab) + viewPunish.accountPunishGrid = GuiGridList(10, 10, 790, 410, false, viewPunish.accountPunishTab) + viewPunish.closeButton = GuiButton(0, 480, 825, 20, "Close", false, viewPunish.window) + viewPunish.serialPunishGrid:addColumn("Account", 0.125) + viewPunish.serialPunishGrid:addColumn("Log", 0.747) + viewPunish.accountPunishGrid:addColumn("Serial", 0.25) + viewPunish.accountPunishGrid:addColumn("Log", 0.7) + + -- fuark this identation but i have to do the same + + viewLogins = {} + viewLogins.window = GuiWindow(0, 0, 825, 515, "UCD | Admin - View Last Logins", false) + viewLogins.window.sizable = false + viewLogins.window.visible = false + viewLogins.tabPanel = GuiTabPanel(0, 20, 825, 455, false, viewLogins.window) + viewLogins.serialLoginsTab = GuiTab("Serial punishments", viewLogins.tabPanel) + viewLogins.accountLoginsTab = GuiTab("Account punishments", viewLogins.tabPanel) + viewLogins.serialLoginsGrid = GuiGridList(10, 10, 790, 410, false, viewLogins.serialLoginsTab) + viewLogins.accountLoginsGrid = GuiGridList(10, 10, 790, 410, false, viewLogins.accountLoginsTab) + viewLogins.closeButton = GuiButton(0, 480, 825, 20, "Close", false, viewLogins.window) -- REMEMBERED IT HAHAHA + viewLogins.serialLoginsGrid:addColumn("Account", 0.125) + viewLogins.serialLoginsGrid:addColumn("Log", 0.747) + viewLogins.accountLoginsGrid:addColumn("Serial", 0.25) + viewLogins.accountLoginsGrid:addColumn("Log", 0.7) + +adminPanel.tab["bans"] = guiCreateTab("Bans", adminPanel.tabpanel) + adminPanel.gridlist["banList"] = GuiGridList(348, 11, 287, 425, false, adminPanel.tab["bans"]) + + adminPanel.label["banInfo"] = GuiLabel(10, 11, 328, 77, "Search, manage and remove bans here.\n\nNote: when searching for bans, prefix the ban value.\nAccounts are acc:name.\nSerials are always 32 characters in length.", false, adminPanel.tab["bans"]) + + adminPanel.edit["searchValue"] = GuiEdit(10, 126, 246, 29, "", false, adminPanel.tab["bans"]) + adminPanel.edit["searchBanisher"] = GuiEdit(10, 195, 246, 29, "", false, adminPanel.tab["bans"]) + + adminPanel.label["valueLabel"] = GuiLabel(10, 106, 246, 20, "Value:", false, adminPanel.tab["bans"]) + adminPanel.label["banisherLabel"] = GuiLabel(10, 175, 246, 20, "Banisher:", false, adminPanel.tab["bans"]) + + adminPanel.button["searchLabel"] = GuiButton(56, 234, 152, 36, "Search", false, adminPanel.tab["bans"]) + adminPanel.label["withSelected"] = GuiLabel(10, 289, 246, 16, "With selected:", false, adminPanel.tab["bans"]) + adminPanel.button["editBan"] = GuiButton(10, 400, 152, 36, "Edit Ban", false, adminPanel.tab["bans"]) + adminPanel.button["unban"] = GuiButton(172, 400, 152, 36, "Unban", false, adminPanel.tab["bans"]) + adminPanel.label["and/or"] = GuiLabel(10, 155, 246, 20, "and/or", false, adminPanel.tab["bans"]) + + adminPanel.label["bannedValue"] = GuiLabel(31, 311, 293, 15, "Value: ", false, adminPanel.tab["bans"]) + adminPanel.label["bannedOn"] = GuiLabel(31, 326, 293, 15, "When: ", false, adminPanel.tab["bans"]) + adminPanel.label["bannedDuration"] = GuiLabel(31, 341, 293, 15, "Duration: ", false, adminPanel.tab["bans"]) + adminPanel.label["bannedReason"] = GuiLabel(31, 356, 293, 15, "Reason:", false, adminPanel.tab["bans"]) + adminPanel.label["bannedBanisher"] = GuiLabel(31, 371, 293, 15, "Banisher:", false, adminPanel.tab["bans"]) + +adminPanel.tab["adminLog"] = guiCreateTab("Admin Log", adminPanel.tabpanel) + +function viewPunish.autoSize() + for _, gui in pairs(viewPunish) do + if (isElement(gui) and gui.type == "gui-gridlist") then -- isElement coz functions arent elements + for i = 1, gui.columnCount do + gui:autoSizeColumn(i) + gui:setColumnWidth(i, guiGridListGetColumnWidth(gui, i, true) + 0.006, true) + -- yeah auto size function doesn't work well, idk why doesn't it show last letter + -- i wonder why dont they make guiGridListGetColumnWidth in OOP + end + end + end end -confirm.window[1] = GuiWindow(792, 480, 324, 111, "UCD | Admin - ", false) -confirm.window[1].sizable = false -confirm.window[1].visible = false -confirm.button[1] = GuiButton(58, 82, 101, 19, "Confirm", false, confirm.window[1]) -confirm.button[2] = GuiButton(169, 82, 101, 19, "Cancel", false, confirm.window[1]) -confirm.edit[1] = GuiEdit(35, 47, 260, 25, "", false, confirm.window[1]) -confirm.label[1] = GuiLabel(36, 21, 259, 20, "Set the motherfucking label text nigga", false, confirm.window[1]) -guiLabelSetHorizontalAlign(confirm.label[1], "center", false) -guiLabelSetVerticalAlign(confirm.label[1], "center") - -WPT.window[1] = GuiWindow(850, 390, 201, 348, "UCD Admin | Warp Player To", false) -WPT.window[1].sizable = false -WPT.window[1].visible = false -WPT.button[1] = GuiButton(10, 304, 85, 34, "Warp Player To", false, WPT.window[1]) -WPT.label[1] = GuiLabel(10, 24, 179, 21, "Select a player from the grid", false, WPT.window[1]) -guiLabelSetHorizontalAlign(WPT.label[1], "center", false) -WPT.gridlist[1] = guiCreateGridList(10, 45, 178, 249, false, WPT.window[1]) -guiGridListAddColumn(WPT.gridlist[1], "Player", 0.9) -WPT.button[2] = GuiButton(103, 304, 85, 34, "Close", false, WPT.window[1]) - -local weapons = { - "Colt 45", "Silenced", "Deagle", "Shotgun", "Sawed-off", "Combat Shotgun", - "Uzi", "MP5", "Tec-9", "AK-47", "M4", "Rifle", "Sniper", - "Minigun", "Grenade", "Satchel", "Teargas", "Parachute" -} -giveWeapon_.window[1] = GuiWindow(244, 682, 317, 160, "UCD | Admin - Give Weapon", false) -giveWeapon_.window[1].sizable = false -giveWeapon_.window[1].visible = false -giveWeapon_.edit[1] = GuiEdit(226, 48, 81, 25, "", false, giveWeapon_.window[1]) -giveWeapon_.combobox[1] = GuiComboBox(10, 48, 197, 100, "", false, giveWeapon_.window[1]) -for _, wep in ipairs(weapons) do - guiComboBoxAddItem(giveWeapon_.combobox[1], wep) +function viewLogins.autoSize() -- use this to auto size columns after adding rows + for _, gui in pairs(viewLogins) do + if (isElement(gui) and gui.type == "gui-gridlist") then -- isElement coz functions arent elements + for i = 1, gui.columnCount do + gui:autoSizeColumn(i) + gui:setColumnWidth(i, guiGridListGetColumnWidth(gui, i, true) + 0.006, true) + -- yeah auto size function doesn't work well, idk why doesn't it show last letter + -- i wonder why dont they have guiGridListGetColumnWidth OOPed + -- yeah copied cuz lazy and no time + end + end + end end -giveWeapon_.label[1] = GuiLabel(10, 24, 197, 19, "Weapon", false, giveWeapon_.window[1]) -guiLabelSetHorizontalAlign(giveWeapon_.label[1], "center", false) -guiLabelSetVerticalAlign(giveWeapon_.label[1], "center") -giveWeapon_.label[2] = GuiLabel(226, 24, 81, 19, "Ammo", false, giveWeapon_.window[1]) -guiLabelSetHorizontalAlign(giveWeapon_.label[2], "center", false) -guiLabelSetVerticalAlign(giveWeapon_.label[2], "center") -giveWeapon_.button[1] = GuiButton(66, 120, 87, 22, "Confirm", false, giveWeapon_.window[1]) -giveWeapon_.button[2] = GuiButton(168, 120, 87, 22, "Close", false, giveWeapon_.window[1]) - --- Punish window -punish.window = GuiWindow(535, 156, 272, 358, "UCD | Admin - Punish", false) -punish.window.visible = false -punish.window.sizable = false -punish.window.alpha = 255 -punish.combobox["rules"] = GuiComboBox(9, 73, 253, 240, "Select rule", false, punish.window) -for _, reason in ipairs(reasons) do - guiComboBoxAddItem(punish.combobox["rules"], tostring(reason)) + +function viewPunish.close() + viewPunish.window.visible = false end -punish.edit["custom"] = GuiEdit(9, 38, 253, 25, "", false, punish.window) -punish.button["cancel"] = GuiButton(10, 310, 105, 38, "Cancel", false, punish.window) -punish.button["punish"] = GuiButton(157, 310, 105, 38, "Punish", false, punish.window) -punish.checkbox["custom_duration"] = GuiCheckBox(9, 141, 16, 16, "", false, false, punish.window) -punish.label[1] = GuiLabel(34, 141, 228, 16, "Use custom duration (otherwise it's auto)", false, punish.window) -punish.edit["min"] = GuiEdit(10, 167, 65, 29, "", false, punish.window) -punish.edit["hour"] = GuiEdit(99, 167, 65, 29, "", false, punish.window) -punish.edit["day"] = GuiEdit(188, 167, 65, 29, "", false, punish.window) -punish.radiobutton[1] = GuiRadioButton(10, 206, 15, 15, "", false, punish.window) -punish.label[2] = GuiLabel(35, 206, 40, 15, "Mins", false, punish.window) -punish.radiobutton[2] = GuiRadioButton(99, 206, 15, 15, "", false, punish.window) -punish.label[3] = GuiLabel(124, 206, 40, 15, "Hours", false, punish.window) -punish.radiobutton[3] = GuiRadioButton(187, 206, 15, 15, "", false, punish.window) -punish.label[4] = GuiLabel(212, 206, 40, 15, "Days", false, punish.window) -punish.combobox["punishtype"] = GuiComboBox(9, 231, 253, 117, "Select punish type", false, punish.window) -for _, action in ipairs(actions) do - guiComboBoxAddItem(punish.combobox["punishtype"], tostring(action)) +addEventHandler("onClientGUIClick", viewPunish.closeButton, viewPunish.close, false) + +function viewLogins.close() + viewLogins.window.visible = false end -punish.edit["reason"] = GuiEdit(9, 106, 253, 25, "", false, punish.window) -punish.label[5] = guiCreateLabel(9, 21, 253, 16, "Manual syntax: acc:name or serial (bans only)", false, punish.window) -guiLabelSetHorizontalAlign(punish.label[5], "center", false) -punish.label[6] = guiCreateLabel(9, 271, 252, 16, "-1 minutes = permanent (bans only)", false, punish.window) -guiLabelSetHorizontalAlign(punish.label[6], "center", false) +addEventHandler("onClientGUIClick", viewLogins.closeButton, viewLogins.close, false) -windows = {adminPanel.window[1], giveWeapon_.window[1], WPT.window[1], punish.window} +windows = {adminPanel.window, giveWeapon_.window[1], WPT.window[1], punish.window, setJob.window, viewPunish.window, viewLogins.window} for _, gui in ipairs(windows) do if (gui and isElement(gui)) then exports.UCDutil:centerWindow(gui) @@ -344,7 +454,7 @@ addEventHandler("onClientPlayerChangeNick", root, ) function updateInformation() - if (adminPanel.window[1].visible) then + if (adminPanel.window.visible) then -- Update team colours for i = 0, guiGridListGetRowCount(adminPanel.gridlist[1]) - 1 do local plr = guiGridListGetItemData(adminPanel.gridlist[1], i, 1) @@ -385,7 +495,7 @@ function updatePlayerInformation(plr, getServerSidedData) local class = plr:getData("Class") or "N/A" local occupation = plr:getData("Occupation") or "N/A" local ping = plr.ping - local suburb, city = getZoneName(loc.x, loc.y, loc.z), getZoneName(loc.x, loc.y, loc.z, true) + local suburb, city = getZoneName(loc), getZoneName(loc, true) local country = plr:getData("Country") or "N/A" local playtime = plr:getData("dxscoreboard_playtime") or "N/A" @@ -400,33 +510,30 @@ function updatePlayerInformation(plr, getServerSidedData) local vehicle, vehicleHealth if not plr.vehicle then vehicle = "Not in a vehicle" - vehicleHealth = "N/A" + vehicleHealth = "N/A" else vehicle = plr.vehicle.name vehicleHealth = tostring(exports.UCDutil:mathround(plr.vehicle.health / 10).."%") end - adminPanel.label[1]:setText("Name: "..name) - adminPanel.label[5]:setText("Account Name: "..accountName) - adminPanel.label[6]:setText("Playtime: "..playtime) - adminPanel.label[7]:setText("Country: "..country) - --adminPanel.label[8]:setText("Account ID: "..accountID) - adminPanel.label[9]:setText("Location: "..suburb..", "..city) - adminPanel.label[10]:setText("Dimension: "..dim) - adminPanel.label[11]:setText("Interior: "..int) - adminPanel.label[13]:setText("Health: "..health) - adminPanel.label[14]:setText("Armour: "..armour) - --adminPanel.label[15]:setText("Money: ".."$"..tostring(exports.UCDutil:tocomma(money))) - adminPanel.label[17]:setText("Occupation: "..occupation) - adminPanel.label[18]:setText("Class: "..class) - adminPanel.label[19]:setText("Group: "..group) - adminPanel.label[20]:setText("Team: "..team) - adminPanel.label[21]:setText("Model: "..model) - --adminPanel.label[22]:setText("Weapon: "..tostring(weapon).." ["..tostring(ammo).."]") - adminPanel.label[23]:setText("Ping: "..ping) - adminPanel.label[24]:setText("Vehicle: "..vehicle) - adminPanel.label[25]:setText("Vehicle Health: "..vehicleHealth) - adminPanel.label[26]:setText("X: "..exports.UCDutil:mathround(loc.x, 3).."; Y: "..exports.UCDutil:mathround(loc.y, 3).."; Z: "..exports.UCDutil:mathround(loc.z, 3)) + adminPanel.label[1]:setText("Name: "..tostring(name)) + adminPanel.label[5]:setText("Account Name: "..tostring(accountName)) + adminPanel.label[6]:setText("Play Time: "..tostring(playtime)) + adminPanel.label[7]:setText("Country: "..tostring(country)) + adminPanel.label[9]:setText("Location: "..tostring(suburb)..", "..tostring(city)) + adminPanel.label[10]:setText("Dimension: "..tostring(dim)) + adminPanel.label[11]:setText("Interior: "..tostring(int)) + adminPanel.label[13]:setText("Health: "..tostring(health)) + adminPanel.label[14]:setText("Armour: "..tostring(armour)) + adminPanel.label[17]:setText("Occupation: "..tostring(occupation)) + adminPanel.label[18]:setText("Class: "..tostring(class)) + adminPanel.label[19]:setText("Group: "..tostring(group)) + adminPanel.label[20]:setText("Team: "..tostring(team)) + adminPanel.label[21]:setText("Model: "..tostring(model)) + adminPanel.label[23]:setText("Ping: "..tostring(ping)) + adminPanel.label[24]:setText("Vehicle: "..tostring(vehicle)) + adminPanel.label[25]:setText("Vehicle Health: "..tostring(vehicleHealth)) + adminPanel.label[26]:setText("X: "..tostring(exports.UCDutil:mathround(loc.x, 3)).."; Y: "..tostring(exports.UCDutil:mathround(loc.y, 3)).."; Z: "..tostring(exports.UCDutil:mathround(loc.z, 3))) if (getServerSidedData) then -- This has a callback function where the data is updated @@ -437,12 +544,21 @@ end function requestPlayerData_callback(sync) --outputDebugString("Client callback") local data = sync +<<<<<<< HEAD adminPanel.label[2]:setText("IP: "..data["ip"]) adminPanel.label[3]:setText("Serial: "..data["serial"]) adminPanel.label[4]:setText("Version: "..data["version"]) adminPanel.label[12]:setText("Email: "..data["email"] or "N/A") adminPanel.label[16]:setText("Bank: ".."$"..tostring(exports.UCDutil:tocomma(data["bank"]))) adminPanel.label[15]:setText("Money: $"..tostring(exports.UCDutil:tocomma(data["money"]))) +======= + adminPanel.label[2]:setText("IP: "..tostring(data["ip"] or "N/A")) + adminPanel.label[3]:setText("Serial: "..tostring(data["serial"] or "N/A")) + adminPanel.label[4]:setText("Version: "..tostring(data["version"] or "N/A")) + adminPanel.label[12]:setText("Email: "..tostring(data["email"] or "N/A")) + adminPanel.label[16]:setText("Bank: ".."$"..tostring(exports.UCDutil:tocomma(data["bank"]) or "0")) + adminPanel.label[15]:setText("Money: $"..tostring(exports.UCDutil:tocomma(data["money"]) or "0")) +>>>>>>> bitbucket/master adminPanel.label[22]:setText("Weapon: "..tostring(data["weapon"])) end addEvent("UCDadmin.requestPlayerData:callback", true) @@ -462,7 +578,7 @@ function playerSelection() adminPanel.label[3]:setText("Serial: ") adminPanel.label[4]:setText("Version: ") adminPanel.label[5]:setText("Account Name: ") - adminPanel.label[6]:setText("Playtime: ") + adminPanel.label[6]:setText("Play Time: ") adminPanel.label[7]:setText("Country: ") adminPanel.label[9]:setText("Location: ") adminPanel.label[10]:setText("Dimension: ") @@ -496,18 +612,19 @@ function toggleWPT(plr) guiBringToFront(WPT.window[1]) for _, player in ipairs(Element.getAllByType("player")) do if (plr ~= player and exports.UCDaccounts:isPlayerLoggedIn(player)) then - local r, g, b + + local r, g, b = 255, 255, 255 + if (player.team) then - r, g, b = player.team:getColor() - else - r, g, b = 255, 255, 255 - end - local row = guiGridListAddRow(WPT.gridlist[1]) - guiGridListSetItemText(WPT.gridlist[1], row, 1, tostring(player.name), false, false) - guiGridListSetItemData(WPT.gridlist[1], row, 1, player) - guiGridListSetItemColor(WPT.gridlist[1], row, 1, r, g, b) - end -end + r, g, b = player.team:getColor() + end + + local row = guiGridListAddRow(WPT.gridlist[1]) + guiGridListSetItemText(WPT.gridlist[1], row, 1, tostring(player.name), false, false) + guiGridListSetItemData(WPT.gridlist[1], row, 1, player) + guiGridListSetItemColor(WPT.gridlist[1], row, 1, r, g, b) + end + end end end end @@ -532,7 +649,7 @@ addEventHandler("onClientGUIClick", WPT.button[1], handleWPTInput) addEventHandler("onClientGUIClick", WPT.button[2], handleWPTInput) function adminAction() - if (source ~= adminPanel.gridlist[1] and source.parent == adminPanel.tab[1]) then + if (source ~= adminPanel.gridlist[1] and source.parent == adminPanel.tab["players"]) then local plr = getSelectedPlayer() local action = source.text:lower() if not action then return end @@ -548,7 +665,7 @@ function adminAction() end if (action == "punish") then --- open punish gui + -- open punish gui elseif (action == "warp to player") then triggerServerEvent("UCDadmin.warpToPlayer", localPlayer, plr) elseif (action == "warp player to") then @@ -565,7 +682,7 @@ function adminAction() triggerServerEvent("UCDadmin.freeze", localPlayer, plr) end elseif (action == "shout") then - + createInputBox("UCD | Admin - Shout", "Enter the desired text", "", "UCDadmin.shout", localPlayer, plr) elseif (action == "spectate") then triggerServerEvent("UCDadmin.spectate", resourceRoot, plr) elseif (action == "slap") then @@ -573,9 +690,9 @@ function adminAction() elseif (action == "rename") then createInputBox("UCD | Admin - Rename", "Enter the desired name", exports.UCDutil:randomstring(8), "UCDadmin.rename", localPlayer, plr) elseif (action == "screenshot") then - - elseif (action == "money") then - + -- read actions_s.lua pls + elseif (action == "set money") then + createInputBox("UCD | Admin - Set Money", "Enter the desired amount of money", "", "UCDadmin.setMoney", localPlayer, plr) elseif (action == "set model") then createInputBox("UCD | Admin - Model", "Enter the desired model", 0, "UCDadmin.setModel", localPlayer, plr) elseif (action == "set health") then @@ -591,15 +708,42 @@ function adminAction() elseif (action == "last logins") then elseif (action == "set job") then - triggerEvent("UCDadmin.setjob.openGUI", resourceRoot, plr) - elseif (action == "weapons") then + openGUI(plr) + -- elseif (action == "give wep") then handled #328 elseif (action == "view punishments") then - + triggerServerEvent("UCDadmin.viewPunishments.call", localPlayer, plr) + viewPunish.window.visible = true + guiBringToFront(viewPunish.window) + viewPunish.serialPunishGrid:clear() + viewPunish.accountPunishGrid:clear() + local serialRow = viewPunish.serialPunishGrid:addRow() + local accountRow = viewPunish.accountPunishGrid:addRow() + viewPunish.serialPunishGrid:setItemText(serialRow, 1, "CLEAR", true, false) + viewPunish.serialPunishGrid:setItemText(serialRow, 2, "CLEAR", true, false) + viewPunish.accountPunishGrid:setItemText(accountRow, 1, "CLEAR", true, false) + viewPunish.accountPunishGrid:setItemText(accountRow, 2, "CLEAR", true, false) elseif (action == "anticheat") then elseif (action == "view weps") then - + outputChatBox("VIEWING "..tostring(plr.name).."'s WEAPONS", 255, 255, 0) + outputChatBox("FORMAT: SLOT - ID - NAME - AMMO", 255, 140, 0) + for i = 0, 13 do + local wep = getPedWeapon(plr, i) + if (wep and wep > 0) then + local ammo = getPedTotalAmmo(plr, i) + if (ammo and ammo > 0) then + local str = string.format("%s - %s - %s - %s", + tostring(i), + tostring(wep), + tostring(getWeaponNameFromID(wep)), + tostring(getPedTotalAmmo(plr, i)) + ) -- just like tables(table = {row1, row2, ...\n}) + outputChatBox(str, 255, 0, 255) + end + end + end + outputChatBox("DONE - P.S. If the player has no weapons no lines would be outputted", 255, 255, 0) elseif (action == "fix") then if (plr.vehicle) then triggerServerEvent("UCDadmin.fixVehicle", localPlayer, plr, plr.vehicle) @@ -621,7 +765,9 @@ function adminAction() -- exports.UCDdx:new("This player is not in a vehicle", 255, 0, 0) end elseif (action == "disable") then - + if (plr.vehicle) then + triggerServerEvent("UCDadmin.disableVehicle", resourceRoot, plr, plr.vehicle) + end elseif (action == "blow") then elseif (action == "give vehicle") then @@ -637,9 +783,9 @@ addEventHandler("onClientGUIClick", guiRoot, adminAction) function toggleGUI() if (not _permissions) then return end - adminPanel.window[1].visible = not adminPanel.window[1].visible - showCursor(adminPanel.window[1].visible) - if (adminPanel.window[1].visible) then + adminPanel.window.visible = not adminPanel.window.visible + showCursor(adminPanel.window.visible) + if (adminPanel.window.visible) then guiSetInputMode("no_binds_when_editing") else guiSetInputMode("allow_binds") @@ -653,5 +799,5 @@ function toggleGUI() closeInputBox() end end -addCommandHandler("adminpanel", toggleGUI) +addCommandHandler("adminpanel", toggleGUI, false, false) bindKey("p", "down", "adminpanel") diff --git a/UCDadmin/punishments/punishments.lua b/UCDadmin/punishments/punishments.lua index e124b18..6520c4e 100644 --- a/UCDadmin/punishments/punishments.lua +++ b/UCDadmin/punishments/punishments.lua @@ -1,6 +1,6 @@ local types = {["mute"] = "muted", ["admin jail"] = "jailed"} local infr = 300 -- Infraction base number, no of infractions * base = time (0 = base) -local punishments = {} +punishments = {} addEventHandler("onResourceStart", resourceRoot, function () diff --git a/UCDadmin/punishments/punishments_c.lua b/UCDadmin/punishments/punishments_c.lua index 60d28ff..0ad5cb6 100644 --- a/UCDadmin/punishments/punishments_c.lua +++ b/UCDadmin/punishments/punishments_c.lua @@ -96,3 +96,25 @@ function customTimeShit() end customTimeShit() -- Do this once to disable them addEventHandler("onClientGUIClick", punish.checkbox["custom_duration"], customTimeShit, false) + +function viewPunish.insertPunishments(data) + viewPunish.accountPunishGrid:clear() + viewPunish.serialPunishGrid:clear() + if (data.accPunishments) then + for _, v in ipairs(data.accPunishments) do + local row = viewPunish.accountPunishGrid:addRow() + viewPunish.accountPunishGrid:setItemText(row, 1, v[1], false, false) + viewPunish.accountPunishGrid:setItemText(row, 2, v[2], false, false) + end + end + if (data.serialPunishments) then + for _, v in ipairs(data.serialPunishments) do + local row = viewPunish.serialPunishGrid:addRow() + viewPunish.serialPunishGrid:setItemText(row, 1, v[1], false, false) + viewPunish.serialPunishGrid:setItemText(row, 2, v[2], false, false) + end + end + viewPunish.autoSize() +end +addEvent("UCDadmin.viewPunishments.callback", true) +addEventHandler("UCDadmin.viewPunishments.callback", resourceRoot, viewPunish.insertPunishments) \ No newline at end of file diff --git a/UCDadmin/setjob/setjob.lua b/UCDadmin/setjob/setjob.lua index 68cbb7d..2c741bf 100644 --- a/UCDadmin/setjob/setjob.lua +++ b/UCDadmin/setjob/setjob.lua @@ -1,55 +1,44 @@ -window = GuiWindow(362, 112, 614, 376, "UCD | Set Job", false) -window.sizable = false -window.visible = false -window.alpha = 1 -local screen_width, screen_height = guiGetScreenSize() -window:setPosition((screen_width-614)/2, (screen_height-376)/2, false) -local openType = "source" - -players_grid = GuiGridList(9, 25, 187, 281, false, window) -players_grid:addColumn("Player:", 0.9) -jobs_grid = GuiGridList(213, 25, 187, 281, false, window) -jobs_grid:addColumn("Job:", 0.9) -skins_grid = GuiGridList(416, 25, 187, 281, false, window) -skins_grid:addColumn("Skin:", 0.5) -skins_grid:addColumn("Skin ID", 0.4) -set_button = GuiButton(9, 316, 187, 46, "Set player job", false, window) -remove_button = GuiButton(213, 316, 187, 46, "Remove player from job", false, window) -cancel_button = GuiButton(416, 316, 187, 46, "Cancel", false, window) - local jobs = exports.UCDjobsTable:getJobTable() -for name, skins in pairs(jobs) do -- Insert all jobs into gridlist +for name, data in pairs(jobs) do -- Insert all jobs into gridlist if (#name > 0) then - jobs_grid:setItemText(jobs_grid:addRow(), 1, name, false, false) + local row = setJob.jobsGrid:addRow() + local r, g, b = 255, 255, 255 + if (data.colour and type(data.colour) == "table") then + r, g, b = data.colour.r, data.colour.g, data.colour.b + else + if (data.team and Team.getFromName(data.team)) then + r, g, b = Team.getFromName(data.team):getColor() + end + end + setJob.jobsGrid:setItemText(row, 1, name, false, false) + setJob.jobsGrid:setItemColor(row, 1, r, g, b) end end -for _, player in ipairs(Element.getAllByType("player")) do -- Insert all players into gridlist - players_grid:setItemText(players_grid:addRow(), 1, player.name, false, false) -end - -function requestOpenGUI() - window.visible = not window.visible - showCursor(window.visible) - openType = "source" +for _, plr in ipairs(Element.getAllByType("player")) do -- Insert all players into gridlist + local row = setJob.playersGrid:addRow() + local r, g, b = 255, 255, 255 + if (plr.team) then + r, g, b = plr.team:getColor() + end + setJob.playersGrid:setItemText(row, 1, tostring(plr.name), false, false) + setJob.playersGrid:setItemColor(row, 1, r, g, b) end -addEvent("onOpenGUIRequest", true) -addEventHandler("onOpenGUIRequest", resourceRoot, requestOpenGUI) function connect_quit_change_nick(oldNick, newNick) -- Keep the players gridlist up-to-date if (eventName == "onClientPlayerJoin") then - players_grid:setItemText(players_grid:addRow(), 1, source.name, false, false) + setJob.playersGrid:setItemText(setJob.playersGrid:addRow(), 1, source.name, false, false) elseif (eventName == "onClientPlayerQuit") then - for i = 1, players_grid.rowCount do - if (players_grid:getItemText(i, 1) == source.name) then - players_grid:removeRow(i) + for i = 1, setJob.playersGrid.rowCount do + if (setJob.playersGrid:getItemText(i, 1) == source.name) then + setJob.playersGrid:removeRow(i) end end elseif (eventName == "onClientPlayerChangeNick") then - for i = 0, players_grid.rowCount do - if (players_grid:getItemText(i, 1) == oldNick) then - players_grid:setItemText(i, 1, newNick, false, false) + for i = 0, setJob.playersGrid.rowCount do + if (setJob.playersGrid:getItemText(i, 1) == oldNick) then + setJob.playersGrid:setItemText(i, 1, newNick, false, false) end end end @@ -61,44 +50,39 @@ addEventHandler("onClientPlayerChangeNick", root, connect_quit_change_nick) addEventHandler("onClientGUIClick", root, function(button, state) if (button ~= "left" or state ~= "up") then return end - if (source == jobs_grid) then - local row = jobs_grid:getSelectedItem() - skins_grid:clear() + if (source == setJob.jobsGrid) then + local row = setJob.jobsGrid:getSelectedItem() + setJob.skinsGrid:clear() if (row and row ~= -1) then - local name = jobs_grid:getItemText(row, 1) - local skins = jobs[jobs_grid:getItemText(row, 1)].skins + local name = setJob.jobsGrid:getItemText(row, 1) + local skins = jobs[setJob.jobsGrid:getItemText(row, 1)].skins if (skins) then if (type(skins) == "table") then for _, data in pairs(skins) do - local _row = skins_grid:addRow() - skins_grid:setItemText(_row, 1, data[2], false, false) - skins_grid:setItemText(_row, 2, data[1], false, false) + local _row = setJob.skinsGrid:addRow() + setJob.skinsGrid:setItemText(_row, 1, data[2], false, false) + setJob.skinsGrid:setItemText(_row, 2, data[1], false, false) end end end end - elseif (source == cancel_button) then - window:setVisible(false) - if (openType == "source") then + elseif (source == setJob.cancelButton) then + setJob.window.visible = false + if (not adminPanel.window.visible) then showCursor(false) end - elseif (source == set_button or source == remove_button) then - local player = Player(players_grid:getItemText(players_grid:getSelectedItem())) + elseif (source == setJob.setButton or source == setJob.removeButton) then + local player = Player(setJob.playersGrid:getItemText(setJob.playersGrid:getSelectedItem())) if (player) then local selected_job, selected_model - if (source == set_button) then - selected_job = jobs_grid:getItemText(jobs_grid:getSelectedItem()) - selected_model = skins_grid:getItemText(skins_grid:getSelectedItem(), 2) - outputDebugString(tostring(selected_job)) - if ((not selected_model or selected_model == "") and guiGridListGetRowCount(skins_grid) ~= 0) then + if (source == setJob.setButton) then + selected_job = setJob.jobsGrid:getItemText(setJob.jobsGrid:getSelectedItem()) + selected_model = setJob.skinsGrid:getItemText(setJob.skinsGrid:getSelectedItem(), 2) + if ((not selected_model or selected_model == "") and guiGridListGetRowCount(setJob.skinsGrid) ~= 0) then exports.UCDdx:new("You must select a skin from the list", 255, 0, 0) return end else - if ((not selected_model or selected_model == "") and guiGridListGetRowCount(skins_grid) ~= 0) then - exports.UCDdx:new("You must select a skin from the list", 255, 0, 0) - return - end selected_job = "" end triggerServerEvent("UCDadmin.setjob.setJob", resourceRoot, player, selected_job, selected_model) @@ -107,16 +91,16 @@ addEventHandler("onClientGUIClick", root, end ) -function openGUIPlayer(player) - window:setVisible(true) - guiBringToFront(window) +function openGUI(player) + setJob.window.visible = true + guiBringToFront(setJob.window) showCursor(true) - openType = "admin panel" - for i = 1, players_grid.rowCount do - if (players_grid:getItemText(i, 1) == player.name) then - players_grid:setSelectedItem(i, 1) + if (not player) then return end + for i = 0, setJob.playersGrid.rowCount do + if (setJob.playersGrid:getItemText(i, 1) == player.name) then + setJob.playersGrid:setSelectedItem(i, 1) end end end addEvent("UCDadmin.setjob.openGUI", true) -addEventHandler("UCDadmin.setjob.openGUI", resourceRoot, openGUIPlayer) \ No newline at end of file +addEventHandler("UCDadmin.setjob.openGUI", resourceRoot, openGUI) \ No newline at end of file diff --git a/UCDadmin/setjob/setjob.slua b/UCDadmin/setjob/setjob.slua index 2753caf..f773e5c 100644 --- a/UCDadmin/setjob/setjob.slua +++ b/UCDadmin/setjob/setjob.slua @@ -2,13 +2,10 @@ function requestOpenGUI(player) if (isElement(player)) then client = player end - --if (ACLGroup.get("Admin"):doesContainObject("user."..client.account.name)) then - if (isPlayerAdmin(client)) then - triggerClientEvent(client, "onOpenGUIRequest", resourceRoot) + if (canAdminDoAction(player, 23)) then + triggerLatentClientEvent(client, "UCDadmin.setjob.openGUI", resourceRoot) end end -addEvent("onOpenGUIRequest", true) -addEventHandler("onOpenGUIRequest", resourceRoot, requestOpenGUI) addCommandHandler("setjob", requestOpenGUI) addEvent("UCDadmin.setjob.setJob", true) diff --git a/UCDadmin/warp/client.lua b/UCDadmin/warp/client.lua index 538d4cc..b2cf723 100644 --- a/UCDadmin/warp/client.lua +++ b/UCDadmin/warp/client.lua @@ -1,72 +1,82 @@ --- Warp points by HellStunter -local positions = -{ - ["LV Airport"] = {1707.2239, 1607.8732, 10.0156}, - ["Restricted Area"] = {214.1687, 1911.5682, 17.6406}, - ["The Sherman Dam"] = {-893.0352, 1998.78, 60.9141}, - ["SF Ship"] = {-1468.334, 1490.0498, 8.2578}, - ["SF Gant Bridge"] = {-2655.8728, 1596.3607, 64.5165}, - ["SF Police Department"] = {-1615.0035, 667.2029, 7.1875}, - ["SF Docks"] = {-2897.3108, 457.6115, 4.9141}, - ["SF Hospital"] = {-2667.3772, 593.3926, 14.4531}, - ["SF Airport"] = {-1666.1599, -401.2081, 14.1484}, - ["Mount Chillad"] = {-2238.6616, -1731.6495, 480.4632}, - ["Santa Maria Beach"] = {482.1791, -1853.8127, 3.7268}, - ["White House"] = {1255.2522, -2030.9908, 59.5556}, - ["LS Airport"] = {1962.8151, -2194.1438, 13.5469}, - ["LS Police Department"] = {1539.0527, -1674.7443, 13.5469}, - ["LS All Saints Hospital"] = {1189.0702, -1324.7906, 13.5671}, - ["LS Jefferson Hospital"] = {2011.6215, -1435.8839, 13.5547}, - ["Dillimore"] = {648.8795, -561.3219, 16.2489}, - ["Palomino Creek"] = {2349.6997, 81.1277, 26.4844}, - ["LV Police Department"] = {2233.646, 2453.5923, 10.8245}, - ["Spinybed"] = {2481.0706, 2751.9346, 10.8203}, - ["Verdant Meadows"] = {399.7484, 2528.8411, 16.5755}, - ["Bayside Marina"] = {-2269.199, 2347.9468, 4.8202}, +-- Warp panel by HellStunter +local positions = { + {1707.2239, 1607.8732, 10.0156, 270.94384765625, "Las Venturas Airport"}, + {2233.646, 2453.5923, 10.8245, 177.72918701172, "Las Venturas Police Department"}, + {214.1687, 1911.5682, 17.6406, 179.93859863281, "Area 51"}, + {-893.0352, 1998.78, 60.9141, 249.41040039063, "The Sherman Dam"}, + {-1468.334, 1490.0498, 8.2578, 269.69522094727, "San Fierro Da-Nang Boys Ship"}, + {-2655.8728, 1596.3607, 64.5165, 86.292449951172, "San Fierro Gant Bridge"}, + {-1615.0035, 667.2029, 7.1875, 268.8996887207, "San Fierro Police Department"}, + {-2897.3108, 457.6115, 4.9141, 268.99917602539, "San Fierro Docks"}, + {-2667.3772, 593.3926, 14.4531, 181.69494628906, "San Fierro Hospital"}, + {-1666.1599, -401.2081, 14.1484, 134.51873779297, "San Fierro Airport"}, + {-2238.6616, -1731.6495, 480.4632, 49.358123779297, "Mount Chillad"}, + {482.1791, -1853.8127, 3.7268, 359.69595336914, "Santa Maria Beach"}, + {1255.2522, -2030.9908, 59.5556, 84.657928466797, "San Andreas Presidental House"}, + {1962.8151, -2194.1438, 13.5469, 89.033111572266, "Los Santos Airport"}, + {1539.0527, -1674.7443, 13.5469, 89.033111572266, "Los Santos Police Department"}, + {1189.0702, -1324.7906, 13.5671, 269.82861328125, "All Saints Hospital"}, + {2011.6215, -1435.8839, 13.5547, 134.87286376953, "Jefferson Hospital"}, + {635.91784667969, -571.85083007813, 16.3359375, 269.90609741211, "Dillimore Police Department"}, + {2231.7734375, -28.512060165405, 26.3359375, 266.68014526367, "Palomino Creek"}, + {2523.5927734375, 2796.7934570313, 10.8203125, 179.57482910156, "K.A.C.C Military Fuels"}, + {318.58770751953, 2500.8020019531, 16.484375, 269.68524169922, "Verdant Meadows"}, + {-2259.8310546875, 2304.9401855469, 4.8202133178711, 354.60308837891, "Bayside Marina"}, } -local window = guiCreateWindow(574, 151, 434, 592, "UCD Admin | Warp", false) +local window = guiCreateWindow(574, 151, 434, 592, "UCD | Admin - Warp Points", false) guiWindowSetSizable(window, false) -local sw, sh = guiGetScreenSize() -guiSetPosition(window, (sw-434)/2, (sh-592)/2, false) +guiSetVisible(window, false) +exports.UCDutil:centerWindow(window) local grid = guiCreateGridList(15, 29, 409, 473, false, window) -guiGridListAddColumn(grid, "Location", 0.9) +guiGridListAddColumn(grid, "Location name:", 0.9) -for locName, locPos in pairs(positions) do +for i, v in pairs(positions) do local row = guiGridListAddRow(grid) - guiGridListSetItemText(grid, row, 1, locName, false, false) + guiGridListSetItemText(grid, row, 1, v[5], false, false) + guiGridListSetItemData(grid, row, 1, i, false, false) end -local button = guiCreateButton(35, 512, 153, 62, "Warp", false, window) -local Exit = guiCreateButton(255, 512, 153, 62, "Close", false, window) -guiSetVisible(window, false) +local warpButton = guiCreateButton(35, 512, 153, 62, "Warp", false, window) +local cancelButton = guiCreateButton(255, 512, 153, 62, "Close", false, window) -function showGUI() +function toggleWPGUI() guiSetVisible(window, not guiGetVisible(window)) showCursor(guiGetVisible(window)) end -addEvent("showGUI", true) -addEventHandler("showGUI", getRootElement(), showGUI) +addEvent("UCDadmin.onToggleWPGUI", true) +addEventHandler("UCDadmin.onToggleWPGUI", resourceRoot, toggleWPGUI) -function onClick() - if (source == button) then - local locName = guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid)) - local x, y, z = positions[locName][1], positions[locName][2], positions[locName][3] +function onWPButtonClick() + if (source == warpButton) then + local i = guiGridListGetItemData(grid, guiGridListGetSelectedItem(grid)) + if (not i) then + exports.UCDdx:new("Please choose a destination", 255, 0, 0) + return + end + local x, y, z, r = positions[i][1], positions[i][2], positions[i][3], positions[i][4] local element = localPlayer if (isPedInVehicle(element)) then element = getPedOccupiedVehicle(element) - if (getVehicleOccupant(element) ~= localPlayer) then - exports.UCDdx:new("You must be the driver in order to warp your vehicle", 255, 0, 0) + if (getVehicleController(element) ~= localPlayer) then + exports.UCDdx:new("You must be the driver in order to warp this vehicle", 255, 0, 0) return end end setElementPosition(element, x, y, z) + setElementRotation(element, 0, 0, r) guiSetVisible(window, false) - showCursor(false) - elseif (source == Exit) then + if (not adminPanel.window.visible) then + showCursor(false) + end + exports.UCDdx:new("You have warped to "..tostring(guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid))), 0, 255, 0) + elseif (source == cancelButton) then guiSetVisible(window, false) - showCursor(false) + if (not adminPanel.window.visible) then + showCursor(false) + end end end -addEventHandler("onClientGUIClick", root, onClick) \ No newline at end of file +addEventHandler("onClientGUIClick", warpButton, onWPButtonClick, false) +addEventHandler("onClientGUIClick", cancelButton, onWPButtonClick, false) \ No newline at end of file diff --git a/UCDadmin/warp/server.lua b/UCDadmin/warp/server.lua index 51a43e3..dc84704 100644 --- a/UCDadmin/warp/server.lua +++ b/UCDadmin/warp/server.lua @@ -1,7 +1,8 @@ --- Warp points by HellStunter -function serverShowGUI(thePlayer) +-- Warp panel by HellStunter +function toggleWPGUI(thePlayer) + if (not exports.UCDaccounts:isPlayerLoggedIn(thePlayer)) then return end if (isPlayerAdmin(thePlayer) and thePlayer.team.name == "Admins") then - triggerClientEvent(thePlayer, "showGUI", thePlayer) + triggerClientEvent(thePlayer, "UCDadmin.onToggleWPGUI", resourceRoot) end end -addCommandHandler("wp", serverShowGUI) \ No newline at end of file +addCommandHandler("wp", toggleWPGUI) \ No newline at end of file diff --git a/UCDanticheat/meta.xml b/UCDanticheat/meta.xml index 5eb7b0a..7128b43 100644 --- a/UCDanticheat/meta.xml +++ b/UCDanticheat/meta.xml @@ -1,3 +1,3 @@ - -