Jump to content

Necesito ayuda con un resource de gimnacio


Recommended Posts

Tengo un recurso de gimnasio pero no me funciona, este consiste en aprender técnicas de combate como la 4 o la 7 u otras. intente poner un comando de /buy para comprar cada una de estas tecnicas

--gimnacio 
function FightstyleColshape () 
  theGymCol = createColTube (768.15, -36.82, 980, 30, 75) 
end 
addEventHandler ("onResourceStart", getRootElement(), FightstyleColshape) 
  
function FightstyleShop( hitElement, matchingdimension ) 
  if ( source == theGymCol ) then 
    outputChatBox ("Comprar un estilo de lucha.", hitElement, 140, 0, 140) 
    outputChatBox ("1 - 0$ - standard", hitElement, 140, 0, 140) 
    outputChatBox ("2 - 50$ - elbows", hitElement, 140, 0, 140) 
    outputChatBox ("3 - 100$ - grab and kick", hitElement, 140, 0, 140) 
    outputChatBox ("4 - 500$ - box-style", hitElement, 140, 0, 140) 
    outputChatBox ("5 - 750$ - kung-fu style", hitElement, 140, 0, 140) 
    outputChatBox ("6 - 2000$ - knee at head", hitElement, 140, 0, 140) 
    outputChatBox ("/buy (number) to buy.", hitElement, 140, 0, 140) 
    function buyitCommand ( thePlayer, command, number ) 
      if (number == 1) then 
        setPedFightingStyle (thePlayer, 4) 
        outputChatBox ("Estilo estandar cuesta - 0$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 0 ) 
      end 
      if (number == 2) then 
        setPedFightingStyle (thePlayer, 16) 
        outputChatBox ("You've bought the elbows fightingstyle - 50$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 50 ) 
      end 
      if (number == 3) then 
        setPedFightingStyle (thePlayer, 15) 
        outputChatBox ("You've bought the grab and kick fightingstyle - 100$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 100 ) 
      end 
      if (number == 4) then 
        setPedFightingStyle (thePlayer, 5) 
        outputChatBox ("You've bought the boxing fightingstyle - 500$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 500 ) 
      end 
      if (number == 5) then 
        setPedFightingStyle (thePlayer, 6) 
        outputChatBox ("You've bought the kung fu fightingstyle - 750$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 750 ) 
      end 
      if (number == 6) then 
        setPedFightingStyle (thePlayer, 7) 
        outputChatBox ("You've bought the knee at head fightingstyle - 2000$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 2000 ) 
      end 
    end 
    addCommandHandler ("buy", buyitCommand) 
  end 
end 
addEventHandler ("onColShapeHit", getRootElement(), FightstyleShop) 
  
function commandAway ( leaveElement, matchingDimension ) 
  if ( source == theGymCol ) then 
    removeCommandHandler ("buy") 
    outputChatBox ("OMG! Wroc pozniej", leaveElement, 140, 0, 140) 
  end 
end 
addEventHandler ("onColShapeLeave", getRootElement(), commandAway) 

Edited by Guest
Link to comment

Intenta asi

--gimnacio 
function FightstyleColshape () 
  theGymCol = createColTube (768.15, -36.82, 980, 30, 75) 
end 
addEventHandler ("onResourceStart", getRootElement(), FightstyleColshape) 
  
function FightstyleShop( hitElement, matchingdimension ) 
  if ( source == theGymCol ) then 
    outputChatBox ("Comprar un estilo de lucha.", hitElement, 140, 0, 140) 
    outputChatBox ("1 - 0$ - standard", hitElement, 140, 0, 140) 
    outputChatBox ("2 - 50$ - elbows", hitElement, 140, 0, 140) 
    outputChatBox ("3 - 100$ - grab and kick", hitElement, 140, 0, 140) 
    outputChatBox ("4 - 500$ - box-style", hitElement, 140, 0, 140) 
    outputChatBox ("5 - 750$ - kung-fu style", hitElement, 140, 0, 140) 
    outputChatBox ("6 - 2000$ - knee at head", hitElement, 140, 0, 140) 
    outputChatBox ("/buy (number) to buy.", hitElement, 140, 0, 140) 
    end 
    end 
    addEventHandler ("onColShapeHit", getRootElement(), FightstyleShop) 
     
    function buyitCommand ( thePlayer, command, number ) 
      if (number == 1) then 
        setPedFightingStyle (thePlayer, 4) 
        outputChatBox ("Estilo estandar cuesta - 0$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 0 ) 
    
      elseif (number == 2) then 
        setPedFightingStyle (thePlayer, 16) 
        outputChatBox ("You've bought the elbows fightingstyle - 50$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 50 ) 
       
      elseif (number == 3) then 
        setPedFightingStyle (thePlayer, 15) 
        outputChatBox ("You've bought the grab and kick fightingstyle - 100$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 100 ) 
       
      elseif (number == 4) then 
        setPedFightingStyle (thePlayer, 5) 
        outputChatBox ("You've bought the boxing fightingstyle - 500$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 500 ) 
       
      elseif (number == 5) then 
        setPedFightingStyle (thePlayer, 6) 
        outputChatBox ("You've bought the kung fu fightingstyle - 750$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 750 ) 
       
      elseif (number == 6) then 
        setPedFightingStyle (thePlayer, 7) 
        outputChatBox ("You've bought the knee at head fightingstyle - 2000$", thePlayer, 140, 0, 140) 
        takePlayerMoney ( thePlayer, 2000 ) 
    end 
     
  end 
addCommandHandler ("buy", buyitCommand) 
  
function commandAway ( leaveElement, matchingDimension ) 
  if ( source == theGymCol ) then 
    removeCommandHandler ("buy") 
    outputChatBox ("OMG! Wroc pozniej", leaveElement, 140, 0, 140) 
  end 
end 
addEventHandler ("onColShapeLeave", getRootElement(), commandAway) 

Link to comment
Hola, disculpa que te moleste, pero te pido por favor que la próxima vez cuando crees un thread pongas un titulo MAS DESCRIPTIVO que Ayuda D:, con el fin de que te podamos ayudar :)

Tambien agregar que no solo debes "decir que el script no funciona". Pone mas detalles, tales como errores en el debug, o decir que es lo que especificamente no funciona. No sirve de nada postear 40 lineas de codigo si no especificas.

Link to comment
Hola, disculpa que te moleste, pero te pido por favor que la próxima vez cuando crees un thread pongas un titulo MAS DESCRIPTIVO que Ayuda D:, con el fin de que te podamos ayudar :)

Tambien agregar que no solo debes "decir que el script no funciona". Pone mas detalles, tales como errores en el debug, o decir que es lo que especificamente no funciona. No sirve de nada postear 40 lineas de codigo si no especificas.

Me has sacado las palabras de la boca 8)

Link to comment

Estas agregando el Command Handler adentro de la función campeón adentro de una funcion. Tenés que ponerlo afuera.

En el caso de fran hay un pequeño error, el numero se recibe como String, y falta la conversión a numero.

Agrega ni bien comienza la funcion del commandHandler un number = tonumber(number).

Link to comment
  • Recently Browsing   0 members

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