swedishboy
Members-
Posts
45 -
Joined
-
Last visited
Everything posted by swedishboy
-
Will try it later. Thanks
-
Hi, I will make a button that refresh a resource but i dont know what i exactly need to use to do it. The button is no problem for me to do, but to get the resource i want to refresh is the problem.
-
@mr.Loki Thanks alot!
-
I made this and it works but only on 1 marker not on all markers in the table.. local spots = { {2488.32886, -1670.63599, 12.33595}, {2490.92886, -1670.63599, 12.33595}, {2495.92886, -1670.63599, 12.33595} } for k,v in ipairs (spots) do marker1 = createMarker(v[1], v[2], v[3], "cylinder", 1.2, 22, 22, 22) end function getHp (player) local money = getPlayerMoney(player) local hpp = getElementHealth(player) if money >= 1000 and hpp < 100 then setElementHealth(player, 100) takePlayerMoney(player, 1000) elseif money >= 1000 and hpp >= 100 then outputChatBox("Your HP is already full", player, 222, 44, 22) elseif money < 1000 then outputChatBox("You don't have enough money", player, 222, 44, 22) end end addEventHandler("onMarkerHit", marker1, getHp)
-
Thanks but that wont work
-
Like this? local spots = { {2488.32886, -1670.63599, 12.33595}, {2490.92886, -1670.63599, 12.33595}, {2495.92886, -1670.63599, 12.33595} } function getHp (player) for k,v in ipairs (spots) do marker1 = createMarker(v[1],v[2],v[3], "cylinder", 1.2, 22, 22, 22) addEventHandler("onMarkerHit", marker1, getHp) end local money = getPlayerMoney(player) local hpp = getElementHealth(player) if money >= 1000 and hpp < 100 then setElementHealth(player, 100) takePlayerMoney(player, 1000) elseif money >= 1000 and hpp >= 100 then outputChatBox("Your HP is already full", player, 222, 44, 22) elseif money < 1000 then outputChatBox("You don't have enough money", player, 222, 44, 22) end end
-
I can see the markers with this code but still not working.. getting this warning Bad argument @ 'addEventHandler' [expected element at argument 3, got nil] local spots = { {2488.32886, -1670.63599, 12.33595}, {2490.92886, -1670.63599, 12.33595}, {2495.92886, -1670.63599, 12.33595} } for k,v in ipairs (spots) do marker1 = createMarker(v[1],v[2],v[3], "cylinder", 1.2, 22, 22, 22) addEventHandler("onMarkerHit", marker1, getHp) end function getHp (player) local money = getPlayerMoney(player) local hpp = getElementHealth(player) if money >= 1000 and hpp < 100 then setElementHealth(player, 100) takePlayerMoney(player, 1000) elseif money >= 1000 and hpp >= 100 then outputChatBox("Your HP is already full", player, 222, 44, 22) elseif money < 1000 then outputChatBox("You don't have enough money", player, 222, 44, 22) end end
-
Hello. I cant see the markers and im getting this warning in debugscript Bad argument @ 'addEventHandler' [expected element at argument 2, got nil] local spots = { {2488.32886, -1670.63599, 12.33595}, {2490.92886, -1670.63599, 12.33595}, {2495.92886, -1670.63599, 12.33595}, } function getHp (player) for k,v in ipairs (spots) do marker1 = createMarker(v[1],v[2],v[3], "cylinder", 1.2, 22, 22, 22) end local money = getPlayerMoney(player) local hpp = getElementHealth(player) if money >= 1000 and hpp < 100 then setElementHealth(player, 100) takePlayerMoney(player, 1000) elseif money >= 1000 and hpp >= 100 then outputChatBox("Your HP is already full", player, 222, 44, 22) elseif money < 1000 then outputChatBox("You don't have enough money", player, 222, 44, 22) end end addEventHandler("onMarkerHit", marker1, getHp)
-
help/dayz- attempt to index global "gameplayvariables"
swedishboy replied to bundiiE's topic in Scripting
value = gameplayVariables And the errors show ''gameplayvariables'' make sure it is ''gameplayVariables'' because the error got that means it doesn't exist -
Ye you can do it that way too, it's up to him waht he want to use. And btw @GrinningTrout change the outputChatBox ''thePlayer'' to ''source'' or the whole server will see the output
-
I don't know what you exactly want but i made this.. server-side: function getArmor () local armor = getPlayerArmor(source) local money = getPlayerMoney(source) if money >= 100 and armor < 100 then setPedArmor(source,armor+50) takePlayerMoney(source, 100) elseif money >= 100 and armor >= 100 then outputChatBox("Already full armor", source, 255, 0, 0) elseif money < 100 then outputChatBox("Not enough money", source, 255, 0, 0) end end addEvent("onarmorb", true) addEventHandler("onarmorb", root, getArmor) client-side: mywindow = guiCreateWindow(564, 440, 169, 111, "", false) guiWindowSetSizable(mywindow, false) armorB = guiCreateButton(19, 26, 130, 42, "Armor", false, mywindow) closeB = guiCreateButton(42, 74, 86, 27, "Close", false, mywindow) guiSetVisible(mywindow, false) addCommandHandler("y", function () if guiGetVisible(mywindow) == false then guiSetVisible(mywindow, true) showCursor(true) end end ) addEventHandler("onClientGUIClick", closeB, function() guiSetVisible(mywindow,false) showCursor(false) end,false) addEventHandler("onClientGUIClick", armorB, function() triggerServerEvent("onarmorb", getLocalPlayer()) end,false) Use command /y
-
hi. https://wiki.multitheftauto.com/wiki/Ev ... ce_Element about errors and warnings https://wiki.multitheftauto.com/wiki/Debugging
-
If i understood you right addCommandHandler ( Command, -- Adding The Command Handler function ( player, cmd ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ("user."..accName, aclGetGroup ("PMG")) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Access Denied ",player,255,0,0) end end )
-
Looking for this? https://wiki.multitheftauto.com/wiki/GuiCreateEdit
-
local gate1 = createObject(2930, 1575.2001953125, -1634.7001953125, -87.699996948242, 0,0,0) setElementInterior (gate1, 6) local AllowedToOpen = "ADD YOUR TEAM HERE" function open(thePlayer) if getElementType(thePlayer) == "player" then local myTeam = getPlayerTeam(thePlayer) if myTeam == getTeamFromName( AllowedToOpen ) then moveObject(gate1, 3000, 1575.2, -1636.1999511719, -87.699996948242, 0,0,0) end end end addCommandHandler("gate1", open) function close(thePlayer) if getElementType(thePlayer) == "player" then local myTeam = getPlayerTeam(thePlayer) if myTeam == getTeamFromName( AllowedToOpen ) then moveObject(gate1, 3000, 1575.2001953125, -1634.7001953125, -87.699996948242, 0,0,0) end end end addCommandHandler("gate1c", close) addCommandHandler("PMGCcloseall", close)
-
I tested it now and works perfect, then you added the script server-side and not client-side
-
Nothing again... This code Edited by Oskar should work.. make sure you write /mini and not /Mini
-
local bmx = { [510]=true } function bmxS(player, seat) local model = getElementModel (source) if bmx[model] then timer = setTimer(respawnVehicle, 5000, 1, source) end end addEventHandler("onVehicleExit", root, bmxS) function stopr () if bmx[model] then elseif (isTimer(timer)) then killTimer(timer) end end addEventHandler("onVehicleEnter", root, stopr)
-
function medkit(attacker, weapon) timer = setTimer(heal, 3000, 1, source) end addEventHandler ( "onPlayerDamage", root,medkit) function heal(player) health = getElementHealth (player) if (health < 100) then setElementHealth(player,health+5) elseif (isTimer(timer)) then killTimer(timer) end end
-
You forgot a ''then'' in line 6.. And in line 4 change playerDamage to playerDamages
-
function healer(playerSource) money = getPlayerMoney ( playerSource ) if money >= 3000 then takePlayerMoney ( playerSource , 3000 ) setElementHealth ( playerSource , 100 ) outputChatBox ("You Got 100 HP" , playerSource, 21 , 241 , 32 , true ) else outputChatBox ("Server : You Don't have enough money",playerSource ,255,0,0) end end addCommandHandler ( "hp", healer )
-
Something like that if i understand you right..? addEventHandler("onClientResourceStart", resourceRoot, function() myb = guiCreateButton(690, 400, 100, 100, "?", false) showCursor(true) addEventHandler( "onClientMouseEnter", myb, showClientImage, false) addEventHandler( "onClientMouseLeave", myb, dontshowClientImage, false) end ) function showClientImage() image = guiCreateStaticImage( 690, 310, 100, 100, "icon/button.png", false ) end function dontshowClientImage() guiSetVisible(image, false) end
-
https://wiki.multitheftauto.com/wiki/Ev ... ce_Element
-
local screenW, screenH = guiGetScreenSize() ventana = guiCreateWindow((screenW - 456) / 2, (screenH - 307) / 2, 456, 307, ".-Tienda Zenbeit-.", false) guiWindowSetSizable(ventana, false) botonvida = guiCreateButton(9, 22, 97, 21, "Vida [100]", false, ventana) botonarmadura = guiCreateButton(9, 53, 97, 21, "Armadura [100]", false, ventana) botonminigun = guiCreateButton(349, 25, 97, 18, "Minigun [100]", false, ventana) botonbazooka = guiCreateButton(349, 56, 97, 18, "Bazooka [10]", false, ventana) guiLabelSetVerticalAlign(preciovida, "center") precioarmadura = guiCreateLabel(106, 53, 37, 21, "$400", false, ventana) guiLabelSetHorizontalAlign(precioarmadura, "center", false) guiLabelSetVerticalAlign(precioarmadura, "center") preciominigun = guiCreateLabel(297, 25, 47, 21, "$50.000", false, ventana) guiLabelSetVerticalAlign(preciominigun, "center") preciobazooka = guiCreateLabel(297, 56, 47, 18, "$50.000", false, ventana) guiLabelSetHorizontalAlign(preciobazooka, "center", false) guiLabelSetVerticalAlign(preciobazooka, "center") botonhunter = guiCreateButton(9, 237, 97, 21, "Hunter", false, ventana) botonhydra = guiCreateButton(9, 268, 97, 21, "Hydra", false, ventana) preciohunter = guiCreateLabel(106, 237, 56, 21, "$100.000", false, ventana) guiLabelSetVerticalAlign(preciohunter, "center") preciohydra = guiCreateLabel(106, 268, 56, 21, "$100.000", false, ventana) guiLabelSetVerticalAlign(preciohydra, "center") preciorhino = guiCreateLabel(292, 268, 57, 21, "$100.000", false, ventana) guiLabelSetVerticalAlign(preciorhino, "center") precioseas = guiCreateLabel(287, 240, 62, 18, "$100.000", false, ventana) guiLabelSetHorizontalAlign(precioseas, "center", false) guiLabelSetVerticalAlign(precioseas, "center") botonrhino = guiCreateButton(349, 271, 97, 18, "Rhino", false, ventana) botonseas = guiCreateButton(349, 240, 97, 18, "Seasparrow", false, ventana) imagen = guiCreateStaticImage(143, 98, 172, 99, ":Zombies/edf/zombiespawn.png", false, ventana) guiSetAlpha(imagen, 0.43) guiSetVisible(ventana, false) function OpenWin() if (guiGetVisible(ventana) == false) then guiSetVisible(ventana, true) showCursor(true) else guiSetVisible(ventana, false) showCursor(false) end end bindKey("F7", "down", OpenWin)