Jump to content

ViRuZGamiing

Members
  • Posts

    1,050
  • Joined

  • Last visited

Everything posted by ViRuZGamiing

  1. How would I then call it from funcName? EDIT: Because all I see is the same code as I had but then with a table being used.
  2. setTimer(function () vehicles = getElementsByType ("vehicle") for key,vehicle in ipairs(vehicles) do if not (getElementData(vehicle, "marker")) then local x, y, z = getElementPosition(vehicle) vehMarker = createMarker(x, y, z, "cylinder", 2.0, 255, 0, 0, 255) attachElements(vehMarker, vehicle, 0, -3, -1) setElementData(vehicle, "marker", vehMarker) addEventHandler("onMarkerHit", vehMarker, function(hitElement) if (getElementType(hitElement) == "player") then toggleControl(hitElement, "enter_exit", false) bindKey(hitElement, "f", "down", funcName) end end) addEventHandler("onMarkerLeave", vehMarker, function(hitElement) if (getElementType(hitElement) == "player") then toggleControl(hitElement, "enter_exit", true) unbindKey(hitElement, "f", "down", funcName) end end) end end end, 6000, 0) Here's the code, Vehicle which the marker is attached to should be accessible from function 'funcName'
  3. XML is the easy way, just try it ok, btw, you know how to find how many charters there is on string? This should work string.len(stringhere)
  4. vehMarker = createMarker(x, y, z, "cylinder", 2.0, 255, 0, 0, 255) attachElements(vehMarker, vehicle, 0, -3, -1) I use this to attach a marker to every vehicle (vehicle is the result from looping through all vehicle elements) I want to call the vehicle my marker is attached to so I tried using getElementAttachedTo but It didn't work. Is there any other way of calling the vehicle.
  5. Yeah indeed you can't, wouldn't do that anyway
  6. Don't know if it'll fix it but Setpedfrozen has to be setElementFrozen
  7. I think I'll go with a marker then instead.
  8. Don't know if it'll work but try this; function onTaserSoundPlay(attacker) if (taserSound[client]) then cancelEvent() else taserSound[client] = playSound("taser/Fire.wav",true) if taserSound[client] and isElement(taserSound[client]) then setSoundVolume(taserSound[client], 1.0) end end end
  9. Show us what you tried
  10. By a resource called 'bone_attach' if I'm right
  11. Hi I'm trying to create a colshape to all existing vehicles but it seems to not be there. no errors, showcol and development mode are active. first time using attachElements. vehicles = getElementsByType ("vehicle") for key,vehicle in ipairs(vehicles) do local x, y, z = getElementPosition(vehicle) vehCol = createColRectangle(x, y, 5, 5) attachElements(vehCol, vehicle) end regards billy
  12. So it'll be; local objects = getElementsByType("object") for i,object in ipairs(objects) do if (getElementModel(object) == 8558) then setElementCollisionsEnabled(object, false) end end
  13. You should give the element not the ID setElementCollisionsEnabled (getElementByID(8558), false)
  14. function sendDuelInvite (player, opponent) addCommandHandler("acceptduel", function(source) if (source == opponent) then outputChatBox(getPlayerName(source).." accepted your duel!", player, 255, 165, 0) -- Duel stuff here end end end addCommandHandler("duel", function(source, cmd, arg) if (arg) then local player = getPlayerFromName(arg) if (player) then outputChatBox(getPlayerName(source).." has send you a duel invite! Write /acceptduel to accept it!", player, 255, 165, 0) sendDuelInvite(source, player) end end end) I think this would work (Server sided)
  15. Just use this one, timer is included so no need for that other timer.
  16. addEventHandler("onClientGUIChanged", gridlistSearchbar, function(theElement) local rowsToRemove = {} local counter = 0 local searchFor = guiGetText(theElement) local rows = guiGridListGetRowCount(gridlist) for i=1, rows do rowText = guiGridListGetItemText(gridlist, i, 1) if not (string.match(rowText, searchFor) then rowsToRemove[counter] = i counter = counter + 1 end end for i,v in rowsToRemove do guiGridListRemoveRow(gridlist, v) for i, v in rowsToRemove do rowsToRemove[i] = rowsToRemove[i] - 1 end end end) I'm by far not sure if this will work but this is the way I'd try to do it. I'm not that good in advanced LUA tho.
  17. The best way to do it is just use cancelEvent anyhow.
  18. Yeah I know that too, I was just wondering if it was also possible to overwrite the 'source' variable, but I understand that it is appearantly possible.
  19. I did that, but If I canceled the event, the cop can't even tase wanted, and I need to cancel the fire only if the timer is still running. Any idea? If you only cancel the damage for the player client sided, the player can still shoot the tazer. If you do want the player to get damage when the tazer is attached to his body and destroys every little living thing inside of him. You can always set the health of the player with setElementHealth. Remember, you should cancel the onClientPlayerDamage. What he is trying is to stop a player from shooting the taser but still be able to shoot other weapons WITHOUT the use of cancelEvent or toggleControl. I'd honestly do it with a cancelEvent if I was making it.
  20. I'm wondering in his case, he assigned the name 'source' to the first parameter, which is thePlayer. Would source then be overwriten and source actually be thePlayer instead of the vehicle? Overwritting the actual vehicle to get the vehicle after that again? I'm sorry but that's just plain stupid and resource intensive. @1LoL1; "vehicle" isn't defined because the source of the actual function is the vehicle. That's not what I said, I asked if it was possible to overwrite the default given 'source'. Because what he in the first place did was overwriting source with thePlayer (if that is indeed possible) I know that double overwriting would be dumb.
  21. How about unbinding the control key "fire" for a duration instead of toggling?
  22. Try this way maybe local shotAlready = false addEventHandler("onClientPlayerWeaponFire", getRootElement(), function() if shotAlready then cancelEvent() else shotAlready = true setTimer( function() shotAlready = false end, 5000, 1) end)
  23. I'm wondering in his case, he assigned the name 'source' to the first parameter, which is thePlayer. Would source then be overwriten and source actually be thePlayer instead of the vehicle?
  24. It does work some sort of way, if you go to mrgrand.ga2h.com and then click mailer.php Change: callRemote("http://mrgrand.ga2h.com/emailer.php", returns, subject, header, sendto, mail) To: callRemote("http://mrgrand.ga2h.com/mailer.php", returns, subject, header, sendto, mail) The webpage is called mailer.php not emailer.php
×
×
  • Create New...