-
Posts
525 -
Joined
-
Last visited
-
Days Won
3
Everything posted by justn
-
You're welcome.
-
Should work with all resolutions now function speedoCreate() if isPedInVehicle (localPlayer) == false then return end sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) local kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) local x, y, z = getElementPosition(localPlayer) local sH, sW = guiGetScreenSize() vehicle = getVehicleName (getPedOccupiedVehicle(localPlayer)) health = getElementHealth (getPedOccupiedVehicle(localPlayer)) currenthealth = math.floor(health/10) dxDrawText("Speed: "..tostring(kmhs).."km/h", sH*1701/1920, sW*956/1080, sH*1924/1920, sW*977/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Health: "..tostring(currenthealth).."%", sH*1701/1920, sW*987/1080, sH*1924/1920, sW*1008/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawRectangle(sH*1700/1920, sW*924/1080, sH*191/1920, sW*95/1080, tocolor(0, 0, 0, 255), false) dxDrawRectangle(sH*1701/1920, sW*925/1080, sH*189/1920, sW*93/1080, tocolor(27, 27, 27, 254), false) dxDrawText(""..tostring(vehicle).."", sH*1701/1920, sW*925/1080, sH*1855/1920, sW*956/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender",getRootElement(),speedoCreate) function show ( player ) if ( player == localPlayer ) then addEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleEnter", getRootElement(), show) function hide ( player ) if ( player == localPlayer ) then removeEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleExit", getRootElement(), hide)
-
Try that doBusow = guiCreateGridList(425, 313, 400, 209, false) guiGridListAddColumn(doBusow, "Tra", 0.2) guiGridListAddColumn(doBusow, "Wy", 0.2) guiGridListAddColumn(doBusow, "lop", 0.2) guiGridListAddColumn(doBusow, "Do", 0.2) guiGridListAddColumn(doBusow, "Od", 0.2) for i = 1, 2 do local row = guiGridListAddRow(doBusow) end guiGridListSetItemText(doBusow, row, 1, "1889", false, false) guiGridListSetItemText(doBusow, row, 2, "1k 1sc", false, false) guiGridListSetItemText(doBusow, row, 3, "LV", false, false) guiGridListSetItemText(doBusow, row, 4, "LS", false, false) guiGridListSetItemText(doBusow, row, 5, "0", false, false) guiSetVisible (doBusow, false) addEventHandler("onClientGUIClick",doBusow, function(b) if b == "left" then local selected = guiGridListGetItemText(doBusow, guiGridListGetSelectedItem(doBusow), 1) if selected == "1889" then outputChatBox("Hello") end end end)
-
I did that now, when i switch to one radio station, and then switch to another, both radio stations play at the same time. Also, when i exit the car with a radio station playing and i enter again. and i switch the radio station, both songs play at same time. :3
-
2 Problems First: When i was listening to a station and a friend goes in a car and turns to the same station, we both hear the station get doubled. which means it plays two times. Second: The music does not stop when i exit the vehicle Client n = 1 Font = dxCreateFont("font.ttf", 21) local radios = { {"None","None",8}, {"http://www.raggakings.net/listen.m3u","Reggae and Dancehall",7}, {"http://www.hit104.com/listen.pls", "Hit 104",6}, {"http://mp3uplink.duplexfx.com:8054/listen.pls","West Coast Rap",5}, {"http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls","Power 181",4}, {"http://somafm.com/dubstep.pls","Dubstep",3}, {"http://193.34.51.25/listen.pls","rauteMusik.",2}, {"http://212.45.104.34:8042/listen.pls","Defjay",1} } title = "Radio Off" addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) title = streamTitle end) addEventHandler("onClientSoundStream",root,function(suc,length,streamN) title = streamN end) function onPlayerEnterVehicle(vehicle,seat) if ( source == localPlayer ) and isPedInVehicle(localPlayer) then if seat == 0 then setRadioChannel(0) addEventHandler("onClientRender", getRootElement(), RenderClient) bindKey("mouse_wheel_up", "down", PlaySound, "up") bindKey("mouse_wheel_down", "down", PlaySound, "down") bindKey("r", "down", PlaySound, "up") elseif seat == 1 or seat == 2 or seat == 3 or seat == 4 then addEventHandler("onClientRender", getRootElement(), RenderClient) setRadioChannel(0) bindKey("mouse_wheel_up", "down", ClearSounds, "up") bindKey("mouse_wheel_down", "down", ClearSounds, "down") bindKey("r", "down", ClearSounds, "up") end end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle) function stopMySound(vehicle,seat) if ( source == localPlayer ) and not isPedInVehicle(localPlayer) then if seat == 0 or seat == 1 or seat == 2 or seat == 3 or seat == 4 then if sound then triggerServerEvent("pauseSound",localPlayer,sound) sound = nil end removeEventHandler("onClientRender", getRootElement(), RenderClient) unbindKey("mouse_wheel_up", "down", PlaySound) unbindKey("mouse_wheel_down", "down", PlaySound) unbindKey("r", "down", PlaySound) n = 1 end end end addEventHandler("onClientPlayerVehicleExit",getRootElement(),stopMySound) function RenderClient() if isPedInVehicle(localPlayer) then local x,y = guiGetScreenSize() dxDrawText("Song Name: "..title, x*387/1024, y*631/768, x*800/1024, y*646/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) dxDrawText("Radio: "..tostring(radiotitle), x*387/1024, y*616/768, x*760/1024, y*631/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) end end function PlaySound(state) local x,y,z = getElementPosition(getLocalPlayer()) n = tonumber(n) if sound then triggerServerEvent("pauseSound",localPlayer,sound) setRadioChannel(0) end if state == "mouse_wheel_up" then if n < #radios then n = n + 1 setRadioChannel(0) end elseif state == "mouse_wheel_down" then if n > 1 then n = n - 1 setRadioChannel(0) end elseif state == "r" then if n < #radios then n = n + 1 setRadioChannel(0) end end triggerServerEvent("playSound",localPlayer) setRadioChannel(0) end function startSound() local x,y,z = getElementPosition(getLocalPlayer()) sound = playSound3D(radios[n][1],x,y,z) radiotitle = radios[n][2] setRadioChannel(0) end addEvent("startSound",true) addEventHandler("startSound",getRootElement(),startSound) function StopSound(sound) stopSound(sound) end addEvent("StopSound",true) addEventHandler("StopSound",getRootElement(),StopSound) function UpdateSound() if sound then local x,y,z = getElementPosition(getLocalPlayer()) attachElements(sound, localPlayer) --setElementPosition(sound, x,y,z) end end addEventHandler("onClientRender", getRootElement(), UpdateSound) function ClearSounds(state) if state == "mouse_wheel_up" or state == "mouse_wheel_down" or state == "r" then setRadioChannel(0) end end Server addEvent("playSound",true) addEventHandler("playSound",root, function() triggerClientEvent("startSound",root) end) addEvent("pauseSound",true) addEventHandler("pauseSound",root, function(sound) triggerClientEvent("StopSound",root,sound) end)
-
Hi, i have this radio script, but i want the song to play server-sided so that everyone can here it. triggerServerEvent can be found on line 88 Client n = 1 Font = dxCreateFont("font.ttf", 21) local radios = { {"None","None",7}, {"http://www.raggakings.net/listen.m3u","Reggae and Dancehall",6}, {"http://mp3uplink.duplexfx.com:8054/listen.pls","West Coast Rap",5}, {"http://somafm.com/dubstep.pls","Dubstep",4}, {"http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls","Power 181",3}, {"http://193.34.51.25/listen.pls","rauteMusik.",2}, {"http://212.45.104.34:8042/listen.pls","Defjay",1} } title = "Radio Off" addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) title = streamTitle end) addEventHandler("onClientSoundStream",root,function(suc,length,streamN) title = streamN end) function onPlayerEnterVehicle(vehicle,seat) if ( source == localPlayer ) and isPedInVehicle(localPlayer) then if seat == 0 then setRadioChannel(0) addEventHandler("onClientRender", getRootElement(), RenderClient) bindKey("mouse_wheel_up", "down", PlaySound, "up") bindKey("mouse_wheel_down", "down", PlaySound, "down") bindKey("r", "down", PlaySound, "up") elseif seat == 1 or seat == 2 or seat == 3 or seat == 4 then addEventHandler("onClientRender", getRootElement(), RenderClient) setRadioChannel(0) bindKey("mouse_wheel_up", "down", ClearSounds, "up") bindKey("mouse_wheel_down", "down", ClearSounds, "down") bindKey("r", "down", ClearSounds, "up") end end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle) function stopMySound(vehicle,seat) if ( source == localPlayer ) and not isPedInVehicle(localPlayer) then if seat == 0 or seat == 1 or seat == 2 or seat == 3 or seat == 4 then if sound then stopSound( sound ) sound = nil end removeEventHandler("onClientRender", getRootElement(), RenderClient) unbindKey("mouse_wheel_up", "down", PlaySound) unbindKey("mouse_wheel_down", "down", PlaySound) unbindKey("r", "down", PlaySound) n = 1 end end end addEventHandler("onClientPlayerVehicleExit",getRootElement(),stopMySound) function RenderClient() if isPedInVehicle(localPlayer) then local x,y = guiGetScreenSize() dxDrawText("Song Name: "..title, x*387/1024, y*631/768, x*800/1024, y*646/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) dxDrawText("Radio: "..tostring(radiotitle), x*387/1024, y*616/768, x*760/1024, y*631/768, tocolor(255, 255, 255, 255), 0.50, Font, "left", "top", false, false, true, false, false) end end function PlaySound(state) local x,y,z = getElementPosition(getLocalPlayer()) n = tonumber(n) if sound then stopSound(sound) setRadioChannel(0) end if state == "mouse_wheel_up" then if n < #radios then n = n + 1 setRadioChannel(0) end elseif state == "mouse_wheel_down" then if n > 1 then n = n - 1 setRadioChannel(0) end elseif state == "r" then if n < #radios then n = n + 1 setRadioChannel(0) end end triggerServerEvent("playSound",localPlayer, HERE ) --sound = playSound3D(radios[n][1], x,y,z) radiotitle = radios[n][2] setRadioChannel(0) end function UpdateSound() if sound then local x,y,z = getElementPosition(getLocalPlayer()) attachElements(sound, localPlayer) --setElementPosition(sound, x,y,z) end end addEventHandler("onClientRender", getRootElement(), UpdateSound) function ClearSounds(state) if state == "mouse_wheel_up" or state == "mouse_wheel_down" or state == "r" then setRadioChannel(0) end end Server addEvent("playSound",true) addEventHandler("playSound",root, function() local x,y,z = getElementPosition(source) playSound3D( HERE , x,y,z) end)
-
Lol, you have it all wrong. the pickup was destroyed. you mean the wanted levels ? Did you want all of your wanted levels to be removed or only one of them ?
-
You can remove line 8, forgot to remove it, and when you started the resource. did you wait 10 seconds before the pickup created?
-
As MADE Said, it's server-sided . and it does work, I've tested it
-
This works, tested it myself. function dede() setTimer(function() test = createPickup (2720.3171386719, 2123.2409667969, 6.7327833175659, 3, 1247, 60000 ) addEventHandler("onPickupHit",test, function() setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) end) end,60000,0) end addEventHandler("onResourceStart",resourceRoot,dede)
-
Try this function dede() setTimer(function() test = createPickup (1548, -1681, 13, 3, 1247, 60000 ) addEventHandler("onPickupHit",test,onHitStar) end,60000,1) end function onHitStar(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) removeEventHandler("onPickupHit",test,onHitStar) dede() end
-
I already have a code for this, so I will just give it to you. local blipTable = {} local blipFixTimer addEventHandler("onResourceStart",resourceRoot, function() local players = getElementsByType("player") for i=1,#players do local player = players[i] local playerTeam = getPlayerTeam( player ) if playerTeam and not isPedDead(player) then local r, g, b = getTeamColor ( playerTeam ) blipTable[player] = createBlipAttachedTo ( player, 0, 2, r, g, b ) end end blipFixTimer = setTimer(function() local players = getElementsByType("player") for i=1,#players do local player = players[i] local playerTeam = getPlayerTeam( player ) local oldBlip = blipTable[player] if playerTeam and not isPedDead(player) then local r, g, b = getTeamColor ( playerTeam ) if not isElement(oldBlip) then blipTable[player] = createBlipAttachedTo ( player, 0, 2, r, g, b ) else local r2,g2,b2 = getBlipColor ( oldBlip ) if r ~= r2 or g ~= g2 or b ~= b2 then destroyElement(oldBlip) blipTable[player]= createBlipAttachedTo ( player, 0, 2, r, g, b ) end end elseif oldBlip and isElement(oldBlip) then destroyElement(oldBlip) blipTable[player]= nil end end end,1000,0) end) addEventHandler("onPlayerSpawn",root, function() local oldBlip = blipTable[source] if isElement(oldBlip) then destroyElement(oldBlip) blipTable[source] = nil end local playerTeam = getPlayerTeam(source ) if playerTeam then local r, g, b = getTeamColor ( playerTeam ) blipTable[source] = createBlipAttachedTo ( source, 0, 2, r, g, b ) end end) addEventHandler("onPlayerWasted",root, function() local oldBlip = blipTable[source] if isElement(oldBlip) then destroyElement(oldBlip) blipTable[source] = nil end end) addEventHandler ( "onPlayerQuit", root, function() local oldBlip = blipTable[source] if isElement(oldBlip) then destroyElement(oldBlip) blipTable[source] = nil end end)
-
local test = createPickup (1548, -1681, 13, 3, 1247, 60000 ) addEventHandler("onPickupHit",test, function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) destroyElement(test) end)
-
Yes that's the time it will respawn( in milliseconds )
-
Huh ? anyways if you don't understand, then you can use this code local test = createPickup (1548, -1681, 13, 3, 1239, 60000 ) addEventHandler("onPickupHit",test, function(player) setPlayerWantedLevel(player,getPlayerWantedLevel(player)-1) end)
-
Well, you can use the event onPickupHit then you can use setPlayerWantedLevel
-
Yep, it outputs chatbox for when i register.
-
I have a problem with a login/register script. No errors in debugscript here you go. Client: function loginPlayer() local username, password = guiGetText(myUsernameEdit), guiGetText(myPasswordEdit) if (password:len() <= 4) then exports["TopBarChat"]:sendClientMessage("Invalid Password", "Your password must be\nlonger than 4 characters!") return end if (username:len() <= 4) then exports["TopBarChat"]:sendClientMessage("Invalid Username", "Your username must be\nlonger than 4 characters!") return end --triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) triggerServerEvent("UIPaccounts.loginPlayer", root, username, password, guiCheckBoxGetSelected(rememberMyUsernameCheck), guiCheckBoxGetSelected(rememberMyPasswordCheck)) triggerServerEvent("IfNewPlayerJoin",getLocalPlayer()) end function registerPlayer() local username = guiGetText(registerEdit[1]) local password = guiGetText(registerEdit[2]) local queSelected = guiComboBoxGetSelected(questionsCombo) local answer = guiGetText(registerEdit[4]) local question = guiComboBoxGetItemText(questionsCombo, queSelected) if (not question) then exports["TopBarChat"]:sendClientMessage("You must select a question") return end if (username:len() <= 4) then exports["TopBarChat"]:sendClientMessage("Your username must be longer than 4 characters!") return end if (password:len() <= 4) then exports["TopBarChat"]:sendClientMessage("Your password must be longer than 4 characters!") return end triggerServerEvent("UIPaccounts.registerPlayer",getLocalPlayer(),username,password) end Server: function loginPlayer(username, password, boolRememberUsername, boolRememberPassword) local currentAccount = getPlayerAccount(client) if (not isPlayerGuest(client)) then return end if (not isGuestAccount(currentAccount)) then exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFYou're already logged in!",client,255,255,255,true) return end if (getAccount(username) and not getAccount(username, password)) then exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFThe password you submitted is wrong!",client,255,255,255,true) return end if (not getAccount(username)) then exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFThe account name you submitted does not exist!",client,255,255,255,true) return end local theAccount = getAccount(username, password) for i, player in pairs(getElementsByType("player")) do local theirAccount = getPlayerAccount(player) if (theirAccount == theAccount) then exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFAlready in-use!", "The account you submitted\nis already used by another player!",client,255,255,255,true) return end end local loginStatus = logIn(client, theAccount, password) if (loginStatus) then triggerClientEvent(client, "UIPaccounts.remove", client) spawnPlayer2(client) local user = getAccountName(theAccount) if (boolRememberUsername and boolRememberPassword) then status = "both" elseif (boolRememberUsername and not boolRememberPassword) then status = "password" elseif (not boolRememberUsername and boolRememberPassword) then status = "username" elseif (not boolRememberUsername and not boolRememberPassword) then status = "destroyBoth" end triggerClientEvent(client, "UIPaccounts.saveAccountDetails", client, user, password, status) end end addEvent("UIPaccounts.loginPlayer", true) addEventHandler("UIPaccounts.loginPlayer", root, loginPlayer) function registerPlayer(username, password, question, answer, city) if (not isPlayerGuest(client)) then return end if (getAccount(username)) then exports["TopBarChat"]:sendClientMessage("#0000FF* #FFFFFFThis account name is already taken!",client,255,255,255,true) return end local acc = addAccount(username, password) if (acc) then local skins = getSkinsTable() logIn(client, acc, password) setAccountData(acc, "UIPaccounts.securityQuestion", question) setAccountData(acc, "UIPaccounts.securityAnswer", answer) end end addEvent("UIPaccounts.registerPlayer", true) addEventHandler("UIPaccounts.registerPlayer", root, registerPlayer)
-
Nice track and deco. Also, nice record troy.
-
local ped = createPed(1,1,1,1) if ( ped ) then Now, this is the part where you'd want to check if your element is created/spawned or whatever.. if ( ped ) then