Jump to content

justn

Members
  • Posts

    525
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by justn

  1. justn

    [Unsolved]Bug

    Ah, any help ?
  2. Can you post the part where you triggered the event 'createCook' ? also, you don't need to define source in a server-sided function.
  3. justn

    [Unsolved]Bug

    I already changed that to attachElements ._.
  4. justn

    [Unsolved]Bug

    Can you help me with that please ?
  5. justn

    [Unsolved]Bug

    Works, But i have 1 more small problem, let's say that I was in the car, and i was listening to a song on the radio, when i exit the vehicle and i enter again. The song on the radio doesn't continue, I must switch the radio station and then switch it back to the previous radio station to hear what was playing.
  6. justn

    [Unsolved]Bug

    No errors in debugscript. the problem started when i added if ( player == localPlayer ) then
  7. It is possible, using this code If you don't want the vehicle to be warped also, then you can remove line 5 and replace that with destroyElement(vehicle) addCommandHandler( "akina", function(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) setElementPosition( vehicle, -2499.77466, 2135.24170, 320.54016 ) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) else setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end end)
  8. justn

    [Unsolved]Bug

    I have this radio script. the problem is, the dx text doesn't shows or anything, can someone help please? 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(player,seat) if ( player == localPlayer ) then if seat == 0 or seat == 1 or seat == 2 or seat == 3 or seat == 4 then setRadioChannel(0) addEventHandler("onClientRender", getRootElement(), RenderClient) bindKey("mouse_wheel_up", "down", PlaySound, "up") bindKey("mouse_wheel_down", "down", PlaySound, "down") end end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle) function stopMySound(player,seat) if ( player == 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) 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) sound = nil end if state == "mouse_wheel_up" then if n < #radios then n = n + 1 end elseif state == "mouse_wheel_down" then if n > 1 then n = n - 1 end end sound = playSound3D(radios[n][1], x,y,z) radiotitle = radios[n][2] end function UpdateSound() if sound then local x,y,z = getElementPosition(getLocalPlayer()) setElementPosition(sound, x,y,z) end end addEventHandler("onClientRender", getRootElement(), UpdateSound)
  9. Oh my bad, this should work Forgot to change getPlayerFromName to getPlayerName addCommandHandler( "akina", function(player) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end )
  10. addCommandHandler( "akina", function(player) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerFromName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end )
  11. spawnPlayer giveWeapon
  12. Works perfectly, thanks to both of you ! ^^
  13. Well it works fine now, but I have gotten an error in debugscript ERROR: VIP\server.lua:12:attempt to concatenate local 'lp' ( a userdata value )
  14. Hi I'm working on a script to give player VIP, but it doesn't work, i don't know why. here's debugscript errors. ERROR: VIP\Server.lua:11: Bad argument @ 'setElementData' [Expected argument at argument 3 , got none] ERROR: VIP\Server.lua:12 attempt to concatenate global 'source' (a userdata value) Client ( Where you give the player vip ): addEventHandler("onClientGUIClick",SureWindow, function (b) if b == "left" and source == SureGive then local selected1 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPName) local selected2 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPRank) local ComboS = guiComboBoxGetItemText(SureCombo,guiComboBoxGetSelected(SureCombo)) if ( selected1 ) then if ComboS ~= "" then local selected3 = getPlayerFromName(selected1) if (selected3) then exports["TopBarChat"]:sendClientMessage("#ff0000* #00ff00You have given VIP to "..selected1,255,255,255,true) triggerServerEvent("giveSelected",localPlayer,selected1,selected2,selected3,ComboS) end end end end end) Server: addEventHandler("onPlayerJoin",getRootElement(), function() if ( getPlayerSerial(source) == "D5FF7C8E58745AE326AD72702D60ECA1" ) then setElementData(source, "VIP", "Premium" ) end end) addEvent("giveSelected",true) addEventHandler("giveSelected",getRootElement(), function(selected1,selected2,selected3,ComboS) setElementData(selected3,ComboS) exports["TopBarChat"]:sendClientMessage("#FF0000* #00ff00You have gotten VIP by "..source,selected3,255,255,255,true) end) Thanks.
  15. Well to begin with, you spelt getAccountData wrong on line 4.
  16. justn

    onPlayerWasted

    function saveLifeStats() outputChatBox("Ai murit cand aveai "..getElementData(source, "lifetime"), source, 255, 0, 0, false) end addEventHandler("onPlayerWasted", getRootElement(), saveLifeStats)
  17. Well, you'd need to check the hour and minutes to see if it's that time which you're looking for. and if it is. then you'd use playSound to play the sound.
  18. You want to play a sound after a certain number of seconds/minutes ?
  19. Well, you spelt guiWindowSetSizable wrongly. and the event onClientGUIClick was not added also you didn't add the quotation marks around the word left. NOTE: Instead of destroying the gui, use guiSetVisible and set it to false
  20. I would use onPlayerLogin instead.. try this.. addEventHandler("onPlayerLogin",getRootElement(), function() if getElementData(source,"Occupation") == "Criminal" then setPlayerTeam(source, getTeamFromName("Criminal")) elseif getElementData(source,"Occupation") == "Police" then setPlayerTeam(source, getTeamFromName("Police")) elseif getElementData(source, "Occupation") == "Trucker" then setPlayerTeam(source, getTeamFromName("Civilians")) elseif getElementData(source, "Occupation") == "Medic" then setPlayerTeam(source, getTeamFromName("Emergency")) elseif getElementData(source, "Occupation") == "Freeroam" then setPlayerTeam(source, getTeamFromName("Freeroam")) elseif getElementData(source, "Occupation") == "Staff" then setPlayerTeam(source, getTeamFromName("Staff")) elseif getElementData(source, "Occupation") == "Unemployed" then setPlayerTeam(source, getTeamFromName("Unemployed")) elseif getElementData(source, "Occupation") == "FBI Agent" then setPlayerTeam(source, getTeamFromName("FBI")) elseif getElementData(source, "Occupation") == "Army" then setPlayerTeam(source, getTeamFromName("Army")) elseif getElementData(source, "Occupation") == "SWAT Agent" then setPlayerTeam(source, getTeamFromName("SWAT")) else setElementData(source, "Occupation", "Unemployed") setPlayerTeam(source, getTeamFromName("Unemployed")) end end )
  21. local time = getRealTime() local hour = time.hour local minute = time.minute function setAlarmGUI() winSetAlarm = guiCreateWindow(804, 306, 313, 187, "Set Alarm", false) guiWindowSetSizable(winSetAlarm, false) lblHour = guiCreateEdit(117, 61, 30, 23, hour, false, winSetAlarm) guiCreateLabel(153, 64, 15, 20, ":", false, winSetAlarm) lblMin = guiCreateEdit(163, 61, 30, 23, minute, false, winSetAlarm) guiCreateLabel(126, 44, 21, 17, "hh", false, winSetAlarm) guiCreateLabel(168, 44, 21, 17, "mm", false, winSetAlarm) btnCloseAlarm = guiCreateButton(23, 56, 62, 28, "Close", false, winSetAlarm) btnSetAlarm = guiCreateButton(231, 56, 62, 28, "Set", false, winSetAlarm) winSetAlarmGrid = guiCreateGridList(13, 91, 290, 86, false, winSetAlarm) guiGridListAddColumn(winSetAlarmGrid, "Alarm", 0.9) guiCreateLabel(7, 32, 273, 44, "This alarm uses 24-hour times. Set it according to\nlocal time.", false, winSetAlarmGrid) guiEditSetMaxLength(lblHour, 2) guiEditSetMaxLength(lblMin, 2) end addCommandHandler("setalarm", setAlarmGUI) addEventHandler("onClientGUIClick",getRootElement(), function(button) if button == "left" then if source == btnSetAlarm then guiGetText(lblHour) guiGetText(lblMin) guiSetVisible(winSetAlarm,false) outputChatBox("Alarm set!",0, 255, 0) end end end)
×
×
  • Create New...