Jump to content

Dimos7

Members
  • Posts

    1,546
  • Joined

  • Last visited

Everything posted by Dimos7

  1. When i use indicator or emergency light with j two time and try to /lights the command is bugged say turn off but not turn it of or on same
  2. addEventHandler("onPlayerJoin", root, function() bindKey(source,"[", "down", leftIndicator) bindKey(source, "]", "down", rightIndicator) bindKey(source, "=", "down", alert) end) addEventHandler("onResourceStart", resourceRoot, function() leftIndicatorStatus = {} rightIndicatorStatus = {} alertStatus = {} for i, v in ipairs(getElementsByType("player")) do local playerName = getPlayerName(v) bindKey(v, "[", "down", leftIndicator) bindKey(v, "]", "down", rightIndicator) bindKey(v, "=", "down", alert) leftIndicatorStatus[playerName] = false rightIndicatorStatus[playerName] = false alertStatus[playerName] = false end end) function leftIndicator(thePlayer) local playerName = getPlayerName(thePlayer) if leftIndicatorStatus[playerName] == false then if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then leftIndicatorStatus[playerName] = true if isTimer (IdicatiorTimerRight) then killTimer(IdicatiorTimerRight) rightIndicatorStatus[playerName] = false setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) end IdicatiorTimerLeft = setTimer( function() setVehicleOverrideLights(car, 2) if getVehicleLightState(car, 0) == 0 then setVehicleLightState(car, 0, 1) setVehicleLightState(car, 3, 1) else setVehicleLightState(car, 0, 0) setVehicleLightState(car, 3, 0) end end, 500, 0) end end else if isTimer(IdicatiorTimerLeft) then killTimer(IdicatiorTimerLeft) leftIndicatorStatus[playerName] = false setVehicleLightState(car, 0, 0) setVehicleLightState(car, 3, 0) end end end function rightIndicator(thePlayer) local playerName = getPlayerName(thePlayer) if rightIndicatorStatus[playerName] == false then if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then rightIndicatorStatus[playerName] = true if isTimer(IdicatiorTimerLeft) then killTimer(IdicatiorTimerLeft) leftIndicatorStatus[playerName] = false setVehicleLightState(car, 0, 0) setVehicleLightState(car, 3, 0) end IdicatiorTimerRight = setTimer( function() setVehicleOverrideLights(car, 2) if getVehicleLightState(car, 1) == 0 then setVehicleLightState(car, 1, 1) setVehicleLightState(car, 2, 1) else setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) end end, 500, 0) end end else if isTimer(IdicatiorTimerRight) then killTimer(IdicatiorTimerRight) rightIndicatorStatus[playerName] = false setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) end end end function alert(thePlayer) local playerName = getPlayerName(thePlayer) if alertStatus[playerName] == false then if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then alertStatus[playerName] = true alertTimer = setTimer( function() setVehicleOverrideLights(car, 2) if getVehicleLightState(car, 0) == 0 and getVehicleLightState(car, 1) == 0 then setVehicleLightState(car, 0, 1) setVehicleLightState(car, 1, 1) setVehicleLightState(car, 2, 1) setVehicleLightState(car, 3, 1) else setVehicleLightState(car, 0, 0) setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) setVehicleLightState(car, 3, 0) end end, 500, 0) end end else if isTimer(alerTimer) then killTimer(alerTimer) alerStatus[playerName] = false setVehicleLightState(car, 0, 0) setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) setVehicleLightState(car, 3, 0) end end end -- Emergency Lights resource by vovo4ka -- please, do not remove copyright local strobo_interval = 5 -- strobo light freq. 10 = 0.5 sec local is_strobo_enabled = true -- enable/disable stroboscopic lights mode -- lamps local flash_interval = 0.3 -- flash freq -- led blink mode local blink_interval = 15 -- blink interval local blink_duration = 2 -- 1..blink_interval -- Node: If vehicleID what you want to change is not present here, you may add it manually -- There are custom lights count and position for each vehicle is available -- What is phase offset. I'm newbie in english and its hard to explain ;) You can read more about on http://en.wikipedia.org/wiki/Phase_(waves) -- All you need to know about phase_offset: 0 and 10 values will have opposite intensity (i.e. light with 0 will be on and 10 will be off and vice versa) -- -- dont read below, if youre humanities ;) -- -- For each light source there are light intensity calculation performed at each time. -- There are two lights type are available for vehicles: -- 1. -- Usually, light reflector is rotating and light intensity is proportional to visible part of lamp. -- So, light intensity is approximated by simple model: -- intensity(t, i) = 256*sin (t+PhaseOffset_i) -- where t - is model time, i - light source id -- 2. -- For LED blinking there is simpler model: -- blink 2 times at time moment 0 -- -- So, PhaseOffset - is time difference between triggering lights local car_lights_table = { -- vehicle ID, ["mode"]="led" or "lamp" , [i] = { light offset, light color, light size, phase offset (from [0;10]) } -- police car with leds [596] = {["mode"]="led", [1]={["pos"]={-0.3, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.3, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=10.0}, }, [597] = {["mode"]="led", [1]={["pos"]={-0.3, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.3, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=10.0}, [6]={["pos"]={0.7, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=10.0} }, -- rancher [599] = {["mode"]="led", [1]={["pos"]={-0.4, -0.5, 1.2}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.4, -0.5, 1.2}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=10.0}, }, -- old police car with lamps [598] = {["mode"]="lamp", [1]={["pos"]={-0.5, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.5, -0.35, 0.9}, ["color"]={0,0,0}, ["size"]=0.25, ["phase"]=10.0} }, -- ambulance [416] = {["mode"]="led", [1]={["pos"]={-0.1, 0.9, 1.35}, ["color"]={255,255,255}, ["size"]=0.5, ["phase"]=10.0}, [2]={["pos"]={-0.5, 0.9, 1.35}, ["color"]={255,0,0}, ["size"]=0.35, ["phase"]=0.0}, [3]={["pos"]={0.5, 0.9, 1.35}, ["color"]={255,0,0}, ["size"]=0.35, ["phase"]=0.0}, [4]={["pos"]={-1, -3.5, 1.5}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=5.0}, [5]={["pos"]={1, -3.5, 1.5}, ["color"]={255,0,0}, ["size"]=0.4, ["phase"]=5.0} }, -- fire truck [544] = {["mode"]="lamp", [1]={["pos"]={-0.95, 2.75, 1.45}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=6.0}, [2]={["pos"]={0.95, 2.75, 1.45}, ["color"]={255,128,0}, ["size"]=0.35, ["phase"]=10.0} }, -- rancher [490] = {["mode"]="lamp", [1]={["pos"]={-0.5, 0.2, 1.15}, ["color"]={0,0,255}, ["size"]=0.35, ["phase"]=10.0}}, -- enforcement [427]={["mode"]="led", [1]={["pos"]={-0.8, 3.2, -0.1}, ["color"]={255, 0, 0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={0.8, 3.2, -0.1}, ["color"]={0, 0, 255}, ["size"]=0.25, ["phase"]=10.0}} -- since 0.8 there are no default lights position, because only emergency and pre-defined vehicles can use lights --["default"] = {["mode"]="lamp", [1]={["pos"]={0.5, 0, 0.8}, ["color"]={255,0,0}, ["size"]=0.25, ["phase"]=0.0}, [2]={["pos"]={-0.5, 0, 0.8}, ["color"]={0,0,255}, ["size"]=0.25, ["phase"]=10.0}} } -- do not modify -------------------------------------------- local vehicles = {} local timers = {} local base_freq = 50 -- freq of timer for light change ------------------------------------------------------------- function release_vehicle(vehicle) if (isElement(vehicle)) then if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 0) setVehicleLightState ( vehicle, 0, 1) setVehicleLightState ( vehicle, 1, 1) setVehicleLightState ( vehicle, 2, 1) setVehicleLightState ( vehicle, 3, 1) end end if (vehicles[vehicle]~=nil) then -- release the markers for key, value in pairs(vehicles[vehicle]["flist"]) do destroyElement (value["m"]) end vehicles[vehicle] = nil end if (timers[vehicle]~=nil) then -- kill the strobo timer killTimer(timers[vehicle]) timers[vehicle] = nil if (isElement(vehicle)) then if (getElementData( vehicle, "emerlights_source")==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 0 ) end end end end function checkForAbility(vehicle) local veh_model = getElementModel ( vehicle ) if (car_lights_table[veh_model]==nil)or(getElementData( vehicle, "emerlights_enabled" )=="false") then return false end return true end function strobo_state_update (vehicle) -- check for valid vehicle if (isElement(vehicle)) then if (vehicles[vehicle]==nil) then -- check for disallowing to use lights -- its enabled by default if (checkForAbility(vehicle)==false) then release_vehicle(vehicle) return end local veh_model = getElementModel ( vehicle ) --if (car_lights_table[veh_model]==nil) then --veh_model = "default" --end local occupant = getVehicleOccupant( vehicle, 0) if (getElementType(occupant)=="player") then -- peds also can use emerlights local src = getPlayerName(occupant) setElementData( vehicle, "emerlights_source", src, false) if (src==getPlayerName(getLocalPlayer())) then triggerEvent ( "onPlayerEmergencyLightStateChange", getRootElement(), 1 ) end end -- init state variable vehicles[vehicle] = {} vehicles[vehicle]["lstate"] = 0 -- strobo lights state vehicles[vehicle]["fstate"] = 0 -- flash light state vehicles[vehicle]["flist"] = {} -- flash lights list (marker ids) -- create flash lights local mode = car_lights_table[veh_model]["mode"] if (mode==nil) then mode = "lamp" end local coeff = 0 if (mode=="lamp") then coeff = 3.141592654/10.0 else coeff = blink_interval/20.0 end vehicles[vehicle]["fmode"] = mode for light_id, light_desc in pairs(car_lights_table[veh_model]) do if (light_id~="mode") then vehicles[vehicle]["flist"][light_id] = {} vehicles[vehicle]["flist"][light_id]["m"] = createMarker( 0.0001, 0.0001, 0.0001, "corona", light_desc["size"], light_desc["color"][1], light_desc["color"][2], light_desc["color"][3], 100) vehicles[vehicle]["flist"][light_id]["p"] = light_desc["phase"]*coeff attachElements ( vehicles[vehicle]["flist"][light_id]["m"], vehicle, light_desc["pos"][1], light_desc["pos"][2], light_desc["pos"][3] ) end end end -- strobo light if (is_strobo_enabled) then setVehicleOverrideLights ( vehicle, 2) if (vehicles[vehicle]["lstate"]<strobo_interval) then setVehicleLightState ( vehicle, 0, 1 ) setVehicleLightState ( vehicle, 1, 0 ) setVehicleLightState ( vehicle, 2, 0 ) setVehicleLightState ( vehicle, 3, 1 ) else setVehicleLightState ( vehicle, 0, 0 ) setVehicleLightState ( vehicle, 1, 1 ) setVehicleLightState ( vehicle, 2, 1 ) setVehicleLightState ( vehicle, 3, 0 ) end if (vehicles[vehicle]["lstate"]>=strobo_interval*2) then vehicles[vehicle]["lstate"] = 0 else vehicles[vehicle]["lstate"] = vehicles[vehicle]["lstate"] + 1 end end -- flash light if (vehicles[vehicle]["fmode"]=="lamp") then -- lamp mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor( value["m"] ) setMarkerColor(value["m"], R, G, B, (math.sin(tmp_fstate+value["p"])+1.0)*128.0) end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + flash_interval else -- led mode local tmp_fstate = vehicles[vehicle]["fstate"] for key, value in pairs(vehicles[vehicle]["flist"]) do local R, G, B, A = getMarkerColor(value["m"]) -- blinking mode local tmp_val = tmp_fstate+value["p"] if (tmp_val>blink_interval) then tmp_val = tmp_val - blink_interval end if ((tmp_val>=0)and(tmp_val<blink_duration))or((tmp_val>=blink_duration+1)and(tmp_val<blink_duration*2+1)) then setMarkerColor(value["m"], R, G, B, 255) else setMarkerColor(value["m"], R, G, B, 0) end end vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] + 1 if (vehicles[vehicle]["fstate"]>blink_interval) then vehicles[vehicle]["fstate"] = vehicles[vehicle]["fstate"] - blink_interval end end else -- if vehicle is no more exists release_vehicle(vehicle) end end -- not used anymore function stroboLightOn() playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) -- get the player's vehicle --setElementData( playerVehicle, "emerlights_enabled", "true" ) -- debug if ( playerVehicle ) then -- if player is not a driver if (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then --outputChatBox("you're not a driver!") return end setStroboLightsOn(playerVehicle, nil) end end function isStroboLightsOn (vehicle_id) if (timers[vehicle_id]) then return 1 else return 0 end end function setStroboLightsOn(vehicle_id, value) if ( vehicle_id ) then if (value==nil) then if (isStroboLightsOn(vehicle_id)==1) then value = 0 else value = 1 end; end; if (value==0) then if (timers[vehicle_id]) then release_vehicle(vehicle_id) end end if (value==1) then if (timers[vehicle_id]) then release_vehicle(vehicle_id) end -- create strobo timer timers[vehicle_id] = setTimer ( strobo_state_update, base_freq, 0, vehicle_id ) end end end -- only local effect function enableStroboLightsMode(source, value) if (value=="0")or(value=="false") then is_strobo_enabled = false outputConsole("Stroboscopic mode disabled") else if (value=="1")or(value=="true") then is_strobo_enabled = true outputConsole("Stroboscopic mode enabled") else outputConsole("Usage: strobo 0 or strobo 1 for disable/enable stroboscopic lights mode") end end end addCommandHandler("strobo", enableStroboLightsMode) -- triggered by server function setEmerlightsState(value, state) local player = getPlayerFromName ( value ) local vehicle = getPedOccupiedVehicle(player) if (vehicle) then setStroboLightsOn(vehicle, state) end end addEvent("setEmerlights", true) addEventHandler("setEmerlights", getRootElement(), setEmerlightsState) function requestEmerlights() -- check for driver playerVehicle = getPedOccupiedVehicle (getLocalPlayer()) -- get the player's vehicle if (playerVehicle) then -- if player is not a driver if (getLocalPlayer()~=getVehicleOccupant( playerVehicle )) then --outputChatBox("you're not a driver!") return end if (checkForAbility(playerVehicle)) then -- sync triggerServerEvent("requestEmerlightChangeState", getLocalPlayer(), 1-isStroboLightsOn(getPedOccupiedVehicle(getLocalPlayer()))) else -- not able to use lights for this vehicle --outputChatBox("unknown car!") end end end addCommandHandler("Strobo Light On", requestEmerlights)--stroboLightOn) bindKey("j", "down", "Strobo Light On") addEvent("onPlayerEmergencyLightStateChange") function toggleLights(thePlayer) if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) x, y, z = getElementPosition(thePlayer) for i, v in ipairs(getElementsByType("player")) do px, py, pz = getElementPosition(v) distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz) if distance <= chat_range then if getPedOccupiedVehicleSeat(thePlayer) == 0 then if getVehicleOverrideLights(car) == 1 then setVehicleOverrideLights(car, 2) outputChatBox(getPlayerName(thePlayer).. " has turn lights on.", v, 255, 0, 255) elseif getVehicleOverrideLights(car) == 2 then setVehicleOverrideLights(car, 1) outputChatBox(getPlayerName(thePlayer).. "has turns lights off.", v, 255, 0, 255) end else outputChatBox("You must be on driver seat!", thePlayer, 255, 0, 0) end end end else outputChatBox("You must be inside a vehicle!", thePlayer, 255, 0, 0) end end addCommandHandler("lights", toggleLights) weh use emegerncy light j two time or indicator my light command bugged any help?
  3. Dimos7

    pm system help

    my resouce called id-system and apear error <meta> <script src="ids.lua" type="server"/> <export function="getPlayerFromID" type="server"/> </meta> ID = { } exports["scoreboard"]:scoreboardAddColumn("ID", root, 20, "ID", 1) -------------------------- [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 1, getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "ID", i) break; end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i =1 ,getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "ID", i) break; end end end end) -------------------------- [ Functions ] ----------------------- function getPlayerID(thePlayer) if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" and getElementData(thePlayer, "ID") then return getElementData(thePlayer, "ID") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, commandName, sendToName, ...) local message = table.concat({...}, " ") local toPlayer = getPlayerFromPartialName(sendToName) or exports.id-system:getPlayerFromID(tonumber(sendToName)) if toPlayer then local pmblocked = getElementData(toPlayer, "pmblocked") if toPlayer ~= thePlayer then if pmblocked ~= 1 then if message ~= "" then outputChatBox("PM to "..getPlayerName(toPlayer).." : "..message, thePlayer, 238, 232, 84) outputChatBox("PM from "..getPlayerName(thePlayer).." : "..message, toPlayer, 236, 205, 45) outputServerLog("PM to "..getPlayerName(toPlayer).." : "..message) outputServerLog("PM from "..getPlayerName(thePlayer)..": "..message) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("SYNTAX: /"..commandName.." [part of name] [message]", thePlayer, 255, 0, 0) end else outputChatBox("This person has diasble his pm try later!", thePlayer, 255, 0, 0) end else outputChatBox("You can't speak to yourself!", thePlayer, 255, 0, 0) end else outputChatBox("Player not found!", thePlayer, 255, 0, 0) end end addCommandHandler("pm", privateMessage) call non running server resource(id) [string "?"] attempt to index global 'system( a nil value)
  4. Dimos7

    pm system help

    also apear play not found
  5. Dimos7

    pm system help

    that have export without export it not possible?
  6. Dimos7

    pm system help

    ID = { } exports["scoreboard"]:scoreboardAddColumn("ID", root, 20, "ID", 1) -------------------------- [ Events ] -------------------------- addEventHandler("onPlayerJoin", root, function() for i = 1, getMaxPlayers() do if not ID[i] then ID[i] = source setElementData(source, "ID", i) break; end end end) -- addEventHandler("onPlayerQuit", root, function() ID[getPlayerID(source)] = nil end) -- addEventHandler("onResourceStart", resourceRoot, function() for _, v in ipairs(getElementsByType("player")) do for i =1 ,getMaxPlayers() do if not ID[i] then ID[i] = v setElementData(v, "ID", i) break; end end end end) -------------------------- [ Functions ] ----------------------- function getPlayerID(thePlayer) if thePlayer and isElement(thePlayer) and getElementType(thePlayer) == "player" and getElementData(thePlayer, "ID") then return getElementData(thePlayer, "ID") end return false end -- function getPlayerFromID(id) if id and tonumber(id) and ID[tonumber(id)] then return ID[tonumber(id)] end return false end
  7. Dimos7

    pm system help

    si have a id system make by my and want work with id too gerPlayerFromID and take it and pm that person how to do it that wihtout to export my function from id-system?
  8. Dimos7

    pm system help

    anyone? when try for my self or play not be in server work when try speak to someone is on server for example lets say the play called bombMaxs and do /pm bo test apear the message SYNTAX: /pm [part of name] [message] why?
  9. function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, _, sendToName, ...) local message = table.concat({...}, " ") if sendToName then if getPlayerFromPartialName(sendToName) then toPlayer = getPlayerFromPartialName(sendToName) if toPlayer ~= thePlayer then if not message == "" then outputChatBox("PM to "..getPlayerName(toPlayer).." : "..message, thePlayer, 238, 232, 84) outputChatBox("PM from "..getPlayerName(thePlayer).." : "..message, toPlayer, 236, 205, 45) outputChatBox("Use /re [message] to answer.", thePlayer, 236, 205, 45) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("Syntax:/pm [part of name] [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("You can't speak to your self.", thePlayer, 255, 0, 0) return false end else outputChatBox("Player not found.", thePlayer, 255, 0, 0) return false end else outputChatBox("Syntax: /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end end addCommandHandler("pm", privateMessage) function privateMessageReply(thePlayer, commandName, _, ...) local message = table.concat({...}, " ") local pmblocked = getElementData(thePlayer, "pmblocked") local toPlayer = getElementData(thePlayer, "pmPartner") if toPlayer then if message ~= "" then outputChatBox("PM to "..getPlayerName(toPlayer).." : "..message, thePlayer, 238, 232, 84, true) outputChatBox("PM from "..getPlayerName(thePlayer).." : "..message, toPlayer, 236, 205, 45, true) outputChatBox("Use /re [message] to answer.", toPlayer, 236, 205, 45, true) else outputChatBox("SYNTAX: /"..commandName.." [message]", thePlayer, 255, 0, 0, true) end if pmblocked == 1 then outputChatBox("This person has disable his pm try later.", thePlayer, 255, 0, 0, true) end else outputChatBox("None is pming you!", thePlayer, 255, 0, 0, true) end end addCommandHandler("re", privateMessageReply) when try contact someone online with sort of his name not working apear /pm part of name and message also i want make it work with id too
  10. Dimos7

    me chat

    yes it apear the message and not have something outpouts
  11. Dimos7

    me chat

    its the same now i want know why post my test twice in deafult and mine
  12. Dimos7

    me chat

    chat_range=50 function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local players = getPlayerName(player) nick = tostring ( players ):gsub( "_", " " ); for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox(""..nick.." says: "..msg,v,255,255,255,true) end end outputServerLog("[IC]: "..nick.." says: ".. msg) end addEventHandler("onPlayerChat", root, function(message, messageType) if messageType == 0 then cancelEvent() onChat(source, _, message) end end)
  13. Dimos7

    me chat

    what parameters to chnage? i have same problem and with say:D apear default and mine i try make it like that and still apear after have cancelEvent
  14. Dimos7

    me chat

    i did that but the them is the message not apear on my me chat
  15. Dimos7

    me chat

    hello i make a me chat the them is have and default and mine me when do /me also when do that the message apear at the default not mine help please chat_range=30 function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v, px, py, pz, chat_range) then outputChatBox("* "..nick.." "..msg,v,182,100,127,true) end end outputServerLog("* "..nick.." ".. msg) end addCommandHandler("me",onChat) addEventHandler("onPlayerChat", root, function(message, messageType) if messageType == 1 then onChat(source, message) end end)
  16. Hello i attempt make my own indcator system but not working not errors or warnings addEventHandler("onPlayerJoin", root, function() bindKey(source,"[", "down", leftIndicator) bindKey(source, "]", "down", rightIndicator) end) addEventHandler("onResourceStart", resourceRoot, function() for i, v in ipairs(getElementsByType("player")) do bindKey(v, "[", "down", leftIndicator) bindKey(v, "]", "down", rightIndicator) end end) function leftIndicator(thePlayer) if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then IdicatiorTimer = setTimer( function() setVehicleOverrideLights(car, 2) if getVehicleLightState(car, 0) == 0 then setVehicleLightState(car, 0, 1) setVehicleLightState(car, 1, 1) setVehicleLightState(car, 2, 1) setVehicleLightState(car, 3, 1) else setVehicleLightState(car, 0, 0) setVehicleLightState(car, 1, 1) setVehicleLightState(car, 2, 1) setVehicleLightState(car, 3, 0) end end, 50, 0) if isTimer(IdicatiorTimer) then killTimer(IdicatiorTimer) setVehicleOverrideLights(car, 1) end end end end function rightIndicator(thePlayer) if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then IdicatiorTimer = setTimer( function() setVehicleOverrideLights(car, 2) if getVehicleLightState(car, 1) == 0 then setVehicleLightState(car, 0, 1) setVehicleLightState(car, 1, 1) setVehicleLightState(car, 2, 1) setVehicleLightState(car, 3, 1) else setVehicleLightState(car, 0, 1) setVehicleLightState(car, 1, 0) setVehicleLightState(car, 2, 0) setVehicleLightState(car, 3, 1) end end, 50, 0) if isTimer(IdicatiorTimer) then killTimer(IdicatiorTimer) setVehicleOverrideLights(car, 1) end end end end
  17. Dimos7

    help please

    function toggleLights(thePlayer) if isPedInVehicle(thePlayer) then car = getPedOccupiedVehicle(thePlayer) if getPedOccupiedVehicleSeat(thePlayer) == 0 then if getVehicleOverrideLights(car) ~= 2 then setVehicleOverrideLights(car, 1) outputChatBox(getPlayerName(thePlayer).. "has turned the lights on.", root, 255, 0, 255) else setVehicleOverrideLights(car, 0) outputChatBox(getPlayerName(thePlayer).. "has turned the lights off.", root, 255, 0, 255) end else outputChatBox("You must be on driver seat!", thePlayer, 255, 0, 0) end else outputChatBox("You must be inside a vehicle!", thePlayer, 255, 0, 0) end end addCommandHandler("lights", toggleLights) its not working the light not turn on only off wtf no errors or warnings
  18. Dimos7

    Closed doors

    addEventHandler("onVehicleStartEnter", root, function() if isVehicleLocked(source) then cancelEvent() end end)
  19. Dimos7

    fuel question

    hello guys i want make a fuel system for vehicle how i do it what functions i need
  20. hospitalsTable = { { 1177.7994384766, -1323.0667724609, 14.088536262512 }, { -2656.2421875, 635.99420166016, 14.453125 }, { 1607.1225585938, 1817.8732910156, 10.8203125 }, } function findNearestHostpital(thePlayer) local nearest = nil local min = 999999 for key,val in pairs(hospitalsTable) do local xx,yy,zz=getElementPosition(thePlayer) local x1=val[1] local y1=val[2] local z1=val[3] local dist = getDistanceBetweenPoints2D(xx,yy,x1,y1) if dist then nearest = val min = dist end end return nearest[1],nearest[2],nearest[3] end function spawn(player) local xx,yy,zz = findNearestHostpital(player) spawnPlayer( player, xx,yy,zz) fadeCamera(player,true,3.0) end addEventHandler("onPlayerWasted", root, function() fadeCamera(source,false,6.0,0,0,0) setTimer(spawn, 8000, 1, source) end ) you had then together with dist so that not work try now
×
×
  • Create New...