Jump to content

Me salta error en un argumento


Recommended Posts

Posted
addEventHandler ("onPlayerWasted", getRootElement(),  
function (totalAmmo, killer, killerWeapon, bodypart, stealth) 
  setPlayerWantedLevel (source, 0) 
  if (getPlayerNametagText (source) == "[COP]" .. getPlayerName (source)) then 
    outputChatBox ("* " .. getPlayerName (source) .. " is no cop any more.", getRootElement(), 0, 0, 255, false) 
    setPlayerNametagText (source, getPlayerName (source)) 
  elseif (getElementType(killer) == "player") and (killer) and (killer ~= source) and not (getPlayerNametagText (source) == "[COP]" .. getPlayerName (source)) then 
    setPlayerWantedLevel (killer, getPlayerWantedLevel (killer) +1) 
  elseif (getElementType(killer) == "player") and (killer) and (killer ~= source) and (getPlayerNametagText (source) == "[COP]" .. getPlayerName (source)) then 
    setPlayerWantedLevel (killer, getPlayerWantedLevel (killer) +2) 
  end 
end) 

WARNING: gamemode/policia/server.lua: 7 : bad argument @ ´getElemenType´ [Expected element at argument 1m got bolean]

WARNING: gamemode/policia/server.lua: 9 : bad argument @ ´getElemenType´ [Expected element at argument 1m got bolean]

ese es el error que me aparece. Necesito ayuda por favor, no se que pasa ._.

Posted
Eso es porque estas verificando primero el tipo de argumento, y luego si de verdad existe, hacelo alrevez.

es que me dice que hay un error en la linea 7 y 9. Pero yo no veo ninguno

Posted
No leiste lo que escribi?

Perdón xD, ya se cual es el problema.

El problema es que no existe el argumento "getElemenType" ¿por cual lo puedo suplantar?

Posted

Se ve que no me entendiste.

El problema esta en estas dos lineas:

elseif (getElementType(killer) == "player") and (killer) and (killer ~= source) and not (getPlayerNametagText (source) == "[COP]" .. getPlayerName (source)) then 

elseif (getElementType(killer) == "player") and (killer) and (killer ~= source) and (getPlayerNametagText (source) == "[COP]" .. getPlayerName (source)) then 

vos estas intentando obtener el tipo de elemento del argumento "killer", pero primero tenes que verificar si ese elemento existe, osea que cambias de lugar la primera parte con la segunda parte, asi:

elseif  ( killer and killer ~= source ) and ( getElementType ( killer ) == "player" ) and ( getPlayerNametagText ( source ) ~= "[COP]" .. getPlayerName  ( source ) ) then 

Esa es la linea 7, hace lo mismo con la linea 9.

  • Recently Browsing   0 members

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