Jump to content

rozbrojenie wszystkich graczy w obrębie 300 metrów


Recommended Posts

Jak dać wszystkim w obrębie 300 metrów życie rozbroić i dać jedną broń? napisałem narazie takie coś ale nie działa:

addCommandHandler ( "ulecz", 
 function (thePlayer,_,health )  
 local name = getPlayerName(thePlayer) 
 local accName = getAccountName ( getPlayerAccount ( thePlayer ) )  
 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then  
 givePlayerHealth (getRootElement(),health) 
 outputChatBox ( "#5555FFThe #00FF00Admin #5555FF" .. name .. "#00FF00 Postanowil/a #5555FFwszystkich #00FF00graczy #5555FFuzdrowic #00FF00".. health .."#5555FFhp", getRootElement(), 255, 0, 0, true ) 
 end 
 end ) 
  

Link to comment

da się, ale masz złą metodę nauki. krok po kroku, a nie na zasadzie "skopiuję coś, czego i tak nie rozumiem, potem pozmieniam coś, choć nie mam pojęcia co, i będę liczyć, że zadziała, albo ktoś zrobi za mnie". a więc małymi kroczkami od podstaw. to jest droga do sukcesu i tego nie da się przeskoczyć

Link to comment
  • 3 weeks later...

Skorzystaj z tego przykładu, myślę że jest dość czytelny i nie wymaga komentarza. Pochodzi z serwera BestPlay.

  
addCommandHandler("daall", function(plr,cmd,odleglosc) 
--  if not isRCON(plr) then return end 
    odleglosc=tonumber(odleglosc) 
    if (not odleglosc or odleglosc<1 or odleglosc>10000) then 
        outputChatBox("Uzyj: /daall <1-10000> - rozbrajanie graczy w podanym zasiegu", plr) 
        return 
    end 
  
    local x,y,z=getElementPosition(plr) 
    local col=createColSphere(x,y,z,odleglosc) 
    local el=getElementsWithinColShape(col,"player") 
  
    if (#el<=1) then 
        outputChatBox("Nie ma nikogo w poblizu",plr) 
        return 
    end 
  
    for k,v in ipairs(el) do 
        outputChatBox(getPlayerName(plr) .. " rozbroił/a wszystkich ", v) 
        takeAllWeapons(v) 
    end 
  
    destroyElement(col) 
end,false,false) 
  

Link to comment

w tes sposób>?

addCommandHandler("bro", function(plr,cmd,odleglosc) 
--  if not isRCON(plr) then return end 
    odleglosc=tonumber(odleglosc) 
    if (not odleglosc or odleglosc<1 or odleglosc>10000) then 
        outputChatBox("Uzyj: /bro <1-10000> - rozdanie broni gracza o podanym zasiegu", plr) 
        return 
    end 
  
    local x,y,z=getElementPosition(plr) 
    local col=createColSphere(x,y,z,odleglosc) 
    local el=getElementsWithinColShape(col,"player") 
  
    if (#el<=1) then 
        outputChatBox("Nie ma nikogo w poblizu",plr) 
        return 
    end 
  
    for k,v in ipairs(el) do 
        outputChatBox(getPlayerName(plr) .. " rozdal/a bron ", v) 
         giveWeapon ( source, 31, 200 )(v) 
    end 
  
    destroyElement(col) 
end,false,false) 

Link to comment
addCommandHandler("daall", function(plr,cmd,odleglosc) 
    odleglosc=tonumber(odleglosc) 
    if (not odleglosc or odleglosc<1 or odleglosc>10000) then 
        outputChatBox("Uzyj: /daall <1-10000> - rozbrajanie graczy w podanym zasiegu", plr) 
        return 
    end 
  
    local x,y,z=getElementPosition(plr) 
    local col=createColSphere(x,y,z,odleglosc) 
    local el=getElementsWithinColShape(col,"player") 
  
    if (#el<=1) then 
        outputChatBox("Nie ma nikogo w poblizu",plr) 
        return 
    end 
  
    for k,v in ipairs(el) do 
        outputChatBox(getPlayerName(plr) .. " dał wszystkim broń ", v) 
        giveWeapon ( v, 31, 200 ) 
    end 
  
    destroyElement(col) 
end,false,false) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...