-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
local screenWidth,screenHeight = guiGetScreenSize() GUIEditor_Label = {} addEventHandler("onClientResourceStart",resourceRoot, function () GUIEditor_Label[1] = guiCreateLabel(0.4063,0.3779,0.1531,0.209,"Welcome to our server ! Server is under construction at the moment , but feel free to play on it , expect more gamemodes from us , more features and much , much more ...",true) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) guiSetFont(GUIEditor_Label[1],"clear-normal") end) setTimer ( guiSetVisible, 5000, 1, GUIEditor_Label, false) You had MANY mistakes in the code, try to pay more attention.
-
Well, what he's using is DX drawing, you could use dxDrawText and copy the way he'd it.
-
That's caused by the 'local' infront of it. function takemoney ( thePlayer ) givePlayerMoney(thePlayer, getElementData(source, "moneyDropped")) destroyElement(source) end function givemoney(thePlayer, command, amount) if isElement(gpickup[thePlayer]) then return end local givingplayer = getPlayerFromName ( thePlayer ) local x,y,z = getElementPosition(thePlayer) local x = x + 5 gpickup[thePlayer] = createPickup(x,y,z,3,1212) setElementData(gpickup[thePlayer], "moneyDropped", math.ceil(tonumber(amount))) takePlayerMoney (thePlayer, math.abs(math.ceil(tonumber(amount)))) addEventHandler('onPickupHit', gpickup[thePlayer], takemoney) end addCommandHandler ("givemoney", givemoney)
-
Can be a timer, or onClientRender, there are many ways of doing it.
-
I think you should use guiSetPosition.
-
Parts of the code we're from another topic (don't discuss, would be useless), and you forgot the function isPlayerInRangeOfPoint.
-
The code you copied from another topic was wrong, you forgot functions and changed things wrongly. chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"U","down","chatbox","Local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"U","down","chatbox","Local") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,i,...) local px,py,pz=getElementPosition(player) local nick=getPlayerName(player) local msg = table.concat({...}, " ") local r,g,b = getTeamColor(getPlayerTeam(player)) for i,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("(Local) ".. nick ..": "..msg,v,r,g,b,true) end end end addCommandHandler("Local",onChat)
-
Yes, that should work. P.S: Use the LUA tags in the forum .
-
I think I get it, maybe you are talking about showing your nametag to YOURSELF and the players?
-
Disable label? what do you mean?
-
Copy my script code again, I've changed some things, seems to work here, try it with another player though.
-
Well, maybe you should remove the event handler after close? GUIEditor_Window = {} GUIEditor_Memo = {} GUIEditor_Memo1 = {} GUIEditor_Grid = {} lol = {} GUIEditor_Window[1] = guiCreateWindow(0.207,0.1426,0.607,0.5605,"Help Manager",true) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) GUIEditor_Grid[1] = guiCreateGridList(14,52,121,485,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(lol,2) guiGridListAddColumn(GUIEditor_Grid[1],"Description",0.2) for i = 1, 2 do guiGridListAddRow(GUIEditor_Grid[1]) end lol = guiGridListSetItemText(GUIEditor_Grid[1],0,1,"FAQ",false,true) GUIEditor_Memo[1] = guiCreateMemo(139,54,601,484," Here are recently asked questions by other players\n\n\nQ:What type of server is this ?\nA:It's Freeroam.\n\n\nQ: For what FG stands for ? \nA: It's stand for Friend Gang\n\n\nQ: Where i can visit your site ? \nA: Site link is Fggaming.forumcroatian.com/\n",false,GUIEditor_Window[1]) guiGridListSetItemText(GUIEditor_Grid[1],1,1,"Glue",false,true) guiSetSizable(GUIEditor_Window, false) guiSetMovable(GUIEditor_Window, false) guiMemoSetReadOnly(GUIEditor_Memo[1],false) GUIEditor_Memo1 = guiCreateMemo(139,54,601,484,"Test, test",false,GUIEditor_Window[1]) end -- BIND F9 function onresourceStart () bindKey ("F9", "down", showUserPanel) guiSetVisible (GUIEditor_Window[1], false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showUserPanel () local playerName = getPlayerName ( getLocalPlayer() ) if guiGetVisible (GUIEditor_Window[1]) then guiSetVisible (GUIEditor_Window[1], false) showCursor (false) removeEventHandler( "onClientGUIClick", GUIEditor_Grid[1], showUserPanel ) else guiSetVisible (GUIEditor_Window[1], true) showCursor (true) addEventHandler( "onClientGUIClick", GUIEditor_Grid[1], showUserPanel ) end end
-
Creo que seria mas facil esto: local miMarcador = createMarker (0, 0, 2, 'cylinder', 10, 255, 0, 0, 150 ) -- marcador temporal en la mitad del mapa function comprar (thePlayer) -- la funcion del comando if isElementWithinMarker(thePlayer, miMarcador) then outputChatBox ("Ahora No Tienes Nivel de Buscado, pero Perdiste $10.000", thePlayer, 140, 0, 140) takePlayerMoney (thePlayer, 10000) setPlayerWantedLevel (thePlayer, 0) end end addCommandHandler("libre",comprar) function cuandoPiseElMarker( hitElement, matchingDimension ) -- agrega el comando para cuando entre el maracador outputChatBox ("Usa /libre para Pagar un Soborno.", hitElement, 140, 0, 140) end addEventHandler ("onMarkerHit", miMarcador, cuandoPiseElMarker) function cuandoSalga ( leaveElement, matchingDimension ) -- elimina el comando para cuando salga del marcador outputChatBox ("Regresa Pronto!", leaveElement, 140, 0, 140) end addEventHandler ("onMarkerLeave",miMarcador, cuandoSalga)
-
You put that in a .lua file and create it's meta.xml, and then type the command with the ID.
-
addCommandHandler is just a way of executing a function, it's not the function to open it. addCommandHandler("open", function (thePlayer, cmd, gateID) setGarageOpen(tonumber(gateID), true) outputChatBox("You have opened the garage ".. tostring(gateID),thePlayer,0,255,0) end) Then you can do /open
-
That's a GTA garage, you can open them with setGarageOpen: https://wiki.multitheftauto.com/wiki/SetGarageOpen Garage ID's are here: https://wiki.multitheftauto.com/wiki/Garage
-
I don't get what do you mean, mind explaining it again (better of course)?
-
You can't move a GTA:SA Map door or whatever, they're unable to be moved/deleted.
-
Maybe because is onPlayerLogin not onClientLogin? function outputOnLogin (thePlayer, current_account ) --when a player logs in outputChatBox(getPlayerName(thePlayer).." Logged into "..getAccountName(current_account),getRootElement(),255,0,0, true) end addEventHandler("onPlayerLogin",getRootElement(),outputOnLogin )
-
Hola y bienvenido al MTA. Lo mejor para ir aprendiendo es usando la wiki del MTA, algunos de los miembros an traducido partes al español, pero aun asi no esta completa, pero si sabes ingles lo suficiente, podras aprender rapido (si le das tiempo). Aca te dejo el link para la wiki en ingles e español. Español: https://wiki.multitheftauto.com/index.ph ... _Principal Ingles: https://wiki.multitheftauto.com/
-
For GUI/DX drawing related scripting I suggest using "guieditor", you can download it here: https://community.multitheftauto.com/index.php?p= ... ils&id=141
-
If you only know the basics, then why don't you learn the rest? isn't that hard if you give it time.
-
local SWATgate1 = createObject(3115, 1286, -1651.69, 10, 180, 90) local SWATColSphere1 = createColSphere(1286.67, -1652.15, 13.54, 10) function SWATopen1 (player) if (player and isElement(player) and getElementType(player) == "player") then local t = getPlayerTeam(player) if not t1 then return end if (getTeamName(t) == "SWAT Team") then moveObject(SWATgate1, 2500, 1286, -1635.2, 10) end end end addEventHandler("onColShapeHit", SWATColSphere1, SWATopen1) function SWATclose1 (player) if (player and isElement(player) and getElementType(player) == "player") then local t1 = getPlayerTeam(player) if not t1 then return end if (getTeamName(t1) == "SWAT Team") then if countPlayersInColshape(SWATColSphere1) <= 0 then moveObject(SWATgate1, 2500, 1286, -1651.69, 10) end end end end addEventHandler("onColShapeLeave", SWATColSphere1, SWATclose1) function countPlayersInColshape(colshape) local count = 0 for index, player in pairs(getElementsWithinColShape(colshape, "player")) do if getPlayerTeam(player) and getTeamName(getPlayerTeam(player)) == "SWAT Team" then count = count +1 end end return count end Not sure if'll work, I haven't got time to test it.
-
Como si pisa y hace el comando? decis ejemplo: usar un comando tipo /hola solo en ese marker?
