Jump to content

Al3grab

Members
  • Posts

    431
  • Joined

Everything posted by Al3grab

  1. Hi , today in my friend's server someone joined the server and spammed it by changing his nick each second , he made the server lags the players in server was 78 and they got timed out and the player became to 20 ! , and here is a picture for the console i think we need something like anti change nick spam
  2. Al3grab

    Heartbeat

    so you want it repeated ?
  3. Al3grab

    Heartbeat

    yeah thanks for correcting it it wont be repeated until the player dies it will play again if his damage less than 10 , and go on
  4. Al3grab

    Heartbeat

    like this it wont play 2 times function lowHealth() if low == true then return end if getElementHealth ( source ) <= 10 then low = true else loa = false end if low == true then playSound("sounds/heart.mp3",false) end end addEventHandler ( "onClientPlayerDamage", localPlayer, lowHealth ) addEventHandler ( "onClientPlayerWasted", localPlayer, function() low = false end )
  5. bindKey getElementsByType setElementAlpha
  6. If you tried it and it works fine on you, mind giving us something to work on? How are we going to solve this without any help. Scripting forum is for help, not to say that you know the answer and you're not going to share it until we solve it with nothing to work with. i used the example that Evil-Cod3r posted and when i reconnect the idle time is reset'ed
  7. @-NxZ-Shick Solid's Solution was better than mine
  8. i tried it , and it works fine for me ! , using latest 1.2 version
  9. * line 7 local playerHealth = getElementHealth ( getLocalPlayer() ) should be local playerHealth = getElementHealth ( hitPlayer )
  10. oh , i haven't seen this function before
  11. getPlayerName getPlayerTeam getElementHealth
  12. Al3grab

    Push script

    SetElementVelocity wont work alone , i suggest to use getElementSpeed+setElementSpeed from Useful functions : https://wiki.multitheftauto.com/wiki/SetElementSpeed https://wiki.multitheftauto.com/wiki/GetElementSpeed function push (thePlayer, commandName, namepart) if hasObjectPermissionTo ( thePlayer, "function.banPlayer",false ) then -- check if he has permissions player = findPlayer(namepart) if not player then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) local push = 60 setElementSpeed ( vehicle,"mph", getElementSpeed(vehicle, "mph") + push ) end end end addCommandHandler("push", push) 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 end return false end 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 findPlayer(name) if not name then return false end local name = name:lower() for i, p in ipairs(getElementsByType("player")) do local fullname = getPlayerName(p):lower() if string.find(fullname:gsub("#%x%x%x%x%x%x", ""), name, 1, true) then return p end end return false end
  13. if you know the first sound length , then you can set timer after the song is finished to play the next one local sound1 = "http://www.mysound1.com/sound1" local sound2 = "http://www.mysound1.com/sound2" addEventHandler("onClientPlayerJoin", getResourceRootElement(getThisResource()), function() playSound(sound1) local sound1Length = 60 -- in seconds setTimer(playSound,sound1Length*1000,1,sound2) end )
  14. you will have to edit the freeroam window then bg = guiCreateStaticImage(...,freeroamWindow) guiMoveToBack(bg )
  15. i see some servers has upgraded to 1.2 i think its better than 1.1 then =D , downloading ..
  16. well, it can be done like this local criminal = createTeam("Criminal", 255, 0, 0) function randomMarker() randomNum = math.random(1,4) if randomNum == 1 then createMarker (0, 0, 20) elseif randomNum == 2 then createMarker (1, 0, 20) elseif randomNum == 3 then createMarker (2, 0, 20) elseif randomNum == 4 then createMarker (3, 0, 20) end end function createAmarker (plr) if getPlayerTeam(plr) == getTeamFromName("Criminal") then randomMarker() end end addEventHandler("onVehicleEnter", getRootElement(), createAmarker)
  17. * line 13 : hitElement should be leaveElement local MarkerPolice = createMarker( 1588.4000244141, -1637, 11.39999961853, 'corona', 12.0, 0, 0, 255, 0) local Policegate1 = createObject(980, 1590.1999511719, -1638.4000244141, 15.199999809265, 0, 0, 0) addCommandHandler("1",function(plr) setElementPosition(plr,1588.4000244141+2, -1637, 11.39999961853 ) end ) function MarkerHit1(hitElement, matchingDimension) if getElementType(hitElement) == "player" then playerTeam = getPlayerTeam(hitElement) if playerTeam then if (playerTeam == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1598.1999511719, -1638.4000244141, 15.199999809265) end end end end function MarkerLeave1(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then playerTeam = getPlayerTeam(leaveElement) if playerTeam then if (getPlayerTeam(leaveElement) == getTeamFromName("Police")) then moveObject(Policegate1, 2000, 1590.1999511719, -1638.4000244141, 15.199999809265) end end end end addEventHandler("onMarkerHit", MarkerPolice, MarkerHit1) addEventHandler("onMarkerLeave", MarkerPolice, MarkerLeave1)
  18. Al3grab

    Help

    addEventHandler("onPlayerQuit",root,function() -- adding on player quit event hisAcc = getPlayerAccount(source) -- get the player account if hisAcc and not isGuestAccount(hisAcc) then -- if he is logged in hisTeam = getPlayerTeam(source) -- get his team if hisTeam then -- if got the team hisTeamName = getTeamName(hisTeam) -- get the team name setAccountData(hisAcc,"team",hisTeamName) -- save the team in value "team" at his account end end end ) addEventHandler("onPlayerLogin",root,function(_,theCurrentAccount) -- adding on player login event hisAcc = theCurrentAccount hisTeamName = getAccountData(hisAcc,"team") -- get the saved value [ team name ] if hisTeamName then -- if got the value hisTeam = getTeamFromName(hisTeamName) -- get the team from the name saved if hisTeam then -- if got the team setPlayerTeam(source,hisTeam) -- set his team to the saved team end end end )
  19. you mean Ghost mode for death match ? : https://community.multitheftauto.com/index.php?p= ... ls&id=3028
  20. Hi , and welcome to MTA ! install it on C:\Program Files or in Desktop , and if that didnt work , check this post : https://forum.multitheftauto.com/viewtop ... 85#p381478
  21. you could make the small marker with 0.5 size
  22. i cant understand you ?
  23. addEvent("nMap",true) -- After Vote Event addEventHandler("nMap",root,function(MapName) startResource(getResourceFromName(MapName)) -- start the resource end ) ----------- addEvent("doOutputChatBox",true) -- outputChatBox Event addEventHandler("doOutputChatBox",root,function(Message,r,g,b) outputChatBox(Message,root,r,g,b) -- outputChatBox message end ) ----------- addEvent("votenext",true) addEventHandler("votenext",root, function(mapname,notEnoughVotesMessage) -- Vote exports.votemanager:startPoll { --- export the vote manager function title="Set nextmap as "..mapname.."?", percentage=75, timeout=30, allowchange=false, maxnominations=3, visibleTo=root, [1]={"Yes", "nMap",plr,mapname}, -- "nMap" is the event we added before , and plr is the baseElement in triggerEvent function , nextmapname is the map name [2]={"No", "doOutputChatBox",plr, notEnoughVotesMessage, 255,0,0; default=true}, -- "doOutputChatBox" is the event we added befor , and plr is the baseElement , message , r , g , b } -- Vote end ) ----------- addCommandHandler("nextmap", function(plr,cmd,...) if plr then nextmapname = table.concat({...}," ") nextMap = nil; local notEnoughVotesMessage = "Not enough votes to set nextmap as "..nextmapname.."." for i,d in ipairs ( getResources() ) do -- get the resource name resName = getResourceName(d) if string.find(nextmapname,resName) then nextMap = resName VoteNext = triggerEvent("votenext",plr,nextmapname,notEnoughVotesMessage) -- "votenext" is event i added to vote end end if VoteNext then -- if got the map outputChatBox("**#FFFF00 Vote Started By : [ "..getPlayerName(plr).." #FFFF00]",root,255,0,0,true) else outputChatBox("**#FFFF00 No Map Exist With That Name !",plr,255,0,0,true) end end end )
×
×
  • Create New...