-
Posts
732 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Bean666
-
anyway, i created a table with markers, but why does it not go with onClientMarkerHit? can u check on this one? it creates the markers within the tables, but the event onClientMarkerHit doesn't work anymore For some reason, when i only had one marker, the event worked, but now markers are created from a table which is random, now it doesn't work, why? for some reason when the marker is already created, the Markerhit event works, but if it wasnt created yet and it was created by an event, the Markerhit event doesnt work. and it gives me an error that the marker is nil on the onClientMarkerhit, which ofc only happens when i restart the script, since the marker isnt made yet since the creation of the marker triggered by an event. local markers = { { -2403.62598, -599.17444, 131.5 }, {-2425.51172, -610.80096, 132.56250}, { -2416.54712, -594.27307, 132.7115 } } function setAlpha(localPlayer) setElementAlpha(jobmarker, 150) local v = math.random(#markers) marker = createMarker(markers[v][1], markers[v][2], markers[v][3], "cylinder", 3, 0, 240, 0) end addEvent( "activate", true ) addEventHandler( "activate", localPlayer, setAlpha ) addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement == localPlayer and getElementType ( hitElement ) == "player" ) then outputChatBox("working") destroyElement(marker) end end )
-
is client element data and server element data shared? what if i set an element data to a player on serverside will the clientside getElementData still get the data i set on a player from the serverside? i havent scripted for years and i just came back so im kinda confused again. EDIT: SOLVED, lol sorry for this dumbass question. just came back
-
why when i step on the marker with a vehicle it still destroys the marker? all i want is if i'm in a vehicle it will not destroy the marker. this is the function. function crtmarker ( ) marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 255, 255 ) addEventHandler ( "onMarkerHit", marker, MarkerHit ) end function MarkerHit (hitPlayer, matchingDimension) local player = getPedOccupiedVehicle(hitPlayer) if (player) then return end destroyElement(marker) end
-
It doesn't trigger the event "satw" when i press the button, NO ERRORS!!! server: marker765 = createMarker (1908.669921875, -498.3203125, 18.026168823242,"cylinder", 1, 255, 0, 0, 100) function showTheGui(player) if getElementType(player) == "player" then triggerClientEvent (player,"showTheGui",getRootElement(),player) end end addEventHandler("onMarkerHit", marker765, showTheGui) addEvent("satw",true) addEventHandler("satw",root, function() if getElementData(source, "satw", true) then outputChatBox("You already own a SAT-W!") cancelEvent() elseif getElementData(source, "satw", false) then if ( getPlayerMoney (source) >= 100000 ) then takePlayerMoney(source, 100000) setElementData(source, "satw", true) outputChatBox("works", source) end end end) function showTime() if getElementData(source, "satw", true) then triggerClientEvent (source,"showTheTime",getRootElement(),source) end end client: GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function() GUIEditor_Window[1] = guiCreateWindow(0.2,0.1602,0.6285,0.5862,"Sattelite Watch",true) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0161,0.1006,0.9678,0.8786,true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_TabPanel[1],1) GUIEditor_Tab[1] = guiCreateTab("SAT-W",GUIEditor_TabPanel[1]) guiSetAlpha(GUIEditor_Tab[1],1) GUIEditor_Button[1] = guiCreateButton(0.025,0.5,0.2493,0.0934,"Buy the SAT-W | $100.000",true,GUIEditor_Tab[1]) guiSetAlpha(GUIEditor_Button[1],1) guiSetFont(GUIEditor_Button[1],"default-bold-small") GUIEditor_Button[30] = guiCreateButton(0,0,0.2453,0.0854,"Exit",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[30],1) guiSetVisible (GUIEditor_Window[1],false) end) addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) triggerServerEvent ("satw", getLocalPlayer(),satw) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) end end) function showTheGui () guiSetVisible (GUIEditor_Window[1],true) showCursor (true) end addEvent ("showTheGui",true) addEventHandler ("showTheGui",getRootElement(),showTheGui) local hour, minutes = getTime() function draw() dxDrawText(string.format("%02d:%02d", hour, minutes),0, 0) end) local drawingPanel = false; function startDrawing_CMD() if(drawingPanel == false) then addEventHandler("onClientPreRender", getRootElement(), draw); drawingPanel = true; showCursor(true) else removeEventHandler("onClientPreRender", getRootElement(), draw); drawingPanel = false; showCursor(false) end end addEvent("time", true) addEventHandler("time", getRootElement(), startDrawing_CMD)
-
try this it means there is one missing end. elementWeaponRaplace = {} function weaponReplace ( previousWeaponID, currentWeaponID ) --local source = getRootElement() local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if currentWeaponID == weapID1 then if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end if weapon1 == "DMR" then elementWeaponRaplace[source] = createObject(1671,x,y,z) elseif weapon1 == "SVD Camo" then elementWeaponRaplace[source] = createObject(1755,x,y,z) end if elementBackpack[source] then attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) else attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) end elseif previousWeaponID == weapID1 then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace ) function removeBackWeaponOnDrop() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function removeAttachedOnDeath() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end function backpackRemoveQuit() if elementWeaponRaplace[source] then detachElementFromBone(elementWeaponRaplace[source]) destroyElement(elementWeaponRaplace[source]) elementWeaponRaplace[source] = false end local weapon = getElementData(source,"currentweapon_1") if weapon then local ammoData,weapID = getWeaponAmmoType (weapon) giveWeapon(source,weapID,getElementData(source,ammoData), false ) end function weaponSwitchBack ( previousWeaponID, currentWeaponID ) local weapon1 = getElementData(source,"currentweapon_1") if not weapon1 then return end local ammoData1,weapID1 = getWeaponAmmoType(weapon1) local x,y,z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end if weapon1 == "DMR" then elementWeaponBack[source] = createObject(1671,x,y,z) setObjectScale(elementWeaponBack[source],0.875) elseif weapon1 == "SVD" then elementWeaponBack[source] = createObject(1755,x,y,z) setObjectScale(elementWeaponBack[source],0.875) else elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z) setObjectScale(elementWeaponBack[source],0.875) end if elementBackpack[source] then attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.31,-0.1,0,270,-90) else attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.11,-0.1,0,270,10) end elseif currentWeaponID == weapID1 then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end end
-
tell us whats wrong in debugscript 3 and what is this script for or what are u trying to do
-
yeah i already fixed it days ago, thanks anyway!
-
destroyElement works in both sides.
-
well if it's truly yours you will need to re-work the code. i think there's no fix for that.
-
hes just expecting people to do all the stuff for him. and btw this is kinda funny haha.
-
i don't believe you lol, where did you compile this , luac.mta.com?
-
no. its not possible. you need to buy a fast server/vps.
-
We are not here to decompile..... also the owner compiled it to avoid copyers / stealers / remove his credits so... we can't help you as well.
-
do you mean setElementPosition or thats normal?
-
thats a save system. it doesn't have anything to do with it, i believe you have a script that has setElementAlpha. i think. because none can do such thing like that only setElementAlpha can make a player invisible.
-
remove the onResourceStart, etc ,etc and just replace it with this. function minutes() local thePlayer = getPlayerAccount ( source ) local Minutes = getAccountData(thePlayer,"Minutes") if Minutes then setAccountData(thePlayer,"Minutes",tonumber(Minutes)+1) end end setTimer ( minutes, 60000, 0 )
-
try this. function repair(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) local money = getPlayerMoney(thePlayer) local model = getElementModel(vehicle) if not vehicle then return end if (money >= 100) then takePlayerMoney(thePlayer, 100) fixVehicle(vehicle) else outputChatBox("not enough money to fix your vehicle", thePlayer) end end addEvent("repair", true) addEventHandler("repair", getRootElement(), repair)
-
try this not tested. sorry if im wrong i just woke up. ( it might have missing ends or more, just test , i'm glad if there aren't.) Client: local marker = createMarker(x,y,z, "type", size, r, g, b, a) GUIEditor = { button = {}, window = {}, label = {}, memo = {} } GUIEditor.window[1] = guiCreateWindow(122, 97, 583, 368, "Pay N Spray", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.memo[1] = guiCreateMemo(38, 28, 516, 222, "Cost :- Minimum :-10$\n Maximum :- 20000$\n\nINFORMATION :- \n1. If your car is broken you can repair it here . You cant change the color of the car for that go to upgrade shop.\n2. You will need to pay money to repair your car.\n3. If damage in your car is more the cost will be more .\n4. Cost of repair depends upon the type of Vehicle you have.", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(359, 270, 195, 46, "Repair", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(48, 273, 143, 43, "Cancel", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(445, 344, 128, 24, "Designed by sankalp21", false, GUIEditor.window[1]) function markerhit(player) if not isPedInVehicle(localPlayer) then return end if (player == localPlayer) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end addEventHandler("onClientMarkerHit", marker, markerhit) addEventHandler("onClientGUIClick",resourceRoot,function() if (source == GUIEditor.button[1]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) triggerServerEvent("repair", localPlayer, localPlayer) elseif ( source == GUIEditor.button[2]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) SERVER: function repair(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) local money = getPlayerMoney(thePlayer) local model = getElementModel(vehicle) if not vehicle then return end if (money >= 100) then takePlayerMoney(thePlayer, 100) fixVehicle(vehicle) else outputChatBox("not enough money to fix your vehicle", thePlayer) end if model == vehicleids then if (money >= 1000) then takePlayerMoney(thePlayer, 1000) fixVehicle(vehicle) else outputChatBox("not enough money to fix your vehicle", thePlayer) end end addEvent("repair", true) addEventHandler("repair", getRootElement(), repair)
-
here are the functions and events you'll need if you don't know how to use it, click it and check what it does in wiki, and try something then show us your code. --functions-- createMarker -- create a marker fixVehicle -- fix vehicle guiSetVisible -- for close and open getPlayerMoney -- get the player's money amount takePlayerMoney -- take the player's money getPedOccupiedVehicle -- check the car the player is on getElementModel -- to check the car ID for the low costs and high costs as you said --events-- onClientMarkerHit -- use guiSetVisible here onClientGUIClick -- clicking the buttons
-
np. i believe there are other more efficient ways to do that, but that is just an example.
-
this would do i think: getPlayerIdleTime -- checks his idle time setElementData -- for the score board it's easy. tested and works, make sure to add AFK Scoreboard column function checkAFKPlayers() for index, thePlayer in ipairs(getElementsByType("player"))do if (getPlayerIdleTime(thePlayer) > 5000) then -- Player hasn't moved for 5 seconds setElementData(thePlayer, "AFK", "Yes") else setElementData(thePlayer, "AFK", "No") end end end setTimer(checkAFKPlayers, 2000, 0)
-
SOLVED, Thanks to Tox and Walid. now i know how to save a timer ^-^
-
function ex(source) if timerTable[source] and isTimer(timerTable[source]) then return end if not isTimer(timerTable[thePlayer]) then timerTable[thePlayer] = setTimer(function() --blabla-- end, 900000, 1 ) end addCommandHandler ( "ex", ex )
-
should i delete the current timer table i have here and change the current timer[source] names? to timerTable[source] as wel? local timer = {} function ex(source) if timer[source] and isTimer(timer[source]) then return end timer[source] = setTimer(function() timer[source] = nil outputChatBox("blablablabla", source) end, 3600*500, 1) end addCommandHandler ( "ex", ex )