-
Posts
4,961 -
Joined
-
Last visited
Everything posted by Jaysds1
-
try stopping the resource and see if you could enter the vehicle
-
I don't think you could change the anim for weapon shooting/firing ...
-
What resource are you trying to get a function from?
-
try this: carjacker = createMarker( 2055.6, -1769.3, 13.5,"cylinder",1.5,0,0,0,0 ) local carjackerTable = { {826,858.9,12}; {579.9,1220.2,11.7}; {65,-275,1.5}; {1673.6, -37.6,3.5}; {-540.6,-497.7,25.5}; {2783.8,-2418.2,13.6}; } function createCarrou (hitPlayer) if getElementType(hitPlayer)=="player" and hitPlayer == localPlayer then x, y, z = unpack ( carjackerTable [ math.random ( #carjackerTable ) ] ) vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 32 ) --create a blip after the car is created addEventHandler ( "onClientVehicleEnter", vehicle, carHit ) end end addEventHandler ( "onClientMarkerHit", carjacker, createCarrou ) function carHit ( hitPlayer ) carmarker = createMarker( 0,0,0, "cylinder", 3, 250, 250, 90 ) addEventHandler ("onClientMarkerHit", carmarker, functio ) end function functio ( hitElement ) if ( hitElement == localPlayer ) then if(not isPedInVehicle ( localPlayer ))then triggerServerEvent ( "carmoney", localPlayer ) destroyElement ( vehicle ) destroyElement ( carBlip ) destroyElement ( marker ) createRoute() end end end function functi () cancelEvent () end addEventHandler ( "onClientPedDamage",root, functi ) --it's root not resource root
-
try adding the script from the wiki and click on random things... here: local myLabel = guiCreateLabel ( 0, 0, 1, 1, "", true ) function addLabelOnClick ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) --if an element was clicked on screen if ( clickedElement ) then --retreive the element type local elementType = getElementType ( clickedElement ) --change the label text to that element type guiSetText ( myLabel, elementType ) --and place it in the position of where the element is guiSetPosition ( myLabel, absoluteX, absoluteY, false ) --hide the text by passing an empty string 5 seconds later setTimer ( guiSetText, 5000, 1, myLabel, "" ) end end addEventHandler ( "onClientClick", getRootElement(), addLabelOnClick )
-
try this: Client: function botoones() local x, y, z = getElementPosition( getLocalPlayer() ) local skinID = getElementModel( getLocalPlayer() ) if source == GUIEditor_Button[1] then guiSetText(GUIEditor_Edit[2], x) guiSetText(GUIEditor_Edit[3], y) guiSetText(GUIEditor_Edit[4], z) elseif source == GUIEditor_Button[2] then guiSetText(GUIEditor_Edit[5], rx) guiSetText(GUIEditor_Edit[6], ry) guiSetText(GUIEditor_Edit[7], rz) elseif source == GUIEditor_Button[3] then guiSetText(GUIEditor_Edit[1], skinID) elseif source == GUIEditor_Button[5] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") elseif source == GUIEditor_Button[6] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif source == GUIEditor_Button[4] then ped = createPed(tonumber(guiGetText(GUIEditor_Edit[1])), tonumber(guiGetText(GUIEditor_Edit[2])), tonumber(guiGetText(GUIEditor_Edit[3])), tonumber(guiGetText(GUIEditor_Edit[4])), tonumber(guiGetText(GUIEditor_Edit[5])), tonumber(guiGetText(GUIEditor_Edit[6])), tonumber(guiGetText(GUIEditor_Edit[7]))) triggerServerEvent("savePed",localPlayer,ped) end end addEventHandler("onClientGUIClick", guiRoot, botoones,true )--always include a bool at the end for button/gui click events
-
try this: local peds addEventHandler("onResourceStart",resourceRoot,function() pedsTable = executeSQLQuery("SELECT * FROM peds") for i,v in ipairs(pedsTable)do local ped = createPed(v[2],v[3],v[4],v[5]) setElementRotation(ped,v[6],v[7],v[8]) peds = (v[1]) outputChatBox("Ped Created",root,0,255,0) end outputChatBox("A total of "..tostring(peds).." was created.",root) end) addEvent("savePed",true) addEventHandler("savePed",root,function(ped) if(ped)then local x, y, z = getElementPosition( ped ) local modelo = getElementModel( ped ) local rotX, rotY, rotZ = getElementRotation( ped ) local peds = peds+1 set("peds",peds) executeSQLInsert ("peds","'"..peds.."','"..modelo.."', '"..xP.."', '"..yP.."', '"..zP.."', '"..rotX.."', '"..rotY.."', '"..rotZ.."'") end end)
-
I've edited the script again, try it... When you click on an element, see if the model in the chat is the same as the model as the atm...
-
lol, thanks for telling karthik... I think this week is a bad week for me... Anyways, I've edited the script again, try it again Monty
-
no, that's where it should be, hmmm, Are you sure you don't see TDMA in the definitions? What about TDM?
-
Did the same error came up again? Is there a folder called conf in the same resource/folder as this script?
-
sorry, try this, Server: local peds addEventHandler("onResourceStart",resourceRoot,function() pedsTable = executeSQLQuery("SELECT * FROM peds") for i,v in ipairs(pedsTable)do local ped = createPed(modelo.v,xP.v,yP.v,zP.v) setElementRotation(ped,rotX.v,rotY.v,rotZ.v) peds = (peds.v) end end) addEvent("savePed",true) addEventHandler("savePed",root,function(ped) if(ped)then local x, y, z = getElementPosition( ped ) local modelo = getElementModel( ped ) local rotX, rotY, rotZ = getElementRotation( ped ) local peds = peds+1 set("peds",peds) executeSQLInsert ("peds","'"..peds.."','"..modelo.."', '"..xP.."', '"..yP.."', '"..zP.."', '"..rotX.."', '"..rotY.."', '"..rotZ.."'") end end)
-
oh, sorry, I forgot to add a query for getting the peds x,y,z,rx,ry,rz etc...
-
lol, oh, ya... I forgot...
-
try this: g_Root = getRootElement() function Initiate() local country = getPlayerCountry(source) if (country == nil or false) then country = "n/a" end setElementData(source, "country", country) end addEventHandler('onPlayerJoin', g_Root, Initiate) addEventHandler("onResourceStart",resourceRoot,function() -- You can remove this if you want outputChatBox('#ffffff[bemVindo] #ffff00Divirtam-se #ffffffDONE', getRootElement(), 255, 100, 100, true) -- call(getResourceFromName("scoreboard"),"addScoreboardColumn","Country", getRootElement(), 9, 50) exports.Scoreboard:addScoreboardColumn("Country",root,9,50) setTimer(function() for i,v in ipairs(getElementsByType("player"))do local country = getPlayerCountry(v) if not country then country = "n/a" end setElementData(v, "country", country) end end, 4000, 1) end) aCountries = {} function getPlayerCountry ( player ) if(getPlayerFromName(getPlayerName(player)))then return getIpCountry ( getPlayerIP ( player ) ) else outputDebugString("Player is not define or is not on the server.",3) end end function getIpCountry ( ip ) local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) local ip_code = ( gettok ( ip, 1, 46 ) * 16777216 ) + ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) if ( #aCountries == 0 ) then loadIPGroups () end if ( not aCountries[ip_group] ) then aCountries[ip_group] = {} end for id, group in ipairs ( aCountries[ip_group] ) do if ( ( group.rstart <= ip_code ) and ( ip_code <= group.rend ) ) then return group.rcountry end end return false end -- Load all IP groups from "conf/IpToCountryCompact.csv" function loadIPGroups () unrelPosReset() local readFilename = "conf/IpToCountryCompact.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputDebugString( "Cannot read " .. readFilename,3 ) return end local buffer = "" while true do local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) local parts = split( line, string.byte(',') ) if #parts > 2 then local rstart = tonumber(parts[1]) local rend = tonumber(parts[2]) local rcountry = parts[3] -- Relative to absolute numbers rstart = unrelRange ( rstart ) rend = unrelRange ( rend ) local group = math.floor( rstart / 0x1000000 ) if not aCountries[group] then aCountries[group] = {} end local count = #aCountries[group] + 1 aCountries[group][count] = {} aCountries[group][count].rstart = rstart aCountries[group][count].rend = rend aCountries[group][count].rcountry = rcountry end end end fileFlush(hReadFile) --Got to put the data in to the file before you close it fileClose(hReadFile) end -- Make a stream of absolute numbers relative to each other local relPos = 0 function relPosReset() if(relPos>0)then relPos = 0 end end function relRange( v ) if(v)then local rel = v - relPos relPos = v return rel else outputDebugString("Never got the range.",3) end end -- Make a stream of relative numbers absolute local unrelPos = 0 function unrelPosReset() if(unrelPos>0)then unrelPos = 0 end end function unrelRange( v ) if(v)then local unrel = v + unrelPos unrelPos = unrel return unrel else outputDebugString("Unable to unrel Range",3) end end ---------------------------------------------------------------------------------------- -- -- Set to true to enable commands "makecsv" and "iptest" -- ---------------------------------------------------------------------------------------- local makeAndTestCompactCsv = false if makeAndTestCompactCsv then local makeCor -- Takes a 'IPV4 CSV' file sourced from [url=http://software77.net/geo-ip/]http://software77.net/geo-ip/[/url] -- and makes a smaller one for use by Admin addCommandHandler ( "makecsv", function () local status = makeCor and coroutine.status(makeCor) if (status == "suspended") then outputDebugString( "Please wait" ) return end makeCor = coroutine.create ( makeCompactCsvWorker ) coroutine.resume ( makeCor ) end ) function makeCompactCsvWorker () outputDebugString ( "makeCompactCsv started" ) relPosReset() local readFilename = "conf/IpToCountry.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputDebugString ( "Cannot read " .. readFilename ) return end local writeFilename = "conf/IpToCountryCompact.csv"; local hWriteFile = fileCreate( writeFilename, true ) if not hWriteFile then fileClose(hReadFile) outputDebugString ( "Cannot create " .. writeFilename ) return end local tick = getTickCount() local buffer = "" while true do if ( getTickCount() > tick + 50 ) then -- Execution exceeded 50ms so pause and resume in 50ms setTimer(function() local status = coroutine.status(makeCor) if (status == "suspended") then coroutine.resume(makeCor) elseif (status == "dead") then makeCor = nil end end, 50, 1) coroutine.yield() tick = getTickCount() end local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) -- If not a comment line if string.sub(line,1,1) ~= '#' then -- Parse out required fields local _,_,rstart,rend,rcountry = string.find(line, '"(%w+)","(%w+)","%w+","%w+","(%w+)"' ) if rcountry then -- Absolute to relative numbers rstart = relRange( rstart ) rend = relRange( rend ) -- Output line fileWrite( hWriteFile, rstart .. "," .. rend .. "," .. rcountry .. "\n" ) end end end end fileClose(hWriteFile) fileClose(hReadFile) outputDebugString ( "makeCompactCsv done" ) end addCommandHandler ( "iptest", ipTest ) end function ipTestDo( ip )
-
you could use OnConsole.
-
try this, Server: local marker = createMarker( 1037.8309326172, -1029.5063476563, 31.1015625, "cylinder", 1.5, 255, 153, 0, 150) createBlip ( 1036.1654052734, -1027.8570556641, 32.1015625, 27 ) function Mecjob(hitElement) if getElementType(hitElement) == "player" then triggerClientEvent(hitElement,"marker",leaveElement,true) end end addEventHandler("onMarkerHit", marker, Mecjob) function Mecjobleave(leaveElement) if getElementType(leaveElement) == "player" then triggerClientEvent(leaveElement,"marker",leaveElement,false) end end addEventHandler("onMarkerLeave", marker, Mecjobleave) function createMechanicTeam () mecTeam = createTeam ("Mechanic", 255, 153, 0) end addEventHandler ("onResourceStart", resourceRoot, createMechanicTeam) function joinMec() setPlayerTeam(client,mecTeam) setElementModel(client, 50) giveWeapon ( client, 42, 999 ) setElementData( client, "Occupation", "Mechanic") outputChatBox("You are now a Mechanic.",client,0,255,0) end addEvent("setMec", true) addEventHandler("setMec", root, joinMec ) addEvent("mechanic:repair", true) addEventHandler("mechanic:repair", root,function(mechanic) if (getElementHealth(source) < 100) then local Heal = getElementHealth(source) + 10 -- New health setElementHealth(source, Heal) if (Heal > 100) then setElementHealth(source, 1000) end givePlayerMoney(mechanic, 1000) -- Gives 100$ to the medic each time the function is executed end end) Client: --- marker createMarker ( float x, float y, float z, [string theType, float size, int r, int g, int b, int a] ) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"Mchanic job") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Mechanic job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take mechanic job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1],true) --It's a memo not an edit function joinTeam() triggerServerEvent("setMec",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeMedicWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMedicWindow, false) addEventHandler("onClientPlayerDamage",root,function()function(attacker, weapon, bodypart, loss) local localVehicle = getPedOccupiedVehicle(source) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 42 and team and getTeamName(team) == "Mechanic") then cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then if (health <= 99) then triggerServerEvent("mechanic:repair", localVehicle, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end end) addEvent("marker",true) addEventHandler("marker",root,function(bool) if(bool)then guiSetVisible(windowjob, bool) showCursor(bool) end end)
-
try this: ---- Banking System (clientside) --[[ ATM IDs list LS_bank_ATM --]] local LS_BANK_ATM = getElementByID("LS_bank_ATM") setElementData(LS_BANK_ATM, "type", "atm") setElementData(LS_BANK_ATM, "name", "LS_Bank_ATM") function atmClicked(button, state, _,_, wx, wy, wz, element) if button and state == "down" then if(element)then outputChatBox("You've clicked on "..getElementModel(element).."." if(getElementData(element, "type") == "atm")then local x, y, z = getElementPosition(localPlayer) if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <= 10 then outputChatBox("DEBUGMSG::You clicked the atm.", 0,0,255) end end end end end addEventHandler("onClientClick", root, atmClicked)
-
Is the file in the same folder/resource as the script? to check, go to the folder with that script then go in to the conf folder... if the folder is not there then that's the problem...
-
I think I know what he's trying to do... Server: local peds addEventHandler("onResourceStart",resourceRoot,function() peds = get("@peds") if(not peds)then peds = 0 set("@peds",0) end end) addEvent("savePed",true) addEventHandler("savePed",root,function(ped) if(ped)then local x, y, z = getElementPosition( ped ) local modelo = getElementModel( ped ) local rotX, rotY, rotZ = getElementRotation( ped ) local peds = peds+1 set("peds",peds) executeSQLInsert ( " peds","'"..peds.."', '"..modelo.."', '"..xP.."', '"..yP.."', '"..zP.."', '"..rotX.."', '"..rotY.."', '"..rotZ.."'") end end) Client: function botoones() local x, y, z = getElementPosition( getLocalPlayer() ) local skinID = getElementModel( getLocalPlayer() ) if source == GUIEditor_Button[1] then guiSetText(GUIEditor_Edit[2], x) guiSetText(GUIEditor_Edit[3], y) guiSetText(GUIEditor_Edit[4], z) elseif source == GUIEditor_Button[2] then guiSetText(GUIEditor_Edit[5], rx) guiSetText(GUIEditor_Edit[6], ry) guiSetText(GUIEditor_Edit[7], rz) elseif source == GUIEditor_Button[3] then guiSetText(GUIEditor_Edit[1], skinID) elseif source == GUIEditor_Button[5] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") elseif source == GUIEditor_Button[6] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif source == GUIEditor_Button[4] then ped = createPed((guiGetText(GUIEditor_Edit[1])), (guiGetText(GUIEditor_Edit[2])), (guiGetText(GUIEditor_Edit[3])), (guiGetText(GUIEditor_Edit[4])), (guiGetText(GUIEditor_Edit[5])), (guiGetText(GUIEditor_Edit[6])), (guiGetText(GUIEditor_Edit[7]))) triggerServerEvent("savePed",localPlayer,ped) end end addEventHandler("onClientGUIClick", guiRoot, botoones,true )--always include a bool at the end for button/gui click events
-
ped isn't defined in the server-side script. function botoones() local x, y, z = getElementPosition( getLocalPlayer() ) local skinID = getElementModel( getLocalPlayer() ) if source == GUIEditor_Button[1] then guiSetText(GUIEditor_Edit[2], x) guiSetText(GUIEditor_Edit[3], y) guiSetText(GUIEditor_Edit[4], z) elseif source == GUIEditor_Button[2] then guiSetText(GUIEditor_Edit[5], rx) guiSetText(GUIEditor_Edit[6], ry) guiSetText(GUIEditor_Edit[7], rz) elseif source == GUIEditor_Button[3] then guiSetText(GUIEditor_Edit[1], skinID) elseif source == GUIEditor_Button[5] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") elseif source == GUIEditor_Button[6] then guiSetText(GUIEditor_Edit[1], "") guiSetText(GUIEditor_Edit[2], "") guiSetText(GUIEditor_Edit[3], "") guiSetText(GUIEditor_Edit[4], "") guiSetText(GUIEditor_Edit[5], "") guiSetText(GUIEditor_Edit[6], "") guiSetText(GUIEditor_Edit[7], "") guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif source == GUIEditor_Button[4] then ped = createPed((guiGetText(GUIEditor_Edit[1])), (guiGetText(GUIEditor_Edit[2])), (guiGetText(GUIEditor_Edit[3])), (guiGetText(GUIEditor_Edit[4])), (guiGetText(GUIEditor_Edit[5])), (guiGetText(GUIEditor_Edit[6])), (guiGetText(GUIEditor_Edit[7]))) end end addEvent("exportarPeds", true) addEventHandler("exportarPeds", getLocalPlayer(), botoones) --why did you add this to the function? addEventHandler("onClientGUIClick", guiRoot, botoones,true )--always include a bool at the end for button/gui click events
-
Can you PM me your/the server's ip and if there is a pass, I'm going to need to know that to... I'm just going to check this error myself, and see what it might be from...
-
Did you deleted it in your server [GAMEMODES] folder?