Jump to content

Dimos7

Members
  • Posts

    1,546
  • Joined

  • Last visited

Everything posted by Dimos7

  1. Yes it can you can use https://wiki.multitheftauto.com/wiki/onClientFileDowloadComplete
  2. I use one resource for mysql but i don't use mysql module i use db functions
  3. function findPlayer(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in pairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function isPlayerOnGroup ( thePlayer ) local account = getPlayerAccount ( thePlayer ) local inGroup = false for _, group in ipairs ( { "Console", "Admin", "Moderator", "SuperModerator" } ) do if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then inGroup = true break end end return inGroup end function respawnPlayer ( thePlayer, cmd, Name ) if not ( isPlayerOnGroup ( thePlayer ) ) then outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true) return false end if not name then outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true) return false end if not findPlayer(name) then outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true) return false end local taraf = findPlayer(name) local skin = getElementModel(taraf) local aname = getPlayerName( thePlayer ) local esmesh = getPlayerName(taraf) spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 ) setElementModel(taraf, skin) outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true) for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) end end outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true) end addCommandHandler("respawn", respawnPlayer)
  4. function freezeAllVehs(thePlayer, cmd) for _, vehicle in pairs(getElementsByType("vehicle")) do local currentFreezeStatus = isElementFrozen(vehicle) setElementFrozen(vehicle, not currentFreezeStatus) end end addCommandHandler("fcarall", freezeAllVehs) try this should freeze and unfreeze all vehicles
  5. function findPlayer(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in pairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function isPlayerOnGroup ( thePlayer ) local account = getPlayerAccount ( thePlayer ) local inGroup = false for _, group in ipairs ( { "Console", "Admin", "Moderator", "SuperModerator" } ) do if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then inGroup = true break end end return inGroup end function respawnPlayer ( thePlayer, cmd, Name ) if not ( isPlayerOnGroup ( thePlayer ) ) then outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true) return false end if player == nil then outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true) return false end if not findPlayer(name) then outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true) return false end local taraf = findPlayer(name) local skin = getElementModel(taraf) local aname = getPlayerName( thePlayer ) local esmesh = getPlayerName(taraf) spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 ) setElementModel(taraf, skin) outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true) for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) end end outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true) end addCommandHandler("respawn", respawnPlayer)
  6. getDistanceBetweenPoints3D or getDistanceBetweenPoints2D
  7. firts where is findPlyer function also where is isPlayerOnGroup functions
  8. setElementFrozen isElementFrozen
  9. getElementsByType getPlayerWantedLevel outputChatBox addCommandHandler
  10. Try put in PD script function pd(thePlayer) setElementData(thePlayer, "faction", "Police") end local policeVehicles = { {597, 1531.6806640625, -1668.15234375, 13.3828125}, } local police = "Police" addEventHandler("onResourceStart",resourceRoot,function() for _, v in ipairs(policeVehicles) do local veh = createVehicle(v[1],v[2],v[3],v[4],0,0,v[5]) setElementData(veh,"carFaction",police) end end) function vh ( player, seat ) if seat == 0 then if getElementData(source,"carFaction") == police then if getElementData(player,"faction") ~= police then cancelEvent() outputChatBox ( "#ffff00your are not in police department faction", player,240,155,15,true) end end end end addEventHandler ( "onVehicleStartEnter", root, vh ) ?
  11. when export the function you put in meta that <export function ="name of your function here" type="server"/>
  12. Can you show the meta
  13. What do you mean you want make a ped failling from sky and use parachute?
  14. So you want to take the connection to other resource as understand why not do this and add expprt in meta and done function connectionToMySQL() connection = dbConnect() end addEventHandler("onResourceStart", resourceRoot, connectionToMySQL) function getConnection return connection end
  15. function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a cylindrical marker next to the player: marker1 = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 170 ) if ( marker1 ) then -- check if the marker was created successfully outputConsole ( "El marcador se ha creado correctamente", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createma", consoleCreateMarker ) function marker11 (thePlayer ) if isElementWithinMarker(thePlayer) then -- checking if player is in a marker destroyElement ( marker1) end end addCommandHandler("deletema", marker11 )
  16. function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a cylindrical marker next to the player: local marker1 = createMarker ( x, y, z - 1, "cylinder", 1.5, 255, 255, 0, 170 ) if ( marker1 ) then -- check if the marker was created successfully outputConsole ( "El marcador se ha creado correctamente", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createma", consoleCreateMarker ) function marker11 (thePlayer ) if isElementWithinMarker(thePlayer, marker1) then -- checking if player is in a marker destroyElement ( marker1) end end addCommandHandler("deletema", marker11 )
  17. oh my bad sorry no problem enjoy
  18. wired those even exist on server side with first code you had same error?
  19. - Decompiled Server.luac local l_0_0 = {} local l_0_1 = {} local l_0_2 = {} local l_0_3 = {} local l_0_4 = {} local l_0_5 = {} addEventHandler("onPlayerQuit", root, function() if isElement(source) and getElementData(source, "isOwner") ~= nil and getElementType(getElementData(source, "isOwner")) == "vehicle" then destroyElement(getElementData(source, "isOwner")) removeElementData(source, "isOwner") if isTimer(l_0_0[source]) then killTimer(l_0_0[source]) end if isTimer(l_0_1[source]) then killTimer(l_0_1[source]) end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) l_0_5[source] = nil end end end ) createMyVehicle = function(l_2_0, l_2_1, l_2_2, l_2_3) if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") == nil then local l_2_4 = getPlayerAccount(source) local l_2_5 = getAccountName(l_2_4) local l_2_6 = getPlayerName(source) local l_2_7 = l_2_6:gsub("#%x%x%x%x%x%x", "") theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3) setVehicleDamageProof(theVehicle, true) setElementData(source, "isOwner", theVehicle) setElementData(theVehicle, "Owner", l_2_5) setElementData(theVehicle, "OwnerName", l_2_7) setElementData(theVehicle, "Locked", true) return end if l_2_0 and l_2_1 and l_2_2 and l_2_3 then local l_2_8 = getPedOccupiedVehicle(source) local l_2_9 = getElementData(source, "isOwner") if isPedInVehicle(source) and isElement(l_2_8) and isElement(l_2_9) and l_2_8 == l_2_9 then setElementModel(l_2_9, l_2_0) return end end if l_2_0 and l_2_1 and l_2_2 and l_2_3 and not isGuestAccount(getPlayerAccount(source)) and getElementData(source, "isOwner") ~= nil then local l_2_10 = getPlayerAccount(source) local l_2_11 = getAccountName(l_2_10) local l_2_12 = getPlayerName(source):gsub("#%x%x%x%x%x%x", "") if isElement(getElementData(source, "isOwner")) then destroyElement(getElementData(source, "isOwner")) end removeElementData(source, "isOwner") theVehicle = createVehicle(l_2_0, l_2_1 + 2, l_2_2 + 2, l_2_3) setVehicleDamageProof(theVehicle, true) setElementData(source, "isOwner", theVehicle, true) setElementData(theVehicle, "Owner", l_2_11) setElementData(theVehicle, "OwnerName", l_2_12) setElementData(theVehicle, "Locked", true) end end addEvent("createVehicleFromGUI", true) addEventHandler("createVehicleFromGUI", root, createMyVehicle) addEventHandler("onVehicleStartEnter", root, function(l_3_0) local l_3_1 = getElementData(source, "Owner") local l_3_2 = getElementData(source, "Locked") if l_3_1 and l_3_2 then local l_3_3 = getPlayerAccount(l_3_0) if getAccountName(l_3_3) ~= getElementData(source, "Owner") then cancelEvent() b = math.random(0, 255) g = math.random(0, 255) r = math.random(0, 255) outputChatBox(" *[ Private car owned by " .. getElementData(source, "OwnerName") .. " ]", l_3_0, r, g, b, true) else b = math.random(0, 255) g = math.random(0, 255) r = math.random(0, 255) outputChatBox(" *[ Welcome \226\152\186 ]", l_3_0, r, b, g, true) end end end ) addEvent("Spawn", true) addEventHandler("Spawn", root, function() local l_4_0, l_4_1, l_4_2 = getElementPosition(source) local l_4_3 = getElementData(source, "isOwner") if not isElement(l_4_3) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_4_3 and isElement(l_4_3) then setElementPosition(getElementData(source, "isOwner"), l_4_0 + 2, l_4_1, l_4_2 + 1) outputChatBox(" *Car Spawned.", source, 255, 0, 0) end end ) addEvent("Warp", true) addEventHandler("Warp", root, function() local l_5_0 = getElementData(source, "isOwner") if not isElement(l_5_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_5_0 and isElement(l_5_0) then fadeCamera(source, false, 0.5) setTimer(fadeCamera, 500, 1, source, true) warpPedIntoVehicle(source, l_5_0) end end ) addEvent("Destroy", true) addEventHandler("Destroy", root, function() local l_6_0 = getElementData(source, "isOwner") if not isElement(l_6_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_6_0 and isElement(l_6_0) then destroyElement(l_6_0) outputChatBox(" *Car Destroyed.", source, 255, 0, 0) removeElementData(source, "isOwner") if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) l_0_5[source] = nil end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end end end ) addEvent("Locks", true) addEventHandler("Locks", root, function() local l_7_0 = getElementData(source, "isOwner") if not isElement(l_7_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_7_0 and isElement(l_7_0) then local l_7_1 = getElementData(l_7_0, "Locked") if l_7_1 == true then removeElementData(l_7_0, "Locked") outputChatBox(" *Car unlocked.", source, 255, 0, 0) else setElementData(l_7_0, "Locked", true) outputChatBox(" *Car locked.", source, 0, 255, 0) end end end ) addEvent("Engine", true) addEventHandler("Engine", root, function() local l_8_0 = getElementData(source, "isOwner") if not isElement(l_8_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_8_0 and isElement(l_8_0) then local l_8_1 = getVehicleEngineState(l_8_0) if not l_8_1 then setVehicleEngineState(l_8_0, not l_8_1) outputChatBox(" *Engine started.", source, 0, 255, 0) else setVehicleEngineState(l_8_0, not l_8_1) outputChatBox(" *Engine stopped.", source, 255, 0, 0) end end end ) addEvent("Lights", true) addEventHandler("Lights", root, function() local l_9_0 = getElementData(source, "isOwner") if not isElement(l_9_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_9_0 and isElement(l_9_0) then local l_9_1 = getVehicleOverrideLights(l_9_0) == 2 if not l_9_1 then setVehicleOverrideLights(l_9_0, 2) outputChatBox(" *Lights On.", source, 0, 255, 0) else setVehicleOverrideLights(l_9_0, 1) outputChatBox(" *Lights Off.", source, 255, 0, 0) end end end ) addEvent("Nitrous", true) addEventHandler("Nitrous", root, function() local l_10_0 = getElementData(source, "isOwner") if not isElement(l_10_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_10_0 and isElement(l_10_0) then addVehicleUpgrade(l_10_0, 1010) outputChatBox(" *Nitrous upgrade has been added to your vehicle.", source, 0, 255, 0) end end ) addEvent("Arrow", true) addEventHandler("Arrow", root, function() local l_11_0 = getElementData(source, "isOwner") if not isElement(l_11_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_11_0 and isElement(l_11_0) then if isElement(l_0_5[source]) then destroyElement(l_0_5[source]) outputChatBox(" *The arrow has been removed from your vehicle.", source, 255, 0, 0) else local l_11_1, l_11_2, l_11_3 = getElementPosition(l_11_0) l_0_5[source] = createObject(1318, l_11_1, l_11_2, l_11_3 + 2, 0, 0, 0) attachElements(l_0_5[source], l_11_0, 0, 0, 2) outputChatBox(" *The arrow has been attached to your vehicle.", source, 0, 255, 0) end end end ) addEvent("Colors", true) addEventHandler("Colors", root, function() local l_12_0 = getElementData(source, "isOwner") if not isElement(l_12_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_12_0 and isElement(l_12_0) then if not l_0_2[source] then l_0_2[source] = true l_0_0[source] = setTimer(randomVehColors, 1000, 0, l_12_0, source) outputChatBox(" *Random colors is now enabled.", source, 0, 255, 0) else l_0_2[source] = false if isTimer(l_0_0[source]) then killTimer(l_0_0[source]) outputChatBox(" *Random colors is now disabled", source, 255, 0, 0) end end end end ) randomVehColors = function(l_13_0, l_13_1) if not isElement(l_13_0) and isElement(l_13_1) then if isTimer(l_0_0[l_13_1]) then killTimer(l_0_0[l_13_1]) end l_0_2[l_13_1] = false return end if isElement(l_13_0) then local l_13_2 = math.random(0, 255) local l_13_3 = math.random(0, 255) local l_13_4 = math.random(0, 255) local l_13_5 = math.random(0, 255) setVehicleColor(l_13_0, l_13_2, l_13_3, l_13_4, l_13_5) end end addEvent("Smoke", true) addEventHandler("Smoke", root, function() local l_14_0 = getElementData(source, "isOwner") if not isElement(l_14_0) then outputChatBox(" *You do not have a car!", source, 255, 0, 0) return end if l_14_0 and isElement(l_14_0) and l_0_3[source] then l_0_3[source] = false if isTimer(l_0_1[source]) then killTimer(l_0_1[source]) end if isElement(l_0_4[source]) then destroyElement(l_0_4[source]) l_0_4[source] = nil end outputChatBox(" *Smoke is now disabled.", source, 255, 0, 0) return end if l_14_0 and isElement(l_14_0) and not l_0_3[source] then l_0_3[source] = true l_0_1[source] = setTimer(addSmoke, 1000, 0, l_14_0, source) outputChatBox(" *Smoke is now enabled.", source, 0, 255, 0) end end ) addSmoke = function(l_15_0, l_15_1) if not isElement(l_15_0) and isElement(l_15_1) then if isTimer(l_0_1[l_15_1]) then killTimer(l_0_1[l_15_1]) end if isElement(l_0_4[l_15_1]) then destroyElement(l_0_4[l_15_1]) l_0_4[l_15_1] = nil end l_0_3[l_15_1] = false return end local l_15_2 = getElementSpeed(l_15_0, "kmh") if l_15_2 >= 120 then local l_15_3, l_15_4, l_15_5 = getElementPosition(l_15_0) if isElement(l_0_4[l_15_1]) then return end l_0_4[l_15_1] = createObject(2780, l_15_3, l_15_4, l_15_5 - 2, 0, 0, 0) setElementAlpha(l_0_4[l_15_1], 0) attachElements(l_0_4[l_15_1], l_15_0, 0, -2, -1) elseif isElement(l_0_4[l_15_1]) then destroyElement(l_0_4[l_15_1]) l_0_4[l_15_1] = nil end end addEvent("Armor", true) addEventHandler("Armor", root, function() if isElement(source) then setPedArmor(source, 100) outputChatBox("Your armor has been set to 100%.", source, 0, 255, 0) end end ) addEvent("Health", true) addEventHandler("Health", root, function() if isElement(source) then setElementHealth(source, 200) outputChatBox("Your health has been set to 100%.", source, 0, 255, 0) end end ) addEvent("SetFStyle", true) addEventHandler("SetFStyle", root, function(l_18_0) if isElement(source) and tonumber(l_18_0) then setPedFightingStyle(source, tonumber(l_18_0)) end end ) addEvent("Stats", true) addEventHandler("Stats", root, function() if isElement(source) then setPedStat(source, 23, 1000) setPedStat(source, 24, 1000) setPedStat(source, 69, 1000) setPedStat(source, 70, 1000) setPedStat(source, 71, 1000) setPedStat(source, 72, 1000) setPedStat(source, 73, 1000) setPedStat(source, 74, 1000) setPedStat(source, 75, 1000) setPedStat(source, 76, 1000) setPedStat(source, 77, 1000) setPedStat(source, 78, 1000) setPedStat(source, 79, 1000) outputChatBox("Your weapon skills and max health has been set to maximum.", source, 0, 255, 0) end end ) getElementSpeed = function(l_20_0, l_20_1) if l_20_1 == nil then l_20_1 = 0 end if isElement(l_20_0) then local l_20_2, l_20_3, l_20_4 = getElementVelocity(l_20_0) if l_20_1 == "mph" or l_20_1 == 1 or l_20_1 == "1" then return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 100 else return l_20_2 ^ 2 + l_20_3 ^ 2 + l_20_4 ^ 2 ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEvent("status", true) addEventHandler("status", root, function() local l_21_0 = getPlayerAccount(source) local l_21_1 = getAccountName(l_21_0) if isObjectInACLGroup("user." .. l_21_1, aclGetGroup("Console")) then triggerClientEvent(source, "status", source) else triggerClientEvent(source, "statusF", source) end end ) open = function() local l_21_0 = getPlayerAccount(source) local l_21_1 = getAccountName(l_21_0) if isObjectInACLGroup("user."..l_21_1, aclGetGroup("Console")) then else return end triggerClientEvent(source, "showwindow", source) end end addEvent("showwindow", true) addEventHandler("showwindow", getRootElement(), open)
  20. The even ahowahide never triggers you need to triggers that costum event for panel show up and triggers it again for hide that all
  21. So you want visible to conlse group instead of VIP?
×
×
  • Create New...