Jump to content

Ayuda con panel de compras


Sticmy

Recommended Posts

hola amigos estuve haciendo un panel de compra y quería hacer que para comprar necesita tener 1500$ de vida hice la función todo pero da error Código:

function ComproVida50 (thePlayer) 
    local dinero = getPlayerMoney(thePlayer)                                -- get the amount of money from the player who entered the command 
    if (dinero > 1500) then 
        outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", thePlayer, 0, 255, 0) 
    else 
        takePlayerMoney(thePlayer, 1500) 
        outputChatBox("Has comprado 50% de vida.", thePlayer, 255, 0, 0) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", resourceRoot, ComproVida50 ) 

Me ayudaría a resolver eso y el error acá dejo una foto: http://i.imgur.com/8qE1bAM.png

Link to comment
  • Administrators

Si, pero postea esa parte del código ya que el error viene desde el trigger.

Sino usa esto:

function ComproVida50 () 
    local dinero = getPlayerMoney(client)                                -- get the amount of money from the player who entered the command 
    if (dinero > 1500) then 
        outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", client, 0, 255, 0) 
    else 
        takePlayerMoney(client, 1500) 
        outputChatBox("Has comprado 50% de vida.", client, 255, 0, 0) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, ComproVida50 ) 

Link to comment
function ComprasxD() 
if ( source == comprar ) then 
    local row = guiGridListGetSelectedItem( lista_de_compras ) 
    local nombre = guiGridListGetItemText( lista_de_compras, row, listas_compras) 
    if nombre == "Vida 50%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 50%!.")   
        triggerServerEvent ( "onGreeting", resourceRoot ) 
end 
    if nombre == "Vida 100%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 100%!.")     
end 
    if nombre == "Chaleco 50%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 50%!.")     
end 
    if nombre == "Chaleco 100%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 100%!.")     
end 
end 
end 
addEventHandler("onClientGUIClick", root, ComprasxD) 

Link to comment
  • Administrators

Client:

function ComprasxD() 
if ( source == comprar ) then 
    local row = guiGridListGetSelectedItem( lista_de_compras ) 
    local nombre = guiGridListGetItemText( lista_de_compras, row, listas_compras) 
    if nombre == "Vida 50%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 50%!.")   
        triggerServerEvent ( "onGreeting", getLocalPlayer() ) 
end 
    if nombre == "Vida 100%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando vida de 100%!.")     
end 
    if nombre == "Chaleco 50%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 50%!.")     
end 
    if nombre == "Chaleco 100%" then 
        guiSetText(label_variable, "Tendrás que esperar 15 segundos para seguir comprando chaleco de 100%!.")     
end 
end 
end 
addEventHandler("onClientGUIClick", root, ComprasxD) 

Server:

function ComproVida50 () 
    local dinero = getPlayerMoney(client)                                -- get the amount of money from the player who entered the command 
    if (dinero > 1500) then 
        outputChatBox("No tienes suficiente dinero para comprar 50% de vida.", source, 0, 255, 0) 
    else 
        takePlayerMoney(client, 1500) 
        outputChatBox("Has comprado 50% de vida.", source, 255, 0, 0) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, ComproVida50 ) 

Link to comment
  • Recently Browsing   0 members

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