Sziasztok van egy szerelő script viszont nem tudom hogyan bírnám lekérni hogy ha a player pl. 10-es frakcióban tartózkodik akkor engedje dutyzni és adja ki a sérüléseket. Eléggé sokat próbálkoztam és ha valami ment utána az nem ment és csak sorba jött a hiba:/ Előre is köszi a segítséget:)
Duty része:
dutyInt = nil
dutyIntBent = nil
dutyPickup = nil
function dutyInterior ()
dutyInt = createPickup(1752.5, -1912.01611, 13.5, 3, 1272)
dutyIntBent = createPickup(1494.5, 1303.57874, 1093.2, 3, 1273)
setElementInterior(dutyIntBent,3)
dutyPickup = createPickup(1494.45398, 1308.98608, 1093.28430, 3, 1275)
setElementInterior(dutyPickup,3)
end
-- Pickup
-- [Useful funkcio]
function isElementWithinPickup(theElement, thePickup)
if (isElement(theElement) and getElementType(thePickup) == \"pickup\") then
local x, y, z = getElementPosition(theElement)
local x2, y2, z2 = getElementPosition(thePickup)
if (getDistanceBetweenPoints3D(x2, y2, z2, x, y, z) <= 1) then
return true
end
end
return false
end
--
function jatekosPickup (jatekos, dim)
if (jatekos == localPlayer) then
if dim and isElement(dutyInt) then
if (isElementWithinPickup(jatekos, dutyInt)) then
outputChatBox(\"\"..beallitasok[\"chatPrefix\"]..\" A belépéshez nyomj \"..beallitasok[\"szin\"]..\"\'enter\'#ffffff gombot!\",255,255,255,true)
elseif (isElementWithinPickup(jatekos, dutyIntBent)) then
outputChatBox(\"\"..beallitasok[\"chatPrefix\"]..\" A kilépéshez nyomj \"..beallitasok[\"szin\"]..\"\'enter\'#ffffff gombot!\",255,255,255,true)
end
end
end
end
addEventHandler(\"onClientPickupHit\", root, jatekosPickup)
function pickupGomb ()
local getMunka = getElementData(localPlayer, \"e->mechanic->munkaba\")
if (isElementWithinPickup(localPlayer, dutyInt)) then
if getMunka then
fadeCamera(false, 1.5)
setTimer (
function()
setElementInterior(localPlayer,3)
setElementPosition(localPlayer,1494.48633, 1304.00806, 1093.28906)
fadeCamera(true, 1.5)
outputChatBox(\"\"..beallitasok[\"chatPrefix\"]..\" Szolgálatba állni a \"..beallitasok[\"szin\"]..\"/duty#ffffff parancssal tudsz, a kék pickupban!\",255,255,255,true)
end, 1500, 1
)
else
outputChatBox(\"\"..beallitasok[\"chatPrefix\"]..\" Kérlek vedd fel a munkát!\",255,255,255,true)
end
elseif (isElementWithinPickup(localPlayer, dutyIntBent)) then
fadeCamera(false, 1.5)
setTimer (
function()
setElementInterior(localPlayer,0)
setElementPosition(localPlayer,1752.5, -1912.01611, 13.5)
fadeCamera(true, 1.5)
end, 1500, 1
)
end
end
bindKey(\"enter\", \"down\", pickupGomb)
function duty ()
local getMunka = getElementData(localPlayer, \"e->mechanic->munkaba\")
if (isElementWithinPickup(localPlayer, dutyPickup)) and getMunka then
local getDuty = getElementData(localPlayer, \"e->mechanic->szolgalatba\")
if getDuty then
setElementData(localPlayer, \"e->mechanic->szolgalatba\", false)
setElementModel(localPlayer, math.random(0,200))
outputChatBox(\"\"..beallitasok[\"szin2\"]..\"[Duty]:#ffffff Sikeresen kiléptél a szolgálatból!\",255,255,255,true)
triggerServerEvent ( \"uzenetDolgozokNak\", root, localPlayer, \"\"..getPlayerName(localPlayer)..\" kilépett a szolgálatból!\")
else
setElementData(localPlayer, \"e->mechanic->szolgalatba\", true)
setElementModel(localPlayer, 50)
outputChatBox(\"\"..beallitasok[\"szin2\"]..\"[Duty]:#ffffff Sikeresen szolgálatba léptél!\",255,255,255,true)
triggerServerEvent ( \"uzenetDolgozokNak\", root, localPlayer, \"\"..getPlayerName(localPlayer)..\" szolgálatba lépett!\")
end
end
end
addCommandHandler(\"duty\", duty)
addCommandHandler(\"setfaction\", function(player, cmd, target, groupId)
if player:getData(\"acc:admin\") < 6 then return end
if not tonumber(groupId) then
outputChatBox(\"#ffffff/setfaction [Név / ID] [Frakció ID]\", player, 124, 197, 118, true)
else
groupId = tonumber(groupId)
target, targetName = exports.mta_main:findPlayer(player, target)
if target and target:getData(\"loggedin\") then
if groups[groupId] then
loadGroups()
local qh = dbQuery(reloadGroupDatasForPlayer, connection, \"INSERT INTO groupattach (groupID, characterID) VALUES (?,?)\", groupId, target:getData(\"char:id\"))
loadGroups()
if qh then
exports.mta_admin:outputAdminMessage(\"#7cc576\"..player:getData(\"char:anick\")..\" #fffffffrakcióba tette #7cc576\"..targetName:gsub(\"_\", \" \")..\"#ffffff-t #0094ff(Frakció: \"..groupId..\")\")
dbFree(qh)
end
else
outputChatBox(\"#ffffffHibás frakció ID.\", player, 124, 197, 118, true)
end
end
end
end)