Jump to content

Agon

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by Agon

  1. Thank you but I can't get my powers btw no errors are shown
  2. Here is the current code function createEverything(source) local nukeMarker = createMarker(-345.10000610352, 1612.8000488281, 74.599998474121, "cylinder", 2, 255, 0, 0, 170) local boltMarker = createMarker(-2368, 1550.8000488281, 1.1000000238419, "cylinder", 2, 255, 255, 0, 170) local invisibleMarker = createMarker(585.09997558594, 870.20001220703, -43.5, "cylinder", 2, 255, 255, 255, 170) local speed = getGameSpeed() end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createEverything) function bindTheKeys(source, commandName) bindKey ( source, "R", "down", togglePowers ) end addEventHandler( "onPlayerLogin", getRootElement(), bindTheKeys ) function makeMePowerless() setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) end addEventHandler("onPlayerLogin", getRootElement(), makeMePowerless) function nukeMarkerHit(source, matchingDimension) if (myNukePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 1) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Nuke Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, nukeMarkerHit) function BoltMarkerHit(source, matchingDimension) if (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 1) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Bolt Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, BoltMarkerHit) function invisibleMarkerHit(source, matchingDimension) if (myInvisiblePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 1) outputChatBox("Invisible Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, invisibleMarkerHit) function togglePowers(source) local powerAccount = getPlayerAccount(source) local myNukePower = getAccountData(powerAccount, "player.nuke") local myBoltPower = getAccountData(powerAccount, "player.bolt") local myInvisiblePower = getAccountData(powerAccount, "player.invisible") if (myBoltPower == 1) and (speed == 1) then setGameSpeed(3) else setGameSpeed(1) end if (myNukePower == 1) then local blowMarker = createMarker(0, 0, 0, "corona", 1, 255, 255, 0, 255) attachElements(blowMarker, source, 0, 0, 0, 0, 0, 0) function setTheAnim(source) setPedAnimation(source, "BOMBER", "BOM_Plant_Loop", 1000, false, false, false, true) x, y, z = getElementPosition(source) createExplosion(x+x, y-y, z, 10) end setTimer(setTheAnim, 2000, 1) end if (myInvisiblePower == 1) and isPlayerNametagShowing(source) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) else setPlayerNametagShowing(source, true) setElementAlpha(source, 255) end end and current errors: WARNING: powers\power.lua:33: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] WARNING: powers\power.lua:47: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] WARNING: powers\power.lua:61: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] and i couldn't get my powers doesnt "local" mean i can use it anyline in the script?
  3. oh fixed line 13 and made this but getting errors again function createEverything(source) local nukeMarker = createMarker(-345.10000610352, 1612.8000488281, 74.599998474121, "cylinder", 2, 255, 0, 0, 170) local boltMarker = createMarker(-2368, 1550.8000488281, 1.1000000238419, "cylinder", 2, 255, 255, 0, 170) local invisibleMarker = createMarker(585.09997558594, 870.20001220703, -43.5, "cylinder", 2, 255, 255, 255, 170) local powerAccount = getPlayerAccount(source) local myNukePower = getAccountData(powerAccount, "player.nuke") local myBoltPower = getAccountData(powerAccount, "player.bolt") local myInvisiblePower = getAccountData(powerAccount, "player.invisible") local speed = getGameSpeed() end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createEverything) ERRORS: WARNING: powers\power.lua:37: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] WARNING: powers\power.lua:51: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] WARNING: powers\power.lua:65: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] WARNING: powers\power.lua:5: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data] WARNING: powers\power.lua:6: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: powers\power.lua:7: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: powers\power.lua:8: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] powers restarted successfully
  4. I made this and hope you understand what i'm trying to make. local nukeMarker = createMarker(-345.10000610352, 1612.8000488281, 74.599998474121, "cylinder", 2, 255, 0, 0, 170) local boltMarker = createMarker(-2368, 1550.8000488281, 1.1000000238419, "cylinder", 2, 255, 255, 0, 170) local invisibleMarker = createMarker(585.09997558594, 870.20001220703, -43.5, "cylinder", 2, 255, 255, 255, 170) local powerAccount = getPlayerAccount(source) local myNukePower = getAccountData(powerAccount, "player.nuke") local myBoltPower = getAccountData(powerAccount, "player.bolt") local myInvisiblePower = getAccountData(powerAccount, "player.invisible") local speed = getGameSpeed() function bindTheKeys(source, commandName) bindKey ( source, "R", "down", togglePowers ) end addEventHandler( "onPlayerLogin", getRootElements(), bindTheKeys ) function makeMePowerless() setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) end addEventHandler("onPlayerLogin", getRootElement(), makeMePowerless) function nukeMarkerHit(source, matchingDimension) if (myNukePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 1) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Nuke Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, nukeMarkerHit) function BoltMarkerHit(source, matchingDimension) if (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then if (myInvisiblePower == 1) or (myInvisiblePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 1) setAccountData(powerAccount, "player.invisible", 0) outputChatBox("Bolt Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, BoltMarkerHit) function invisibleMarkerHit(source, matchingDimension) if (myInvisiblePower == 0) then if (myBoltPower == 1) or (myBoltPower == 0) then if (myNukePower == 1) or (myNukePower == 0) then setAccountData(powerAccount, "player.nuke", 0) setAccountData(powerAccount, "player.bolt", 0) setAccountData(powerAccount, "player.invisible", 1) outputChatBox("Invisible Marker", source, 0, 255, 0) end end end end addEventHandler("onMarkerHit", nukeMarker, invisibleMarkerHit) function togglePowers(source) if (myBoltPower == 1) and (speed == 1) then setGameSpeed(3) else setGameSpeed(1) end if (myNukePower == 1) then local blowMarker = createMarker(0, 0, 0, "corona", 1, 255, 255, 0, 255) attachElements(blowMarker, source, 0, 0, 0, 0, 0, 0) function setTheAnim(source) setPedAnimation(source, "BOMBER", "BOM_Plant_Loop", 1000, false, false, false, true) x, y, z = getElementPosition(source) createExplosion(x+x, y-y, z, 10) end setTimer(setTheAnim, 2000, 1) end if (myInvisiblePower == 1) and isPlayerNametagShowing(source) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) else setPlayerNametagShowing(source, true) setElementAlpha(source, 255) end end Everything is fine. Markers are spawned but when i start the script it says: Starting powers WARNING: powers\power.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] WARNING: powers\power.lua:5: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: powers\power.lua:6: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: powers\power.lua:7: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] ERROR: powers\power.lua:13: attempt to call global 'getRootElements' (a nil value) powers restarted successfully and it doesnt output the messages. Can you help me?
  5. now it says invalid vehicle id even i try that ids in the table
  6. Agon

    script gate

    1) try posting your code here 2) try using /debugscript 3 3) post the error. So scripters can help you..
  7. uhm.. like this? vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } function isModelInTable ( theModel ) local found = false for _, model in ipairs ( vehicleIDS ) do if ( model == theModel ) then found = true break end end return found end function fGiveVehicle(source, command, id) if isModelInTable(id) then if not isPedInVehicle(source) then x, y, z = getElementPosition(source) xr, yr, zr = getElementRotation(source) veh = createVehicle(id, x, y, z, xr, yr, zr) warpPedIntoVehicle(source, veh) else ocVeh = getPedOccupiedVehicle(source) setElementModel(ocVeh, id) else outputChatBox("Invalid vehicle id", 255, 0, 0) end end end addCommandHandler("vehicle", fGiveVehicle) it says loading script failed: veh\vehicle.lua:32: 'end' expected (to close 'if' at line 25) near 'else'
  8. I want to check if the written id is in vehicleIDS table. By the way how can i fix the script? It doesn't work...
  9. Agon

    script gate

    did you create the gate on map editor?
  10. but i used clientside codes i think edit: tried serverside but didn't work
  11. vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } function fGiveVehicle(player, command, id) if id == vehicleIDS then if not isPedInVehicle(player) then local x, y, z = getElementPosition(player) local xr, yr, zr = getElementRotation(player) local veh = createVehicle(id, x, y, z, xr, yr, zr) warpPedIntoVehicle(player, veh) else local ocVeh = getPedOccupiedVehicle(player) setElementModel(ocVeh, id) else outputChatBox("Invalid vehicle id", 255, 0, 0) end end end addCommandHandler("vehicle", fGiveVehicle) i did this script but i think i screwed up because it doesn't work. This is meta.xml <meta> <script src="vehicle.lua" type="client" /> </meta> I also want to use both vehicle ids and names. i thought of using getVehicleIDFromName and getVehicleNameFromID but couldn't make waiting for your helps
  12. Agon

    World Objects

    Is it because you didn't make a gui window?
  13. This? onClientVehicleStartExit --- and cancel the event
  14. Agon

    [help] xmlSaveFile

    Use guiSetInputMode this will disable binds while typing in memo
  15. Maybe this? addEventHandler("onPlayerWasted", root, function(source, killer) if killer and getElementType(killer) =="player" then if getPedOccupiedVehicle(killer) == "theIdOfHunter" then -- put the id of hunter sorry i dont remember that. outputChatBox(getPlayerName(killer).." has killed you.", source, 255, 100, 100, true) end end end)
  16. Agon

    Question

    Maybe this? function slapHim (attacker, weapon, victim) if ( weapon == 38 ) then -- 38 is minigun sorry i dont remember molotove if getElementType(victim) == "player" then setElementHealth(attacker, getElementHealth(attacker) - 20) end end end addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), slapHim)
  17. Agon

    Question

    Well if you want to kill a player, why do you want to set its health? Just kill him..
  18. But maybe he can use onClientPlayerTarget setPedAnimation and he can check if the weapon is desert eagle? EDIT: what's wrong with [ lua ][ /lua ] codes?
  19. Agon

    function

    Oh thanks Kenix i think i got it
  20. Agon

    function

    Oh second one will help me thank you so much
  21. Agon

    function

    Hi i made this but how can i use it? (and is this code true? I cannot test it i've written this on my mobile phone) function whoAreYou(thePlayer) local accName=getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." ..accName, aclGetGroup("Admin")) then isPlayerAdmin == "true" else isPlayerAdmin == "false" end end can i use it like this? function justTest(thePlayer) if isPlayerAdmin then outputChatBox("TRUE", thePlayer, 0, 255, 0) else outputChatBox("FALSE", thePlayer, 255, 0, 0) end end addCommandHandler("amiadmin", justTest) btw what is the difference between "thePlayer" and "source" ?
  22. No you didn't get it. Freeroam has it's own chat script. And you put another chat script. So it outputs 2 messages. Just delete chat lines in freeroam as kenix said..
×
×
  • Create New...