Jump to content

(Ayuda) Problema con Ban Player (hasObjectPermissionTo)


Sergioks

Recommended Posts

Hola! Tengo 1 Problema xD. Quiero Crear un Punish Panel para un proyecto que estoy haciendo.

Cuando Quiero Banear a un usuario me salta un error con el hasObjectPermissionTo. Aqui mis lua's

Client - Side:

function Banear() 
showCursor ( true ) 
local reason = guiGetText ( GUIEditor.edit[1] ) 
local punished = guiGetText ( GUIEditor.gridlist[1] ) 
local timePunish = guiGetText ( GUIEditor.gridlist[2] ) 
triggerServerEvent("Ban", localPlayer, reason, punished, timePunish) 
end 

Server - Side:

addEvent("Ban", true ) 
addEventHandler("Ban", root, 
function (reason, punished, timePunish, theClient) 
  
    if ( hasObjectPermissionTo ( theClient, "function.banPlayer" ) ) then 
  
        local bannedPlayer = getPlayerFromName ( punished ) 
  
  
        banPlayer ( bannedPlayer, theClient, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "" .. punished .. " Fue Baneado Por ".. timePunish .." (Razon: ".. reason ..".", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( theClient, "info","El Usuario " .. punished .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .. "." ) 
  
     
        exports["notifications"]:showBox ( theClient, "error","Usted No Posee Los Permisos para Banear!!" ) 
    end 
  
end 
end 
  
) 

Lo que me salta en la consola cuando doy click en el boton "banear"

WARNING: Server.lua:55: Bad Arguments @ 'hasObjectPermissionTo' 

¿Que Me Falta hacer? o que error tube?

- Gracias por leer

Link to comment
addEvent("Ban", true ) 
addEventHandler("Ban", root, 
function (reason, punished, timePunish, theClient) 
  
    if ( hasObjectPermissionTo ( client, "function.banPlayer" ) ) then 
  
  
        banPlayer ( punished, client, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "" .. punished .. " Fue Baneado Por ".. timePunish .." (Razon: ".. reason ..".", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( theClient, "info","El Usuario " .. punished .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .. "." ) 
  
    
        exports["notifications"]:showBox ( theClient, "error","Usted No Posee Los Permisos para Banear!!" ) 
    end 
  
end 
end 
  
) 

Link to comment
  • MTA Team

@Pekio te falto sacar theClient de los argumentos :)

  
addEvent("Ban", true ) 
addEventHandler("Ban", root, 
function (reason, punished, timePunish) 
  
    if ( hasObjectPermissionTo ( client, "function.banPlayer" ) ) then 
  
  
        banPlayer ( punished, client, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "" .. punished .. " Fue Baneado Por ".. timePunish .." (Razon: ".. reason ..".", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( theClient, "info","El Usuario " .. punished .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .. "." ) 
  
    
        exports["notifications"]:showBox ( theClient, "error","Usted No Posee Los Permisos para Banear!!" ) 
    end 
  
end 
end 
  
) 
  

Link to comment
@Pekio te falto sacar theClient de los argumentos :)
  
addEvent("Ban", true ) 
addEventHandler("Ban", root, 
function (reason, punished, timePunish) 
  
    if ( hasObjectPermissionTo ( client, "function.banPlayer" ) ) then 
  
  
        banPlayer ( punished, client, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "" .. punished .. " Fue Baneado Por ".. timePunish .." (Razon: ".. reason ..".", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( theClient, "info","El Usuario " .. punished .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .. "." ) 
  
    
        exports["notifications"]:showBox ( theClient, "error","Usted No Posee Los Permisos para Banear!!" ) 
    end 
  
end 
end 
  
) 
  

Removiste 'theClient' de los argumentos, sin embargo, lo utilizas en la linea 12 y en la linea 15.

Link to comment
@Pekio te falto sacar theClient de los argumentos :)
  
addEvent("Ban", true ) 
addEventHandler("Ban", root, 
function (reason, punished, timePunish) 
  
    if ( hasObjectPermissionTo ( client, "function.banPlayer" ) ) then 
  
  
        banPlayer ( punished, client, reason ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        outputChatBox ( "" .. punished .. " Fue Baneado Por ".. timePunish .." (Razon: ".. reason ..".", player, 255, 0, 0, true ) 
        exports["notifications"]:showBox ( theClient, "info","El Usuario " .. punished .. " Ha Sido Baneado Exitosamente!!\n\nRazon: " .. reason .. "." ) 
  
    
        exports["notifications"]:showBox ( theClient, "error","Usted No Posee Los Permisos para Banear!!" ) 
    end 
  
end 
end 
  
) 
  

Removiste 'theClient' de los argumentos, sin embargo, lo utilizas en la linea 12 y en la linea 15.

Como es el correcto?

porque poniendo ese, y arreglando lo de "TheClient" y cambiandolo por "Client" como dice por alli, Me Dice:

Server.lua:8: Access Denied @ "banPlayer" 

Link to comment
  • Recently Browsing   0 members

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