-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
You have a missing 'end' to close the 'if' at 'showgui' function.
-
I don't recommend using VirtualBox, VMWare is way better and faster.
-
function wasLotteryNumberBought ( number ) local bought = false for i, v in ipairs ( Tabla_Loteria ) do if ( v == number ) then bought = true break end end return bought end Usa esa funcion.
-
Doing that, you are just defining a global variable, meaning this script will only work with a single player.
-
admin/server/admin_server.lua
-
getPlayerAccount getAccountName isObjectInACLGroup
-
All these mods are just for the M4? how can you see different mod on the other players? you can't replace per-player.
-
Ah wait, I thought it was the first getPedOccupiedVehicle, but it was the one inside function "timerA". The problem is that 'source' is nothing, you need to pass the player/vehicle element in the timer arguments.
-
Is it a client side script? if so, then the first parameter of addCommandHandler is the command name, use 'localPlayer'.
-
You're welcome.
-
Also, in your function: isMouseWithinRangeOf, you need to replace this: local cx,cy = getCursorPosition() With the cursor position inside the holoscreen, which is the element data "ix" and "iy".
-
The "/add" command already uses ACL checking, the others remain using account data, simply use the same way "/add" does it.
-
Post what you have tried, so we can help you.
-
Well, for what I seen in the code, the only interactive way it has, is the mouse aiming, but it's really easy to add to use the cursor, I did it yesterday in few seconds. Replace the "renderHoloScreens" function with this: sx, sy = guiGetScreenSize ( ) function renderHoloScreens() local cx, cy, cz, clx, cly, clz = getCameraMatrix() for key,holoscreen in ipairs(getElementsByType ("holoscreen",root,true)) do local matrix = getEElementMatrix(holoscreen) --local hx,hy,hz = getElementPosition(holoscreen) local hx,hy,hz = matrix[4][1], matrix[4][2], matrix[4][3] local hs_distance = getDistanceBetweenPoints3D(cx, cy, cz,hx,hy,hz) if hs_distance < RenderDistance then local hs_width = getElementData(holoscreen,"width") local hs_height =getElementData(holoscreen,"height") local ix,iy,iz = getPositionFromMatrixOffset(matrix,0,0,hs_height*.5) local ex,ey,ez = getPositionFromMatrixOffset(matrix,0,0,-hs_height*.5) local fx,fy,fz = getPositionFromMatrixOffset(matrix,0,hs_width,0) RTE = getElementByID(getElementData(holoscreen,"RTID")) -- Test Interactive local interactive = getElementData(holoscreen,"interactive") if interactive then if ( interactive == "aim" ) then cstate = isPedDoingTask(localPlayer,"TASK_SIMPLE_USE_GUN") if cstate then local tx,ty,tz = getPedTargetCollision(localPlayer) if not tx then tx,ty,tz = getPedTargetEnd(localPlayer) end local ofx,ofy,ofz = getOffsetFromXYZ(matrix,{cx, cy, cz}) local efx,efy,efz = getOffsetFromXYZ(matrix,{tx, ty, tz}) local progress = math.unlerp(ofy,efy,0) local ix,iy,iz = interpolateBetween (ofx,ofy,ofz,efx,efy,efz,progress,"Linear") if (ix > -hs_width*.5 and ix < hs_width*.5) and (iy > -hs_height*.5 and iy < hs_height*.5) then setElementData(holoscreen,"ix",(-ix+(hs_width*.5))/hs_width) setElementData(holoscreen,"iy",(-iz+(hs_height*.5))/hs_height) end end elseif ( interactive == "cursor" ) then if isCursorShowing ( ) then local cursorX, cursorY, cursorZ = getCursorPosition ( ) local tx, ty, tz = getWorldFromScreenPosition ( ( cursorX * sx ), ( cursorY * sy ), RenderDistance ) local ofx,ofy,ofz = getOffsetFromXYZ(matrix,{cx, cy, cz}) local efx,efy,efz = getOffsetFromXYZ(matrix,{tx, ty, tz}) local progress = math.unlerp(ofy,efy,0) local ix,iy,iz = interpolateBetween (ofx,ofy,ofz,efx,efy,efz,progress,"Linear") if (ix > -hs_width*.5 and ix < hs_width*.5) and (iy > -hs_height*.5 and iy < hs_height*.5) then setElementData(holoscreen,"ix",(-ix+(hs_width*.5))/hs_width) setElementData(holoscreen,"iy",(-iz+(hs_height*.5))/hs_height) end end end end --Send Signal triggerEvent ("onHoloScreenRender",holoscreen) --Draw IT dxDrawMaterialLine3D (ix,iy,iz,ex,ey,ez,RTE,hs_width,white,fx,fy,fz) end end end addEventHandler ( "onClientRender", root,renderHoloScreens) Also, keep in mind that I fixed the typo at triggerEvent, added the missing 'e', so replace your "onHoloScrenRender" to "onHoloScreenRender". Then in your code use: setElementData ( holoscreen, "interactive", "cursor" )
-
Can I use a function declared in fileA.lua in the fileB.lua?
Castillo replied to Stanley Sathler's topic in Scripting
outputChatBox("Number: " + myFunction()) That should be: outputChatBox ( "Number: ".. myFunction ( ) ) -
Change the description to "DELETE" so we can know they are yours.
-
You are assigning the same variable to every pickup.
-
No, that is a global variable ( wrongly defined too, it should've been kills = 0 ), you need a table to count the kills of each player. http://lua-users.org/wiki/TablesTutorial
-
The method I use is this: local sX, sY = guiGetScreenSize ( ) local nX, nY = 1366, 768 -- My screen resolution when I created it local x, y = 50, 50 addEventHandler ( "onClientRender", root, function ( ) dxDrawText ( "Hello world", ( x / nX ) * sX, ( y / nY ) * sY ) end )
-
Well, if you don't tell us the error, nor show us the rest of the code, how can we know?
-
You're welcome.