Skip to content

Commit 333cfc8

Browse files
committed
Fix logic
1 parent fc36c65 commit 333cfc8

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

lua/ulx/modules/sh/timed_civilize_vote.lua

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ local PERMANENT_EXPIRATION = -1
55

66
if SERVER then
77
local function voteCivilizeDone( t, targetNick, targetSteamID, minutes, callingPly )
8-
local voteYesCount = t.results[1] or 0
9-
local voteNoCount = t.results[2] or 0
10-
local shouldCivilize = voteYesCount > voteNoCount
11-
12-
if not shouldCivilize then
13-
ulx.fancyLogAdmin( callingPly, "The populace has deemed the refinement of #s unworthy. Motion dismissed: #i in favor, #i opposed", targetNick, voteYesCount, voteNoCount )
14-
return
15-
end
16-
178
-- Check if player is still on server
189
local targetPly = player.GetBySteamID64( targetSteamID )
1910
local targetStillOnServer = IsValid( targetPly )
@@ -22,6 +13,15 @@ if SERVER then
2213
return
2314
end
2415

16+
local voteYesCount = t.results[1] or 0
17+
local voteNoCount = t.results[2] or 0
18+
local shouldCivilize = voteYesCount > voteNoCount
19+
20+
if not shouldCivilize then
21+
ulx.fancyLogAdmin( callingPly, "The populace has deemed the refinement of #T unworthy. Motion dismissed: #i in favor, #i opposed", targetPly, voteYesCount, voteNoCount )
22+
return
23+
end
24+
2525
-- Get calling player's steam ID (or console if they disconnected)
2626
local callerStillOnServer = IsValid( callingPly )
2727
local issuerSteamID = callerStillOnServer and callingPly:SteamID64() or "Console"
@@ -35,10 +35,10 @@ if SERVER then
3535

3636
-- Log the result
3737
if isPermanent then
38-
ulx.fancyLogAdmin( callingPly, "#s has been refined by democratic decree! Civility shall be enforced permanently. Vote: #i in favor, #i opposed", targetNick, voteYesCount, voteNoCount )
38+
ulx.fancyLogAdmin( callingPly, "#T has been refined by democratic decree! Civility shall be enforced permanently. Vote: #i in favor, #i opposed", targetPly, voteYesCount, voteNoCount )
3939
else
4040
local durationStr = ULib.secondsToStringTime( minutes * 60 )
41-
ulx.fancyLogAdmin( callingPly, "#s has been refined by democratic decree! Civility shall be enforced for #s. Vote: #i in favor, #i opposed", targetNick, durationStr, voteYesCount, voteNoCount )
41+
ulx.fancyLogAdmin( callingPly, "#T has been refined by democratic decree! Civility shall be enforced for #s. Vote: #i in favor, #i opposed", targetPly, durationStr, voteYesCount, voteNoCount )
4242
end
4343
end
4444

@@ -70,6 +70,7 @@ if SERVER then
7070
else
7171
ulx.fancyLogAdmin( callingPly, "#A started a vote to civilize #T for #s", targetPly, durationStr )
7272
end
73+
end
7374
end
7475

7576
-- Create the ULX command

0 commit comments

Comments
 (0)