Jump to content

[Ayuda] BanPlayer con Scrip


Narutimmy

Recommended Posts

Posted

Hola bueno Asus iso este scrip para que cuando sus vidas lleguen a 0 sean banneados, el problema es que un user llego a las 0 y no fue banneado ni nada, el scrip tiene permisosde Admin.

local g_root = getRootElement() 
  
addEventHandler( "onPlayerWasted", g_root, 
function(ammo, attacker, weapon, bodypart) 
    if attacker then 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-1) 
        setElementData(attacker, "Vidas", getElementData(attacker, "Vidas")+1) 
    else 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-2) 
    end 
end 
) 
  
  
function Login(antes, ahora) 
      if ahora then 
            local PlayerVida = getAccountData(ahora, "Vidas.Vida") 
            if PlayerVida == false then 
                setElementData(source, "Vidas", 100) 
            else 
                setElementData(source, "Vidas", PlayerVida or 100) 
            end 
            Vida = getElementData(source, "Vidas") 
            if Vida == 0 then 
                banPlayer(source,  false, false, true, getRootElement ( ), "Fuiste baneado por quedarte sin vidas." ) 
            end 
      end 
end 
addEventHandler("onPlayerLogin", getRootElement(), Login) 
  
function onPlayerQuit() 
      local playerAccount = getPlayerAccount(source) 
      if (playerAccount) then 
            local PlayerVida = getElementData(source, "Vidas") 
            setAccountData(playerAccount, "Vidas.Vida", PlayerVida) 
      end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) 
  
function loggedOut(thePreviousAccount) 
    if (thePreviousAccount) then 
        local PlayerVida = getElementData(source, "Vidas") 
        setAccountData(thePreviousAccount, "Vidas.Vida", PlayerVida) 
         
        setElementData(source, "Vidas", "Guest") 
      end 
end 
addEventHandler("onPlayerLogout",getRootElement(),loggedOut) 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Algun error en el debug?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Algun error en el debug?

Ninguno, ademas asus no me dijo como establecer las vidas el se puseo 200 y luego 1 y asi para hacer pruebas, ocupo eso para aserlas.

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Fijate si de verdad se esta ejecutando el codigo despues de:

if Vida == 0 then 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Fijate si de verdad se esta ejecutando el codigo despues de:
if Vida == 0 then 

lo que pasa es que creo se ejecuta la proxima vez que ases login, y quiero que sea en el momento de llegar a 0

Como puedo ponerme mas o menos vidas?

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Y si lo pongo asi?

addEventHandler( "onPlayerWasted", g_root, 
function(ammo, attacker, weapon, bodypart) 
    if attacker then 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-1) 
        setElementData(attacker, "Vidas", getElementData(attacker, "Vidas")+1) 
    else 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-2) 
    end 
     Vida = getElementData(source, "Vidas") 
            if Vida == 0 then 
                banPlayer(source,  false, false, true, getRootElement ( ), "Fuiste baneado por quedarte sin vidas." ) 
            end 
end 
) 

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Fijate si "Vida" es igual a 0.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
addEventHandler( "onPlayerWasted", g_root, 
function(ammo, attacker, weapon, bodypart) 
    if attacker then 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-1) 
        setElementData(attacker, "Vidas", getElementData(attacker, "Vidas")+1) 
    else 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-2) 
    end 
     Vida = getElementData(source, "Vidas") 
            if Vida ~= 0 then 
                banPlayer(source,  false, false, true, getRootElement ( ), "Fuiste baneado por quedarte sin vidas." ) 
            end 
end 
) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Eso baneara al jugador si la vidas no son 0, busca que es "~=" en Lua.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
addEventHandler( "onPlayerWasted", root, 
function(ammo, attacker, weapon, bodypart) 
    if attacker then 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-1) 
        setElementData(attacker, "Vidas", getElementData(attacker, "Vidas")+1) 
    else 
        setElementData(source, "Vidas", getElementData(source, "Vidas")-2) 
    end 
     Vida = getElementData(source, "Vidas") 
            if Vida < 0 then 
                banPlayer(source,  false, false, true, getRootElement ( ), "Fuiste baneado por quedarte sin vidas." ) 
            end 
end 
) 

Quizá tenia una vida, murió sin 'attacker' y su vida quedo en -1, lo que es distinto a 0.

PD: Recuerda tener definido desde antes su vida, sino getElementData( source, "Vidas") seria 'false'.

Edited by Guest

Developer @ MYVAL

Posted

">" es mayor a, "<" es menor a.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Deberia ser mejor:

if Vida <= 0 then 

Asi verifica si las vidas son 0 o menores que 0.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Deberia ser mejor:
if Vida <= 0 then 

Asi verifica si las vidas son 0 o menores que 0.

aaa Gracias jeje vere que todo funcione bien.

mtasa://66.85.14.178:22003

350x20_FFFFFF_FFFFFF_000000_000000.png

Ts3: thezombiworld.com:7777

350x20_FFFFFF_FFFFFF_000000_000000.png

  • Recently Browsing   0 members

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