
myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
41
Everything posted by myonlake
-
Use function named: isVehicleBlown().
-
He is trying to make it client-side, he did not ask any graphics on his chat message and there is no need for that long script to find out is the element a player. And you just copied it (https://wiki.multitheftauto.com/wiki/OnMarkerHit). Man, please, I know you want to help, but copying straight from the wiki isn't a way to help - tho', it depends on script. EDIT: It seems like I misunderstood your problem, H!itman. Yes, it's a Multi Theft Auto bug in my opinion, I've got a self-made toll script and it's annoying, always when you go fly over it like in 100 meters, it does the same.
-
Hello again, What seems to be the problem? It just doesn't show anything or respawn anything. local rElement = getRootElement() function respawnVehicles(player, cmd, seconds) local vehicles = getElementsByType("vehicle") if seconds then if hasObjectPermissionTo(player, "function.banPlayer") then for k, vehicle in ipairs(vehicles) do if getVehicleOccupants(vehicle) == 0 then outputChatBox("** All unoccupied vehicles will be respawned in " .. seconds .. " seconds **", rElement, 220, 220, 0, false) setTimer(function() respawnVehicle(rElement) outputChatBox("** All unoccupied vehicles respawned **", rElement, 220, 220, 0, false) outputDebugString(getPlayerName(player) .. " respawned vehicles.") end, seconds * 1000, 1) end end else outputChatBox("This command is only executeable for administrators", player, 255, 0, 0, false) end else outputChatBox("Syntax: /respawn ", player, 220, 220, 0, false) end end addCommandHandler("respawn", respawnVehicles)
-
Edited. Are you sure you're doing this all on client-side? Because this is a client-side script, otherwise you should use onMarkerHit instead of onClientMarkerHit.
-
Hello, I am asking that if I use this function, math.random, and make it like this, for an example: local id = math.random(0,1000) setElementData(player, "example", id) setElementData(vehicle, "example", id) Does it put them both the same ID or just different?
-
You forgot the name. You had getRootElement(), it also seems that you had some weird invincible character there. local marker = createMarker(-1657, 1214, 8, "cylinder", 1, 255, 0, 0, 255) function onMarkerHit(hitPlayer, matchingDimension) if hitPlayer then outputChatBox("hit") end end addEventHandler("onClientMarkerHit", marker, onMarkerHit) Tested.
-
function createDeathPickup(totalammo, killer, killerweapon, bodypart) local x, y, z = getElementPosition(source) health = createPickup(x, y, z, 0, 40) end addEventHandler("onPlayerWasted", getRootElement(), createDeathPickup) function givePlayerHealth(player) if getPickupType(source) == 0 then local amount = getPickupAmount(source) setElementHealth(player, tonumber(getElementHealth(player)) + tonumber(getPickupAmount(source))) destroyElement(source) outputChatBox("You picked up " .. amount .. " health", player) end end addEventHandler("onPickupHit", health, givePlayerHealth)
-
Did you add the file at meta.xml
-
Well it was a chaos. I decided to clean it up a bit. Make sure you got that "col" colshape there and that you're an admin, otherwise it's not going to work. I'd like to see the whole script but as you gave us this little, I can't help you much in case if an unknown error happens. function open(hitPlayer, matchingDimension) local acc = getAccountName(getPlayerAccount(hitPlayer)) if hitPlayer then if isObjectInACLGroup("user." .. acc, aclGetGroup("Admin")) then moveObject(lift, 2500, -1851, -3112.1000976563, 38.900001525879) end end end addEventHandler("onColShapeHit", col, open) function close(player) local acc = getAccountName(getPlayerAccount(hitPlayer)) if getElementType(player) == "player" then if isObjectInACLGroup("user." .. acc, aclGetGroup("Admin")) then moveObject (lift, 2500, -1851, -3112.1000976563, 51.700000762939) end end end addEventHandler("onColShapeLeave", col, close) function binding() bindKey(source, ",", "down", open) bindKey(source, "/", "down", close) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), binding)
-
If you want the GUI to pop up everytime they log in. Then this. Functions guiSetVisible -- Show the GUI on login showCursor -- Show their cursor on login setElementModel -- Set their model Events onClientGUIClick -- When they press "Select" GUI button, set their model onPlayerLogin -- When player logins/registers If you want the GUI to pop up only once in their gameplay time; when they register. Then this. Functions setElementModel -- Set their model getAccountData -- If they have a certain data in their account, then set their model setAccountData -- If they don't have a certain data in their account, then set it and set their model Events onPlayerLogin -- When player logins/registers I hope this helps you a bit; I've done this same script by myself some very long time ago, but this is one of the ways how you can make it. You don't need any mySQL or XML databases for this. Just the script and your server,
-
Yes. You can use a mySQL one or then you can use a XML one (with a password hash on).
-
@ Weapon model replace: It's not possible yet, but the function is coming in the next versions of Multi Theft Auto - I am waiting for it aswell.
-
@ Jaysds1: I know he could easily modify your script, but just to remind you, civilian vehicles cannot play the siren sound, so it means you need to attach a playSound3D function for the car. Your script was like another script, nothing from the original one. @ tim260: Remember to add setSoundVolume and setSoundMaxDistance for the sound. Otherwise if you don't have the volume, you can't hear it.
-
Hello Haze, I am not sure, but I would suggest this one. https://wiki.multitheftauto.com/wiki/DxDrawText And you might not need that, you can just change the player's name.
-
Why do you need an example for this? What are you trying to do?
-
Cool, just found out my god damn XML file had wrong type on the server thing. It had client, no shit it didn't work - thanks anyways
-
Hello, It seems that this code gives me an error: "Client triggered serverside event onCommand, but event is not added serverside" Client-side function onTrigger(cmd) triggerServerEvent("onCommand", getLocalPlayer()) end addCommandHandler("cmds", onTrigger) function onTrigger1() guiSetVisible(window2, true) showCursor(true) end addEvent("onTriggerCommand1", true) addEventHandler("onTriggerCommand1", getRootElement(), onTrigger1) function onTrigger2() guiSetVisible(window, true) showCursor(true) end addEvent("onTriggerCommand2", true) addEventHandler("onTriggerCommand2", getRootElement(), onTrigger2) Server-side function commandHandler(player) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then triggerClientEvent("onTriggerCommand1", player) end if isObjectInACLGroup("user." .. account, aclGetGroup("MemberExtra")) then triggerClientEvent("onTriggerCommand2", player) end end addEvent("onCommand", true) addEventHandler("onCommand", getRootElement(), commandHandler) I haven't put the GUI on the code because it's not necessarry.
-
Function name and eventHandler is the same name, including the if (killer and killer ~= source)..
-
Oh, you made it, dev? viewtopic.php?f=91&t=36839
-
Changes - createExpliosion => createExplosion - by..getPlayerName..(killer)") => by " .. getPlayerName(killer) - fixed some of your typos and little things (couldn't leave them like that heh) function onKill(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local x, y, z = getElementPosition(source) createExplosion (x, y, z, 10) outputChatBox("You have been exploded by " .. getPlayerName(killer), getRootElement(), 255, 255, 0, true) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) I like that you are copying my code base (my latest thread), good way of learning yeah...
-
Nevermind, I just solved it But yeah, same thing as what you did
-
Hello again, Now I've got this problem that my debug says that it has bad argument. txd = engineLoadTXD("shield.txd") engineImportTXD(txd, 1631) dff = engineLoadDFF("shield.dff", 0) engineReplaceModel(dff, 1631) col = engineLoadCOL("shield.col") engineReplaceCOL(col, 1631) Not sure, but do I need to put the files in the meta.xml aswell? Just thinking, because imo these are just fine.