Jump to content

[Ajuda] Porfavor Central SAMU


Recommended Posts

Quote

[2019-04-19 17:50:28] WARNING: [SAMU]Central\sVazern.lua:146: Bad argument @ 'getPlayerAccount' [Expected element at argument 1]
[2019-04-19 17:50:34] WARNING: [SAMU]Central\sVazern.lua:146: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]
[2019-04-19 17:50:34] ERROR: [SAMU]Central\sVazern.lua:146: attempt to concatenate a boolean value

 

Quote

--[[


 ################################################
 #                                              #                                                  
 #             SCRIPT PRODUZIDO POR:            #
 #            FACEBOOK.COM/VAZERNMTA            #
 #                                              #
 #                                              #
 ################################################



]]


-- ######### VARIÁVEIS #########


local inutil5 = createMarker(1567.79089, -1615.65723, 10.38281, "cylinder", 3, 255, 0, 0, 50) 
local rBlock = createColRectangle(1997.01465, -1451.21179, 75, 98)
local areaR = createRadarArea(1997.01465, -1451.21179, 75, 98, 255, 0, 0, 80)
local car = {}
local carID = nil
local join = createMarker(2033.91504, -1402.85449, 17.29235, "cylinder", 2, 255, 255, 0, 0) 
local inutil2 = createMarker(2033.91504, -1402.85449, 16.09235, "cylinder", 2, 255, 0, 0, 40) 

local exit = createMarker(246.39839, 107.42607, 1003.21875, "cylinder", 1, 255, 255, 0, 0) 
local inutil3 = createMarker(246.39839, 107.42607, 1002.21875, "cylinder", 1, 255, 0, 0, 50) 
  setElementInterior(exit, 10)
  setElementDimension(exit, 2)
  setElementInterior(inutil3, 10)
  setElementDimension(inutil3, 2)

local marker = createMarker(246.62920, 118.53716, 1003.21875, "cylinder", 2, 255, 255, 0, 0) 
local inutil = createMarker(246.62920, 118.53716, 1002.21875, "cylinder", 2, 255, 0, 0, 50) 
  setElementInterior(marker, 10)
  setElementDimension(marker, 2)
  setElementInterior(inutil, 10)
  setElementDimension(inutil, 2)

local pickup = createPickup(2033.91504, -1402.85449, 17.29235, 3, 1240, 1)



-- ######### VARIÁVEIS #########


function saveData6(conta)
    if conta then
        local source = getAccountPlayer(conta)
        if isElement(source) then
            local medkit = getElementData(source,"KitMedico") or 0
            setAccountData(conta, "medkits",tonumber(medkit))
        end
    end 
end

function loadData6(conta)
    if not (isGuestAccount (conta)) then
        if (conta) then 
            local source = getAccountPlayer(conta)  
            if isElement(source) then
                local medkits = getAccountData(conta,"medkits")
                if type(medkits) == "boolean" or "medkits" == nil then
                    medkits = 0
                end
                setElementData(source, "KitMedico", tonumber(medkits))            
            end
        end
    end 
end



addEventHandler("onPlayerLogin", root,
  function(_, acc)
    setTimer(loadData6,1000,1,acc)
  end
)

function saveOnStartScript(res)
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                loadData6(acc)           
            end
        end
    end
end
addEventHandler("onResourceStart", getRootElement(), saveOnStartScript)

function saveOnStopScript(res)
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                saveData6(acc)   
            end
        end
    end
end 
addEventHandler("onResourceStop", getRootElement(), saveOnStopScript)



function saveOnQuit(quitType)
    local acc = getPlayerAccount(source)
    if not (isGuestAccount(acc)) then
        if acc then
            saveData6(acc)
        end
    end
end
addEventHandler("onPlayerQuit", getRootElement(), saveOnQuit)


function fadeCameraDelayed(player) 
      if (isElement(player)) then
            fadeCamera(player, true, 0.5)
      end
end

function entrar(thePlayer)
   fadeCamera(thePlayer, false, 1.0, 0, 0, 0)    
   setTimer(fadeCameraDelayed, 1000, 1, thePlayer)
   setTimer(function()
   setElementInterior(thePlayer, 10, 246.39647, 110.09633, 1003.22571)
   setElementDimension(thePlayer, 2)
   end, 1000, 1)
end
addEventHandler("onPickupHit", pickup, entrar)

function sair(thePlayer)
   fadeCamera(thePlayer, false, 1.0, 0, 0, 0)    
   setTimer(fadeCameraDelayed, 1000, 1, thePlayer)
   setTimer(function()
   setElementInterior(thePlayer, 0, 2032.08215, -1408.17297, 17.16406)
   setElementDimension(thePlayer, 0)
   end, 1000, 1)
end
addEventHandler("onMarkerHit", exit, sair)

function blockJoin(player)
	if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("SAMU")) then
	    if getPedOccupiedVehicle(player) then 
	    	setElementPosition(getPedOccupiedVehicle(player), 1983.74536, -1465.94702, 13.39063)
	    end
		setElementPosition(player, 1983.74536, -1465.94702, 13.39063)
		exports.Scripts_Dxmessages:outputDx(player, "Você não pode entrar aqui!", "error")
	end
end
addEventHandler("onColShapeHit", rBlock, blockJoin)


function dxMsg(source, text, type)
	exports.Scripts_Dxmessages:outputDx(source, text, type)
end	

function open(source)
   triggerClientEvent(source, "openMenuS", root)
end
addEventHandler("onMarkerHit", marker, open)


function createAmbulance()
	if car[source] and isElement(car[source]) then 
		destroyElement(car[source]) 
		car[source] = nil 
	end
	local carID = 416
	setElementDimension(source, 0)
	setElementInterior(source, 0, 1994.9879150391,-1451.1810302734,13.5546875)
	car[source] = createVehicle(carID, 1994.9879150391,-1451.1810302734,13.5546875)
	warpPedIntoVehicle(source,car[source])
	dxMsg(source, "Veículo spawnado!", "info")
end 
addEvent("createAmbulance",true)
addEventHandler("createAmbulance", root, createAmbulance)


function giveMedicKit()
medKit = getElementData(source, "KitMedico")
	if medKit < 30 then
		setElementData(source, "KitMedico", medKit + 1)
		dxMsg(source, "Você adicionou um Kit Médico!", "success")
	else
		dxMsg(source, "Você já alcancou seu limite de Kit Médico.", "error")
	end
end 
addEvent("giveMedicKit",true)
addEventHandler("giveMedicKit", root, giveMedicKit)

function setSAMUSkin()
	setElementModel(source, samuSkinID)
end 
addEvent("setSAMUSkin",true)
addEventHandler("setSAMUSkin", root, setSAMUSkin)

--[[function checkSkin()
	for i, player in pairs (getElementsByType("player")) do
		local accName = getAccountName(getPlayerAccount(player))
		if isObjectInACLGroup("user."..accName, aclGetGroup("SAMU")) then
			if getElementModel(player) == samuSkinID then
			
			else
				setElementModel(player, samuSkinID)
			end
	    end
	end
end
setTimer(checkSkin, 5000, 0)--]]


function blockVehicleEnter(player, seat, jacked)
local accName = getAccountName(getPlayerAccount (player))
	if not isObjectInACLGroup("user."..accName, aclGetGroup("SAMU")) and getElementModel(source) == 416 then
		cancelEvent()
		dxMsg(player, "Você não pode usar este veículo.", "error")
	end
end
addEventHandler("onVehicleStartEnter", getRootElement(), blockVehicleEnter)




 

 

Link to comment
local inutil5 = createMarker(1567.79089, -1615.65723, 10.38281, "cylinder", 3, 255, 0, 0, 50) 
local rBlock = createColRectangle(1997.01465, -1451.21179, 75, 98)
local areaR = createRadarArea(1997.01465, -1451.21179, 75, 98, 255, 0, 0, 80)
local car = {}
local carID = nil
local join = createMarker(2033.91504, -1402.85449, 17.29235, "cylinder", 2, 255, 255, 0, 0) 
local inutil2 = createMarker(2033.91504, -1402.85449, 16.09235, "cylinder", 2, 255, 0, 0, 40) 

local exit = createMarker(246.39839, 107.42607, 1003.21875, "cylinder", 1, 255, 255, 0, 0) 
local inutil3 = createMarker(246.39839, 107.42607, 1002.21875, "cylinder", 1, 255, 0, 0, 50) 
  setElementInterior(exit, 10)
  setElementDimension(exit, 2)
  setElementInterior(inutil3, 10)
  setElementDimension(inutil3, 2)

local marker = createMarker(246.62920, 118.53716, 1003.21875, "cylinder", 2, 255, 255, 0, 0) 
local inutil = createMarker(246.62920, 118.53716, 1002.21875, "cylinder", 2, 255, 0, 0, 50) 
  setElementInterior(marker, 10)
  setElementDimension(marker, 2)
  setElementInterior(inutil, 10)
  setElementDimension(inutil, 2)

local pickup = createPickup(2033.91504, -1402.85449, 17.29235, 3, 1240, 1)



-- ######### VARIÁVEIS #########


function saveData6(conta)
    if conta then
        local source = getAccountPlayer(conta)
        if isElement(source) then
            local medkit = getElementData(source,"KitMedico") or 0
            setAccountData(conta, "medkits",tonumber(medkit))
        end
    end 
end

function loadData6(conta)
    if not (isGuestAccount (conta)) then
        if (conta) then 
            local source = getAccountPlayer(conta)  
            if isElement(source) then
                local medkits = getAccountData(conta,"medkits")
                if type(medkits) == "boolean" or "medkits" == nil then
                    medkits = 0
                end
                setElementData(source, "KitMedico", tonumber(medkits))            
            end
        end
    end 
end



addEventHandler("onPlayerLogin", root,
  function(_, acc)
    setTimer(loadData6,1000,1,acc)
  end
)

function saveOnStartScript(res)
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                loadData6(acc)           
            end
        end
    end
end
addEventHandler("onResourceStart", getRootElement(), saveOnStartScript)

function saveOnStopScript(res)
    if res == getThisResource() then
        for i, player in ipairs(getElementsByType("player")) do
            local acc = getPlayerAccount(player)
            if not isGuestAccount(acc) then
                saveData6(acc)   
            end
        end
    end
end 
addEventHandler("onResourceStop", getRootElement(), saveOnStopScript)



function saveOnQuit(quitType)
    local acc = getPlayerAccount(source)
    if not (isGuestAccount(acc)) then
        if acc then
            saveData6(acc)
        end
    end
end
addEventHandler("onPlayerQuit", getRootElement(), saveOnQuit)


function fadeCameraDelayed(player) 
      if (isElement(player)) then
            fadeCamera(player, true, 0.5)
      end
end

function entrar(thePlayer)
   fadeCamera(thePlayer, false, 1.0, 0, 0, 0)    
   setTimer(fadeCameraDelayed, 1000, 1, thePlayer)
   setTimer(function()
   setElementInterior(thePlayer, 10, 246.39647, 110.09633, 1003.22571)
   setElementDimension(thePlayer, 2)
   end, 1000, 1)
end
addEventHandler("onPickupHit", pickup, entrar)

function sair(thePlayer)
   fadeCamera(thePlayer, false, 1.0, 0, 0, 0)    
   setTimer(fadeCameraDelayed, 1000, 1, thePlayer)
   setTimer(function()
   setElementInterior(thePlayer, 0, 2032.08215, -1408.17297, 17.16406)
   setElementDimension(thePlayer, 0)
   end, 1000, 1)
end
addEventHandler("onMarkerHit", exit, sair)

function blockJoin(player)
	if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("SAMU")) then
	    if getPedOccupiedVehicle(player) then 
	    	setElementPosition(getPedOccupiedVehicle(player), 1983.74536, -1465.94702, 13.39063)
	    else
			setElementPosition(player, 1983.74536, -1465.94702, 13.39063)
		end	
	else
		exports.Scripts_Dxmessages:outputDx(player, "Você não pode entrar aqui!", "error")
	end	
end
addEventHandler("onColShapeHit", rBlock, blockJoin)


function dxMsg(source, text, type)
	exports.Scripts_Dxmessages:outputDx(source, text, type)
end	

function open(source)
   triggerClientEvent(source, "openMenuS", root)
end
addEventHandler("onMarkerHit", marker, open)


function createAmbulance()
	if car[source] and isElement(car[source]) then 
		destroyElement(car[source]) 
		car[source] = nil 
	end
	local carID = 416
	setElementDimension(source, 0)
	setElementInterior(source, 0, 1994.9879150391,-1451.1810302734,13.5546875)
	car[source] = createVehicle(carID, 1994.9879150391,-1451.1810302734,13.5546875)
	warpPedIntoVehicle(source,car[source])
	dxMsg(source, "Veículo spawnado!", "info")
end 
addEvent("createAmbulance",true)
addEventHandler("createAmbulance", root, createAmbulance)


function giveMedicKit()
medKit = getElementData(source, "KitMedico")
	if medKit < 30 then
		setElementData(source, "KitMedico", medKit + 1)
		dxMsg(source, "Você adicionou um Kit Médico!", "success")
	else
		dxMsg(source, "Você já alcancou seu limite de Kit Médico.", "error")
	end
end 
addEvent("giveMedicKit",true)
addEventHandler("giveMedicKit", root, giveMedicKit)

function setSAMUSkin()
	setElementModel(source, samuSkinID)
end 
addEvent("setSAMUSkin",true)
addEventHandler("setSAMUSkin", root, setSAMUSkin)

--[[function checkSkin()
	for i, player in pairs (getElementsByType("player")) do
		local accName = getAccountName(getPlayerAccount(player))
		if isObjectInACLGroup("user."..accName, aclGetGroup("SAMU")) then
			if getElementModel(player) == samuSkinID then
			
			else
				setElementModel(player, samuSkinID)
			end
	    end
	end
end
setTimer(checkSkin, 5000, 0)--]]


function blockVehicleEnter(player, seat, jacked)
local accName = getAccountName(getPlayerAccount (player))
	if not isObjectInACLGroup("user."..accName, aclGetGroup("SAMU")) and getElementModel(source) == 416 then
		cancelEvent()
		dxMsg(player, "Você não pode usar este veículo.", "error")
	end
end
addEventHandler("onVehicleStartEnter", getRootElement(), blockVehicleEnter)

 

Deixe um like nas respostas que te ajudaram... clique no botão de coração que tem no lado da resposta......

Edited by Jonas^
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...