Skip to content

Commit 29ed9f1

Browse files
committed
Lots of changes and fixes
1 parent df7f377 commit 29ed9f1

12 files changed

+231
-145
lines changed

amx/client/arial.ttf

-1010 KB
Binary file not shown.

amx/client/client.lua

+38-16
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function renderClassSelText()
172172
drawShadowText('Use left and right arrow keys to select class.', 20, screenHeight - 150, tocolor(240, 240, 240))
173173
drawShadowText('Press SHIFT when ready to spawn.', 20, screenHeight - 136, tocolor(240, 240, 240))
174174

175-
if not g_ClassSelectionInfo or not g_ClassSelectionInfo.selectedclass then
175+
if not g_ClassSelectionInfo[0] or not g_ClassSelectionInfo.selectedclass then
176176
return
177177
end
178178
drawShadowText('Class ' .. g_ClassSelectionInfo.selectedclass .. ' weapons:', 20, screenHeight - 110, tocolor(240, 240, 240))
@@ -333,6 +333,9 @@ function camAttachRender()
333333
local x1,y1,z1 = 0.0, 0.0, 0.0
334334
if ca.objCamPos ~= nil then
335335
x1,y1,z1 = getElementPosition(ca.objCamPos)
336+
if not x1 then x1 = 0.0 end
337+
if not y1 then y1 = 0.0 end
338+
if not z1 then z1 = 0.0 end
336339
end
337340
local camDist = ca.dist
338341
local cosZ = math.cos(ca.z)
@@ -402,9 +405,15 @@ function camRender()
402405
local x1,y1,z1,x2,y2,z2 = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
403406
if sm.objCamPos ~= nil then
404407
x1,y1,z1 = getElementPosition(sm.objCamPos)
408+
if not x1 then x1 = 0.0 end
409+
if not y1 then y1 = 0.0 end
410+
if not z1 then z1 = 0.0 end
405411
end
406412
if sm.objLookAt ~= nil then
407413
x2,y2,z2 = getElementPosition(sm.objLookAt)
414+
if not x2 then x2 = 0.0 end
415+
if not y2 then y2 = 0.0 end
416+
if not z2 then z2 = 0.0 end
408417
end
409418
--outputConsole(string.format("Current Camera Matrix is: CamPos: %f %f %f CamLookAt: %f %f %f", x1,y1,z1,x2,y2,z2))
410419
setCameraMatrix(x1,y1,z1,x2,y2,z2)
@@ -453,9 +462,10 @@ end
453462
function AttachPlayerObjectToPlayer(objID, attachPlayer, offsetX, offsetY, offsetZ, rX, rY, rZ)
454463
local obj = g_PlayerObjects[objID]
455464
if not obj then
456-
return
465+
return false
457466
end
458467
attachElements(obj, attachPlayer, offsetX, offsetY, offsetZ, rX, rY, rZ)
468+
return true
459469
end
460470

461471
function CreatePlayerObject(objID, model, x, y, z, rX, rY, rZ)
@@ -483,25 +493,28 @@ end
483493
function SetPlayerObjectPos(objID, x, y, z)
484494
local obj = g_PlayerObjects[objID]
485495
if not obj then
486-
return
496+
return false
487497
end
488498
setElementPosition(obj, x, y, z)
499+
return true
489500
end
490501

491502
function SetPlayerObjectRot(objID, rX, rY, rZ)
492503
local obj = g_PlayerObjects[objID]
493504
if not obj then
494-
return
505+
return false
495506
end
496507
setElementRotation(obj, rX, rY, rZ)
508+
return true
497509
end
498510

499511
function StopPlayerObject(objID)
500512
local obj = g_PlayerObjects[objID]
501513
if not obj then
502-
return
514+
return false
503515
end
504516
stopObject(obj)
517+
return true
505518
end
506519

507520
--- Audio
@@ -625,6 +638,7 @@ end
625638

626639
function SetPlayerPosFindZ(x, y, z)
627640
setElementPosition(localPlayer, x, y, getGroundPosition(x, y, z) + 1)
641+
return true
628642
end
629643

630644
function SetVehicleParamsForPlayer(vehicle, isObjective, doorsLocked)
@@ -1565,7 +1579,9 @@ function RemovePlayerMapIcon(blipID)
15651579
if g_Blips[blipID] then
15661580
destroyElement(g_Blips[blipID])
15671581
g_Blips[blipID] = nil
1582+
return true
15681583
end
1584+
return false
15691585
end
15701586

15711587
function SetPlayerMapIcon(blipID, x, y, z, type, r, g, b, a)
@@ -1574,6 +1590,7 @@ function SetPlayerMapIcon(blipID, x, y, z, type, r, g, b, a)
15741590
g_Blips[blipID] = nil
15751591
end
15761592
g_Blips[blipID] = createBlip(x, y, z, type, 2, r, g, b, a)
1593+
return true
15771594
end
15781595

15791596
function SetPlayerWorldBounds(xMax, xMin, yMax, yMin)
@@ -1658,6 +1675,7 @@ end
16581675
function TogglePlayerClock(toggle)
16591676
setMinuteDuration(toggle and 1000 or 2147483647)
16601677
setPlayerHudComponentVisible('clock', toggle)
1678+
return true
16611679
end
16621680

16631681
function createListDialog(titleText, message, button1txt, button2txt)
@@ -1706,8 +1724,8 @@ function createInputDialog(titleText, message, button1txt, button2txt)
17061724
end
17071725
inputDialog = nil
17081726
inputWindow = guiCreateWindow(screenWidth/2 - 541/2,screenHeight/2 - 352/2,541,352, titleText, false)
1709-
guiWindowSetMovable(listWindow,false)
1710-
guiWindowSetSizable(listWindow,false)
1727+
guiWindowSetMovable(inputWindow,false)
1728+
guiWindowSetSizable(inputWindow,false)
17111729
inputLabel = guiCreateColoredLabel(0.1, 0.1, 1.0, 0.8, message, inputWindow, true)
17121730
inputEdit = guiCreateEdit(0.0, 0.7, 1.0, 0.1, "", true, inputWindow)
17131731

@@ -1845,9 +1863,9 @@ function guiCreateColoredLabel(ax, ay, bx, by,str, parent, relative) --x, y, wid
18451863
local scrollpane = guiCreateScrollPane(ax,ay,bx,by,relative,parent)
18461864
--outputConsole('main string:' .. str)
18471865

1848-
local pat = "(.-)#(%x%x%x%x%x%x)"
1849-
local s, e, cap, col = str:find(pat, 1)
1850-
local last = 1
1866+
local pat = "(.-)#(%x%x%x%x%x%x)"
1867+
local s, e, cap, col = str:find(pat, 1)
1868+
local last = 1
18511869
local labels = {}
18521870
local incy = 0
18531871
local incx = 0
@@ -1859,10 +1877,10 @@ function guiCreateColoredLabel(ax, ay, bx, by,str, parent, relative) --x, y, wid
18591877

18601878
lbl = guiCreateLabel(ax + incx, ay + incy, 1.0, by, cap, relative, scrollpane)
18611879
guiLabelSetHorizontalAlign(lbl, "left")
1862-
table.insert(labels, lbl)
1863-
if (r == nil) then r = 255 end
1864-
if (g == nil) then g = 255 end
1865-
if (b == nil) then b = 255 end
1880+
table.insert(labels, lbl)
1881+
if (r == nil) then r = 255 end
1882+
if (g == nil) then g = 255 end
1883+
if (b == nil) then b = 255 end
18661884
guiLabelSetColor(lbl,r,g,b)
18671885
r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6))
18681886

@@ -1891,6 +1909,9 @@ function guiCreateColoredLabel(ax, ay, bx, by,str, parent, relative) --x, y, wid
18911909
cap = str:sub(last)
18921910
lbl2 = guiCreateLabel(ax + incx, ay + incy, 1.0, by, cap, relative, scrollpane)
18931911
table.insert(labels, lbl2)
1912+
if (r == nil) then r = 255 end
1913+
if (g == nil) then g = 255 end
1914+
if (b == nil) then b = 255 end
18941915
guiLabelSetColor(lbl2,r,g,b)
18951916
end
18961917
return labels
@@ -1934,7 +1955,7 @@ function ShowPlayerDialog(dialogid, dialogtype, caption, info, button1, button2)
19341955
local row = guiGridListAddRow ( listGrid )
19351956
guiGridListSetItemText ( listGrid, row, listColumn, v, false, true)
19361957
end
1937-
return
1958+
return true
19381959
end
19391960

19401961
--DIALOG_STYLE_TABLIST, DIALOG_STYLE_TABLIST_HEADER
@@ -1943,7 +1964,7 @@ function ShowPlayerDialog(dialogid, dialogtype, caption, info, button1, button2)
19431964
if #items < 1 then
19441965
outputConsole('Error, your dialog either has no items, its format is wrong or you\'re missing a newline character in the string')
19451966
outputConsole('The raw string was: ' .. info)
1946-
return --Abort if there's no items
1967+
return false --Abort if there's no items
19471968
end
19481969

19491970
--Create the header
@@ -1967,6 +1988,7 @@ function ShowPlayerDialog(dialogid, dialogtype, caption, info, button1, button2)
19671988
end
19681989
end
19691990
end
1991+
return true
19701992
end
19711993

19721994
addEvent("onPlayerClickPlayer")

amx/client/samp_nametags.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
local font = dxCreateFont('client/arial.ttf', 10, true, 'default') or 'default' -- fallback to default
2+
local font = 'arial' -- default font
33

44
HealthBarBorderVertices =
55
{

0 commit comments

Comments
 (0)