Jump to content

AJXB

Members
  • Posts

    370
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by AJXB

  1. I already gave you the code, read above please, and understand the code.
  2. That function clearly triggers addEventHandler("onPedWasted", resourceRoot, deanimated) onPedWasted, the Wasted part means the ped is dead, thus, it triggers when the Zombie is dead. You should make a different event/function onPedDamage
  3. And are we code whisperers to just "know"? Does it give an error? no? yes? if yes, which line? if no, then the only obvious reason I can see is that getElementData(veh, "veh:owner") is 0
  4. AJXB

    mute problem

    Many ways to do that, but you can just go on the wiki and look for an ACL function that checks that. I can tell you what function that is but you should spend some time
  5. You can just make a function rather than making an event since they're both on the server side. function onZombieWasted (attacker) if (isElement( attacker )) then givePlayerMoney(attacker,math.random(75,150)) -- default 50$ end end function deanimated( ammo, attacker, weapon, bodypart ) if (attacker) then if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then if (getElementData (source, "zombie") == true) then local oldZcount = getElementData ( attacker, "Zombie kills" ) if oldZcount ~= false then setElementData ( attacker, "Zombie kills", oldZcount+1 ) else setElementData ( attacker, "Zombie kills", 1 ) end onZombieWasted ( attacker ) end end end end addEventHandler("onPedWasted", resourceRoot, deanimated) You might wanna add a check to the weapon used, to avoid abuse
  6. AJXB

    hello

    You can find it at community.multitheftauto.com
  7. AJXB

    Xml

    You should set an xmlFile variable
  8. AJXB

    mute problem

    Line 4 is checking for data related to the player, It's there because the script is taken from another game mode, or considered connected to other scripts. Replace line 4 with this line and post any errors you have if (isElement( thePlayer )) then Next time, please write your own code
  9. How about you show us how are you triggering that event?
  10. createMarker() math.random() createVehicle() warpPedIntoVehicle() -- You can find examples on community.multitheftauto.com
  11. AJXB

    mute problem

    Did you verify all that getElementData() you're doing on line 4 ?
  12. It's even more useless than a forum, it's just a theme And how much are you thinking this is worth?
  13. Off-topic: Activate Windows On-topic: You might wanna elaborate, at least tell us what forum software that is.
  14. AJXB

    help me

    English, please
  15. the pistol fires 1 projectile (bullet) and the sawed-off fires many? Not sure, but it will depend on where are you shooting the ped too. maybe someone else can be more of a help
  16. Try to fetchRemote another type of file, maybe a .lua, what does it return?
  17. outputConsole(responseData) What does this return in your console?
  18. in your "myCallback" function, try to output "responseData ", what is it? I'm sorry, I might not be much of a help
  19. He did, that's how he found the errors above. I think he removed `addCommandHandler` and changed the player instance
  20. Post your full code if it's different in any way than the code above.
  21. First of all, you need to put a plan on how the script works. then go on the Wiki and plan the functions you will use. Then start making the code using Wiki & the community.
  22. Try this: -- Server Side damageTimers = {} function handlePlayerDamage ( attacker, weapon, bodypart, loss ) if (attacker) then -- Check if an attacker exists, you might wanna add a check to see if it's a valid player, also check the attacked player (source) if isTimer(damageTimers[source]) then -- Check if there is already a timer to reset the state of that player, happens when the player is damaged again before the 20 seconds are over killTimer(damageTimers[source]) -- Kill the old timer and continue to make a new one end setElementData(source,'damaged',true) -- Mark the player as damaged within the last 20 seconds damageTimers[source] = setTimer( -- Make a timer, we used a table damageTimers[] function() setElementData(source,'damaged',false) -- Mark the player as not damaged within the last 20 seconds AFTER the timer expires (20 seconds) end, 20*1000, 0 ) end end addEventHandler ( "onPlayerDamage", getRootElement (), handlePlayerDamage ) -- addEventHandler to all players
  23. Try this: -- Client window1 = guiCreateWindow(455, 178, 710, 532, "", false) editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1) editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1) btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1) btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1) guiSetVisible(window1, true) showCursor(true) guiWindowSetSizable(window1, false) function closeGui() if btnClose == source then guiSetVisible(window1, false) showCursor(false) end end addEventHandler("onClientGUIClick", root, closeGui) -- changed "root" function logToServer() if (source == btnLogin) then -- Check button clicked local account = guiGetText(editUsername) local password = guiGetText(editPassword) local name = getPlayerName(getLocalPlayer()) triggerServerEvent("test", localPlayer, account, password, name) end end addEventHandler("onClientGUIClick", root, logToServer) -- changed "root" -- Server function myMoney(account, password, name) outputChatBox(name); logIn (source, account, password) end addEvent("test", true) addEventHandler("test", root, myMoney)
  24. Yep, and I still stand by word. the GUI sometimes calculates the actual button element a bit larger than the actual displayed unit, or since it's attached to the GUI window, it sometimes confuses that as well. So that means when you click outside of a button, it triggers the button. Feel free to use any method you like, but what I use to avoid any type of issue is the first solution.
×
×
  • Create New...