
myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
41
Everything posted by myonlake
-
Wouldn't be enough for me.
-
Not giving you any other code, but this is the one fixed. As SDK said, check out the Wiki's stopSound client function. local streamURL = "http://www.true.nl/streams/slamfmlivestream.pls" local radius = 150 local volume = 1.0 function radio3d() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D(streamURL, x, y, z, true) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end addCommandHandler("staffradio", radio3d)
-
Code had no sense, what a MESS. I have no idea what did you want to do with it but created something with it. Command: /check local crate = createObject(2991, -1353, -185, 14) function start(player) local team = getPlayerTeam(player) if team then local police = getTeamFromName("Police") local criminals = getTeamFromName("Criminals") if (team == police) then outputChatBox("You're a police officer.", source, 0, 255, 0, false) elseif (team == criminal) then outputChatBox("You're a criminal.", source, 0, 255, 0, false) end end end addCommandHandler("check", function(player, cmd) setTimer(start, 1000, 1, player) end)
-
Cool, well, my server works just fine with string port.
-
Check out the editor resource, it should have function for that because you rotate elements with that scrolling.
-
FatalTerror, it has an error. 20002 must be in a string mode. local ip = "178.33.90.184" local port = "20002" local root = getRootElement() addEventHandler("onPlayerJoin", root, function() redirectPlayer(source, ip, port) end)
-
Check it out. function wafflecheese(player) if player then outputChatBox("Value found.", player, 0, 255, 0, false) else outputChatBox("Value not found.", player, 255, 0, 0, false) end end addCommandHandler("execute", function(player, cmd) setTimer(wafflecheese, 1000, 1, player) end)
-
local radius = 150 local volume = 1.0 local posX, posY, posZ = 251.5, -1890.8000488281, 3.7000000476837 local radioURL = "http://www.true.nl/streams/slamfmlivestream.asx" local colShape = createColSphere(posX, posY, posZ, radius) local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onClientResourceStop", thisRoot, function() destroyElement(colShape) end) addEventHandler("onColShapeLeave", root, function(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then outputChatBox("#FFFF00RADIO: #FFFFFFStream stopped.", 255, 255, 255, true) end end)
-
Are you sure the timer is created -after- the function?
-
I am using 1.2 aswell because you should always update when there's a chance. 1.1.1 or 1.2, doesn't make a lot of a difference.
-
Script started? Are you sure you tested my script on server side? I tested it on server side and worked just fine, I have modified the script many times so try again.
-
What would be a correct script for a teleporting system
myonlake replied to stormchaser206's topic in Scripting
Why people always give up. https://wiki.multitheftauto.com/wiki/Scr ... troduction <meta> <script src="server.lua" type="server"></script> </meta> -
meta.xml and are you sure you've set that to the server-side? No debug errors?
-
Could you just copy the code again, please. It works just fine as I tested it.
-
What a mess. Commands are case sensitive. If you wrote /me, it doesn't output anything because it should be /Me. Now I changed it to /me. Your colShape was destroyed after it was created, that has no sense. '...' is not pretty simple thing, read what I did there. Tested and working 100%. addEventHandler('onPlayerChat', getRootElement(), function(message, messageType) if (messageType == 1) then cancelEvent() meCommand(source, 'me', message) end end) function meCommand(player, cmd, ...) local wrds = {...} local msg = table.concat(wrds, " ") if msg then local posX, posY, posZ = getElementPosition(player) local chatSphere = createColSphere(posX, posY, posZ, 20) local nearbyPlayers = getElementsWithinColShape(chatSphere, 'player') for i,v in ipairs(nearbyPlayers) do outputChatBox('* ' .. getPlayerName(player) .. ' ' .. msg, v, 194, 162, 218) end destroyElement(chatSphere) else outputChatBox('NAUDOJIMAS: /me [tekstas]', player, 255, 255, 255) end end addCommandHandler('me', meCommand)
-
Like Xeno said... local cooldown = 300 local dataname = "health.cooldown" local commandname = "ulecz" local note_restored = "Health restored successfully." local note_info = "You need to wait 5 minutes before you can do this again." local note_active = "Cooldown is still active, please wait." function giveFullHealth(player, cmd) local timer = getElementData(player, dataname) if not timer then outputChatBox(note_restored, player, 0, 255, 0, false) outputChatBox(note_info, player, 220, 220, 0, false) setElementData(player, dataname, true) setTimer(setElementHealth, 10000, 1, player, 100) setTimer(removeElementData, cooldown * 1000, 1, player, dataname) else outputChatBox(note_active, player, 255, 0, 0, false) end end addCommandHandler(commandname, giveFullHealth)
-
Why do you need a timer to heal? That heals when you do the command.
-
1) Nobody is going to give you a code for that, unless it's in the community. 2) Why did you delete stuff from my script? They're needed to make the script work. local cooldown = 300 local dataname = "health.cooldown" local commandname = "ulecz" local note_restored = "Health restored successfully." local note_info = "You need to wait 5 minutes before you can do this again." local note_active = "Cooldown is still active, please wait." function giveFullHealth(player, cmd) local timer = getElementData(player, dataname) if not timer then outputChatBox(note_restored, player, 0, 255, 0, false) outputChatBox(note_info, player, 220, 220, 0, false) setElementData(player, dataname, true) setElementHealth(player, 100) setTimer(removeElementData, cooldown * 1000, 1, player, dataname) else outputChatBox(note_active, player, 255, 0, 0, false) end end addCommandHandler(commandname, giveFullHealth) 3) thePlayer is not a source element for onPlayerJoin event. function nametagColorChange() local account = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then setPlayerNametagColor(source, 250, 0, 0) end end addEventHandler("onPlayerLogin", getRootElement(), nametagColorChange)
-
Whops I'll fix it right away.
-
getPedRotation setPedRotation setTimer
-
I would of liked more kinda explaining in not LUA -tags. I meant that you should of explained everything in the thread, not in the script itself. However you decided to do it your way and it was fine
-
Liked it though someone should make a MySQL tutorial. I know MySQL already, but it would be nice if others would find it interesting aswell as SQLite.
-
Nice but not a lot of an organized script hehe.