Jump to content

K4stic

Members
  • Posts

    708
  • Joined

  • Last visited

Everything posted by K4stic

  1. K4stic

    [HELP] trigger

    setTimer( function() gPS69 = getPedStat(source, 69) if (gPS69 = 100) then guiProgressBarSetProgress(Progress[1], 10) gPS70 = getPedStat ( source, 70 ) if (gPS70 = 100) then guiProgressBarSetProgress(Progress[2], 10) end ,50 ,0 ) it will be correct?
  2. K4stic

    [HELP] trigger

    Help me fix it and give me code pls
  3. K4stic

    [HELP] trigger

    ok i fix and remake it now it's client side: setTimer( function() gPS69 = getPedStat(source, 69) guiProgressBarSetProgress(Progress[1], gPS69) end ,50 ,0 ) it's not show stats in ProgressBar
  4. K4stic

    [HELP] trigger

    ok i fix and remake it now it's client side: gPS69 = getPedStat(source, 69) guiProgressBarSetProgress(Progress[1], gPS69) it's not show stats in ProgressBar
  5. how to make it good trigger? Client side: setTimer( triggerServerEvent ( "stats" ) ,50 ,0 ) Server side addEvent("stats",true) addEventHandler("stats",root function() gPS69 = getPedStat(source, 69) guiProgressBarSetProgress(Progress[1], gPS69) end )
  6. K4stic

    save [help]

    Try This function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount , "Deaths") local accountData = getAccountData (theCurrentAccount , "Kills") if (accountData) then setElementData(source, "Deaths",accountData ) setElementData(source, "Kills",accountData ) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then setAccountData(account, "Deaths",getElementData(source,"Deaths")) setAccountData(account, "Kills",getElementData(source,"Kills")) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit)
  7. K4stic

    [HELP] Chat

    ok thx i remake the chatbubbles with no bugs
  8. K4stic

    [HELP] Chat

    Last ask in this topic addEventHandler ( "onPlayerTeamChat", root, chatbox ) is correct code for Teamchat with Y ?
  9. K4stic

    [HELP] Chat

    i thing i need remove the "messageType" from Chatbubbles script
  10. K4stic

    [HELP] Chat

    you mean this triggerEvent ( "onPlayerLocalChat", player, msg ) to tigger the event to chatbubbles LOL i'm so BAD in LUA But Thx for help you are the best!
  11. K4stic

    [HELP] Chat

    for what? ? give me a code pls sorry i'm bad in lua but i'm trying
  12. K4stic

    [HELP] Chat

    You mean this? function sendMessageToClient(message) if not wasEventCancelled() then triggerClientEvent("onChatbubblesMessageIncome",source,message,messagetype) end end end addEvent ( "onPlayerLocalChat", true ) addEventHandler("onPlayerLocalChat",getRootElement(),sendMessageToClient)
  13. K4stic

    [HELP] Chat

    i don't understand
  14. K4stic

    [HELP] Chat

    How remake Chatbubbles to make bubles for local chat with U and no to chat with T Chatbubbles: Client side local textsToDraw = {} local hideown local showtime local characteraddition local maxbubbles local showthebubbles = true function income(message,messagetype) if source ~= getLocalPlayer() or not hideown then if messagetype == 2 then if getPlayerTeam(source) == getPlayerTeam(getLocalPlayer()) then addText(source,message,messagetype) end else addText(source,message,messagetype) end end end function addText(source,message,messagetype) local notfirst = false for i,v in ipairs(textsToDraw) do if v[1] == source then v[4] = v[4] + 1 notfirst = true end end local infotable = {source,message,messagetype,0} table.insert(textsToDraw,infotable) if not notfirst then setTimer(removeText,showtime + (#message * characteraddition),1,infotable) end end function removeText(infotable) for i,v in ipairs(textsToDraw) do if v[1] == infotable[1] and v[2] == infotable[2] then for i2,v2 in ipairs(textsToDraw) do if v2[1] == v[1] and v[4] - v2[4] == 1 then setTimer(removeText,showtime + (#v2[2] * characteraddition),1,v2) end end table.remove(textsToDraw,i) break end end end function getTextsToRemove() for i,v in ipairs(textsToDraw) do if v[1] == source then removeText(v) end end end function handleDisplay() if showthebubbles then for i,v in ipairs(textsToDraw) do if isElement(v[1]) then if getElementHealth(v[1]) > 0 then local camPosXl, camPosYl, camPosZl = getPedBonePosition (v[1], 6) local camPosXr, camPosYr, camPosZr = getPedBonePosition (v[1], 7) local x,y,z = (camPosXl + camPosXr) / 2, (camPosYl + camPosYr) / 2, (camPosZl + camPosZr) / 2 --local posx,posy = getScreenFromWorldPosition(x,y,z+0.25) local cx,cy,cz = getCameraMatrix() local px,py,pz = getElementPosition(v[1]) local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) local posx,posy = getScreenFromWorldPosition(x,y,z+0.020*distance+0.10) local elementtoignore1 = getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer() local elementtoignore2 = getPedOccupiedVehicle(v[1]) or v[1] if posx and distance <= 45 and ( isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore1) or isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore2) ) and ( not maxbubbles or v[4] < maxbubbles ) then -- change this when multiple ignored elements can be specified local width = dxGetTextWidth(v[2],1,"default") dxDrawRectangle(posx - (3 + (0.5 * width)),posy - (2 + (v[4] * 20)),width + 5,19,tocolor(0,0,0,255)) dxDrawRectangle(posx - (6 + (0.5 * width)),posy - (2 + (v[4] * 20)),width + 11,19,tocolor(0,0,0,40)) dxDrawRectangle(posx - (8 + (0.5 * width)),posy - (1 + (v[4] * 20)),width + 15,17,tocolor(0,0,0,255)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (1 + (v[4] * 20)),width + 19,17,tocolor(0,0,0,40)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (v[4] * 20) + 1,width + 19,13,tocolor(0,0,0,255)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (v[4] * 20) + 1,width + 23,13,tocolor(0,0,0,40)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (v[4] * 20) + 4,width + 23,7,tocolor(0,0,0,255)) local r,g,b = 255,255,255 if v[3] == 2 then r,g,b = getTeamColor(getPlayerTeam(v[1])) end dxDrawText(v[2],posx - (0.5 * width),posy - (v[4] * 20),posx - (0.5 * width),posy - (v[4] * 20),tocolor(r,g,b,255),1,"default","left","top",false,false,false) end end end end end end function getServerSettings() triggerServerEvent("onAskForBubbleSettings",getLocalPlayer()) end function saveSettings(settings) showtime = settings[1] characteraddition = settings[2] maxbubbles = settings[3] hideown = settings[4] addEvent("onChatbubblesMessageIncome",true) addEventHandler("onChatbubblesMessageIncome",getRootElement(),income) end function toggleBubblesOnOff() showthebubbles = not showthebubbles outputChatBox("Toggled chatbubbles " ..( not showthebubbles and "#FF0000off#FFFFFF." or "#00FF00on#FFFFFF." ),255,255,255,true) end addEventHandler("onClientPlayerQuit",getRootElement(),getTextsToRemove) addEventHandler("onClientRender",getRootElement(),handleDisplay) addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerSettings) addEvent("onBubbleSettingsReturn",true) addEventHandler("onBubbleSettingsReturn",getRootElement(),saveSettings) addCommandHandler("chatbubbles",toggleBubblesOnOff) Server side local showtime = tonumber(get("chatbubbles.DefaultTime")) local characteraddition = tonumber(get("chatbubbles.PerCharacterAddition")) local maxbubbles = get("chatbubbles.MaxBubbles") if maxbubbles == "false" then maxbubbles = false else maxbubbles = tonumber(maxbubbles) end local hideown = get("chatbubbles.HideOwn") if hideown == "true" then hideown = true else hideown = false end function sendMessageToClient(message,messagetype) if not wasEventCancelled() then if messagetype == 0 or messagetype == 2 then triggerClientEvent("onChatbubblesMessageIncome",source,message,messagetype) end end end function returnSettings() local settings = { showtime, characteraddition, maxbubbles, hideown } triggerClientEvent(source,"onBubbleSettingsReturn",getRootElement(),settings) end addEventHandler("onPlayerChat",getRootElement(),sendMessageToClient) addEvent("onAskForBubbleSettings",true) addEventHandler("onAskForBubbleSettings",getRootElement(),returnSettings) Local chat: Server side chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","Local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","Local") end end) 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) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[Local] "..nick..": "..msg,v,r,g,b,true) end end end addCommandHandler("Local",onChat)
  15. Try this --Client side function applyMods() local skin = engineLoadTXD("files/tec9mod.txd", true) engineImportTXD(skin, 352) local skin = engineLoadDFF("files/tec9mod.dff", 352) engineReplaceModel(skin, 352) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), applyMods)
  16. Good Map Bro this is cool map sent me download link via PM
  17. K4stic

    [SOLVED]

    Wrong Section to request HELP
  18. K4stic

    [HELP] Cruise

    Problem: then i use the Cruise it's set in one sec the speed i set and no works the brake and handbrake what i need: to be work the brake and handbrake and to get the speed who i set as normal then you drive vehicle --Client side -- change it to false to allow all vehicles to use cruise control (seems stupid for bmx etc) limit = true key = "c" allowedTypes = { "Automobile", "Bike", "Boat", "Train", "Helicopter", "BMX", "Quad" } function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true else return false end end function in_array(e, t) for _,v in pairs(t) do if (v==e) then return true end end return false end function round2(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end function angle(vehicle) local vx,vy,vz = getElementVelocity(vehicle) local modV = math.sqrt(vx*vx + vy*vy) if not isVehicleOnGround(vehicle) then return 0,modV end local rx,ry,rz = getElementRotation(vehicle) local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz)) -- if modV <= 0.2 then return 0,modV end --speed over 40 km/h local cosX = (sn*vx + cs*vy)/modV --if cosX > 0.966 or cosX < 0 then return 0,modV end --angle between 15 and 90 degrees return math.deg(math.acos(cosX))*0.5, modV end lp = getLocalPlayer() ccEnabled = false myveh = false targetSpeed = 1 multiplier = 1 function cc() if (not isElement(myveh)) then removeEventHandler("onClientRender", getRootElement(), cc) ccEnabled=false outputChatBox("** Cruise Control #ff0000disabled", 255,255,255,true) return false end local x,y = angle(myveh) -- outputChatBox(x) if (x<15) then local speed = getElementSpeed(myveh) local targetSpeedTmp = speed + multiplier if (targetSpeedTmp > targetSpeed) then targetSpeedTmp = targetSpeed end if (targetSpeedTmp > 3) then setElementSpeed(myveh, "k", targetSpeedTmp) end end end bindKey(key, "up", function() local veh = getPedOccupiedVehicle(lp) if (veh) then if (lp==getVehicleOccupant(veh)) then myveh = veh if (ccEnabled) then removeEventHandler("onClientRender", getRootElement(), cc) ccEnabled=false outputChatBox("** Cruise Control #ff0000disabled", 255,255,255,true) else targetSpeed = getElementSpeed(veh) if targetSpeed > 4 then if (limit) then if in_array(getVehicleType(veh), allowedTypes) then targetSpeed = round2(targetSpeed) outputChatBox("** Cruise Control #00ff00enabled at #ffff00"..targetSpeed.."km/h", 255,255,255,true) addEventHandler("onClientRender", getRootElement(), cc) ccEnabled=true end else targetSpeed = round2(targetSpeed) outputChatBox("** Cruise Control #00ff00enabled #ffffff at #ffff00"..targetSpeed.."km/h", 255,255,255,true) addEventHandler("onClientRender", getRootElement(), cc) ccEnabled=true end end end end end end) addEventHandler("onClientPlayerVehicleExit", getLocalPlayer(), function(veh, seat) if (seat==0) then if (ccEnabled) then removeEventHandler("onClientRender", getRootElement(), cc) ccEnabled=false outputChatBox("** Cruise Control #ff0000disabled", 255,255,255,true) end end end)
  19. ok local money = math.random ( 100, 400 ) givePlayerMoney ( source, money ) -- this is to get money then finnish the job if getElementHealth(vehicle) >= 990 then givePlayerMoney ( source, 50 ) -- and this is if have 990 and up vehicle health(The Bonus)
  20. yes get money but the bonus this is code for bonus => if getElementHealth(vehicle) > 990 then givePlayerMoney ( source, 50 )
  21. thx i will try it but say at line 17 i won if the vehicle 990 health and up to output the massage but if not 990 and up to not output it
×
×
  • Create New...