Jump to content

Anubhav

Members
  • Posts

    2,277
  • Joined

  • Last visited

Everything posted by Anubhav

  1. Try using this addEventHandler("onClientPlayerWasted", localPlayer, function() setTimer(function(thePlayer) if isPedDead(thePlayer) then outputChatBox(getPlayerName(thePlayer).." isDead") else outputChatBox(getPlayerName(thePlayer).." isNotDead") end end, 2000, 1, source) )
  2. You edited the post. I was wrong, it should be like this. function deleteTeam(teamName) for i, team in ipairs(getElementsByType('team') do if team == getTeamName(teamName) then destroyElement(team) end end end
  3. Do you even know what is the loop returning?
  4. Whoops din't see the function, sorry!
  5. Dude it will return all team names o-O are you doing? function deleteTeam(teamName) for i, team in ipairs(getElementsByType('team') do if team == teamName then destroyElement(team) end end end
  6. How can you expect it to work lol! function disableSounds() setAmbientSoundEnabled( "gunfire", false ) end addEventHandler("onClientResourceStart",root,disableSounds) local function playGunfireSound() local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) local weaponID = getElementModel(source) if weaponID == 34 then local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) Lol all can't check wiki
  7. Oh god how would it work even? You have a extra end, addEventHandler("onClientPlayerWasted", root, function() setTimer(function(thePlayer) if isPedDead(thePlayer) then outputChatBox(getPlayerName(thePlayer).." isDead") else outputChatBox(getPlayerName(thePlayer).." isNotDead") end end, 2000, 1, source) )
  8. Anubhav

    ACL

    its a server sided function trigger.
  9. Anubhav

    Fines!

    No problem! See your messages!
  10. Explain it properly. Din't get you!
  11. One more function, setSoundMaxDistance
  12. local sw,sh = guiGetScreenSize() local text = nil function errorMessage() if text then dxDrawText(text,sw/2,sh/2,sw/2,sh/2,tocolor(255,255,255,255),1,"bankgothic","center","top",false,false,false,true) else outputDebugString("exportResource: error; no text") return end end function removeErrorMessage() removeEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: render handler removed!") end function addErrorMessage() addEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: handler was added, it will be removed in 5 seconds") setTimer(removeErrorMessage,5000,1) end function commandError(commandName, ...) text = table.concat({...}, " ") if text == "" then return end addErrorMessage() outputDebugString("test:4: Export call was sent.") end addCommandHandler("ctrigger",commandError)
  13. Anubhav

    Fines!

    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 convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function finePlayer(s, cmd, player, money, ...) local acc = getAccountName(getPlayerAccount(s)) local r = table.concat({...}, " ") if r == "" then return outputChatBox("No reason typed!", s) end if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end local p = getPlayerFromPartialName(player) if p then if tonumber(tostring(money)) then takePlayerMoney(p, tonumber(tostring(money))) outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) else outputChatBox("SYNTAX: /fine ", p) end else outputChatBox("No player found with the name!", s) end end addCommandHandler("fine", finePlayer) SYNTAX: /fine plr money reason
  14. Anubhav

    Fines!

    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 convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function finePlayer(s, cmd, player, money, ...) local acc = getAccountName(getPlayerAccount(s)) local r = table.concat({...}, " ") if r == "" then return end if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end local p = getPlayerFromPartialName(player) if player then if tonumber(tostring(money)) then takePlayerMoney(p, tonumber(tostring(money))) outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined $"..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s).. " Reason: "..tostring(r), root, 255, 0, 0) else outputChatBox("SYNTAX: /fine ", p) end else outputChatBox("No player found with the name!", s) end end addCommandHandler("fine", finePlayer)
  15. Anubhav

    Fines!

    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 convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function finePlayer(s, cmd, player, money) local acc = getAccountName(getPlayerAccount(s)) if not isObjectInACLGroup("user."..acc, aclGetGroup("Admin")) then return end local p = getPlayerFromPartialName(player) if player then if tonumber(tostring(money)) then takePlayerMoney(p, tonumber(tostring(money))) outputChatBox("AdmCmd: "..getPlayerName(p).." has been fined "..tostring(convertNumber(tonumber(tostring(money)))).." by "..getPlayerName(s) , root, 255, 0, 0) else outputChatBox("SYNTAX: /fine ", p) end else outputChatBox("No player found with the name!", s) end end addCommandHandler("fine", finePlayer)
  16. local sw,sh = guiGetScreenSize() local text = nil function errorMessage() if text then dxDrawText(text,sw/2,sh/2,sw/2,sh/2,tocolor(255,255,255,255),1,"bankgothic","center","top",false,false,false,true) else outputDebugString("exportResource: error; no text") return end end function removeErrorMessage() removeEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: render handler removed!") end function addErrorMessage() addEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: handler was added, it will be removed in 5 seconds") setTimer(removeErrorMessage,5000,1) end function commandError(commandName,text2) if text2 == false or text2 == nil then return end text = table.concat({text2}, " ") addErrorMessage() outputDebugString("test:4: Export call was sent.") end addCommandHandler("ctrigger",commandError) You could see local chat scripts for this idea.
  17. Use table.concat! Don't let us make the script! Try yourself next time! local sw,sh = guiGetScreenSize() local text = nil function errorMessage() if text then dxDrawText(text,sw/2,sh/2,sw/2,sh/2,tocolor(255,255,255,255),1,"bankgothic","center","top",false,false,false,true) else outputDebugString("exportResource: error; no text") return end end function removeErrorMessage() removeEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: render handler removed!") end function addErrorMessage() addEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: handler was added, it will be removed in 5 seconds") setTimer(removeErrorMessage,5000,1) end function commandError(commandName,text2) if text2 == false or text2 == nil then return end text = table.concat({string.gsub(text2, '#%x%x%x%x%x%x', '')}, " ") addErrorMessage() outputDebugString("test:4: Export call was sent.") end addCommandHandler("ctrigger",commandError)
  18. See . 1. You triggered it ok that time it wouldnt' show. While you rendered it had no arguement so there were no chances of working. You should create variables for these things.
  19. local sw,sh = guiGetScreenSize() local text = nil function errorMessage() if text then dxDrawText(text,sw/2,sh/2,sw/2,sh/2,tocolor(255,255,255,255),1,"bankgothic","center","top",false,false,false,true) else outputDebugString("exportResource: error; no text") return end end function removeErrorMessage() removeEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: render handler removed!") end function addErrorMessage() addEventHandler("onClientRender",root,errorMessage) outputDebugString("exportResource: handler was added, it will be removed in 5 seconds") setTimer(removeErrorMessage,5000,1) end function commandError(commandName,text2) if text2 == false or text2 == nil then return end text = text2 addErrorMessage() outputDebugString("test:4: Export call was sent.") end addCommandHandler("ctrigger",commandError)
×
×
  • Create New...