iFoReX Posted April 14, 2012 Share Posted April 14, 2012 buee como dice en el titulo tengo un problema con el take player money me ayudarian ? al aprietar el boton no le quitan dinero al player cl-side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(0.2324,0.3033,0.4258,0.3617,"GUI Reproductora de Musica",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(41,48,339,19,"Porfavor Pon la URL de la cancion que quieres hacer sonar",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(40,70,373,33,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(312,109,101,43,"Escuchar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,113,287,19,"Para escuchar una cancion necesitas pagar $3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(18,155,62,15,"VOLUMEN",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(16,179,29,27,"+",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(47,179,29,27,"-",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(106,172,73,35,"Pausar",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(184,172,73,35,"Detener",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(277,177,141,16,"GUI Creada POR ELMOTA",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,0,255) guiSetFont(GUIEditor_Label[4],"default-bold-small") --[[ local volume = true --]] local sound = true function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "m", getLocalPlayer() ) if sound == true then local URL = guiGetText ( GUIEditor_Edit[1] ) sp = playSound(URL) outputChatBox ( "Sonido cargandose en Unos Segundos", getLocalPlayer(), 255, 0, 0, true ) outputChatBox ( "La Musica a comenzado !", getLocalPlayer, 255, 0, 0, true ) elseif (source == GUIEditor_Button[5]) then stopSound(sp) outputChatBox ( "La Musica a parado !", getLocalPlayer(), 255, 0, 0, true ) end end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function GuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[2]) then local svol = getSoundVolume(sp)+1 while not setSoundVolume ( sp, svol ) do svol = svol + 1 end elseif (source == GUIEditor_Button[3]) then local svol = getSoundVolume(sp)-1 while not setSoundVolume ( sp, svol ) do svol = svol -1 end end end addEventHandler ("onClientGUIClick", getRootElement(), GuiClick) function show() if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end end bindKey("i","down", show) guiSetVisible(GUIEditor_Window[1],false) showCursor(false) sv-side function qm() local money = getPlayerMoney(thePlayer) if (money > 3000) then takePlayerMoney ( 3000) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end addEvent( "m", true ) addEventHandler( "m", getRootElement(), qm ) Gracias de antemano Link to comment
Castillo Posted April 14, 2012 Share Posted April 14, 2012 function qm ( ) local money = getPlayerMoney ( source ) if ( money >= 3000 ) then takePlayerMoney ( source, 3000 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end addEvent( "m", true ) addEventHandler( "m", getRootElement(), qm ) Tus errores: 1: Estabas usando "thePlayer" en lugar de "source" @ getPlayerMoney. 2: Te habias olviado de poner el argumento de jugador @ takePlayerMoney. Link to comment
iFoReX Posted April 14, 2012 Author Share Posted April 14, 2012 Gracias solid funciona a la perfeccion EDIT: Solid pero no me funciona mi boton de detener la musica Link to comment
iFoReX Posted April 14, 2012 Author Share Posted April 14, 2012 que esta malo ? function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "m", getLocalPlayer() ) if sound == true then local URL = guiGetText ( GUIEditor_Edit[1] ) sp = playSound(URL) outputChatBox ( "Sonido cargandose en Unos Segundos", getLocalPlayer(), 255, 0, 0, true ) outputChatBox ( "La Musica a comenzado !", getLocalPlayer, 255, 0, 0, true ) elseif (source == GUIEditor_Button[5]) then if isElement(sp) then destroyElement(sp) outputChatBox ( "La Musica a parado !", getLocalPlayer(), 255, 0, 0, true ) end end end me dice que tengo un eror en la linea 30 ._. Link to comment
Renkon Posted April 15, 2012 Share Posted April 15, 2012 18 Líneas y error en la 30?. Mañana caen los zombies de The Walking Dead con los SWAT. Na posta, pasá completo el code. Link to comment
Soren Posted April 15, 2012 Share Posted April 15, 2012 Es por que no puso el script completo -.- Link to comment
iFoReX Posted April 15, 2012 Author Share Posted April 15, 2012 aqui ta completo GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(0.2324,0.3033,0.4258,0.3617,"GUI Reproductora de Musica",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(41,48,339,19,"Porfavor Pon la URL de la cancion que quieres hacer sonar",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(40,70,373,33,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(312,109,101,43,"Escuchar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,113,287,19,"Para escuchar una cancion necesitas pagar $3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(18,155,62,15,"VOLUMEN",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(16,179,29,27,"+",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(47,179,29,27,"-",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(106,172,73,35,"Pausar",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(184,172,73,35,"Detener",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(277,177,141,16,"GUI Creada POR ELMOTA",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,0,255) guiSetFont(GUIEditor_Label[4],"default-bold-small") --[[ local volume = true --]] local sound = true function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "m", getLocalPlayer() ) if sound == true then local URL = guiGetText ( GUIEditor_Edit[1] ) sp = playSound(URL) outputChatBox ( "Sonido cargandose en Unos Segundos", getLocalPlayer(), 255, 0, 0, true ) outputChatBox ( "La Musica a comenzado !", getLocalPlayer, 255, 0, 0, true ) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function GuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[2]) then local svol = getSoundVolume(sp)+1 while not setSoundVolume ( sp, svol ) do svol = svol + 1 end elseif (source == GUIEditor_Button[3]) then local svol = getSoundVolume(sp)-1 while not setSoundVolume ( sp, svol ) do svol = svol -1 end end end addEventHandler ("onClientGUIClick", getRootElement(), GuiClick) function show() if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end end bindKey("i","down", show) guiSetVisible(GUIEditor_Window[1],false) showCursor(false) Link to comment
Castillo Posted April 15, 2012 Share Posted April 15, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(0.2324,0.3033,0.4258,0.3617,"GUI Reproductora de Musica",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(41,48,339,19,"Porfavor Pon la URL de la cancion que quieres hacer sonar",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(40,70,373,33,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(312,109,101,43,"Escuchar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,113,287,19,"Para escuchar una cancion necesitas pagar $3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(18,155,62,15,"VOLUMEN",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(16,179,29,27,"+",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(47,179,29,27,"-",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(106,172,73,35,"Pausar",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(184,172,73,35,"Detener",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(277,177,141,16,"GUI Creada POR ELMOTA",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,0,255) guiSetFont(GUIEditor_Label[4],"default-bold-small") guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) --[[ local volume = true --]] local sound = true function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "m", getLocalPlayer() ) if ( sound == true ) then local URL = guiGetText ( GUIEditor_Edit[1] ) sp = playSound(URL) outputChatBox ( "Sonido cargandose en Unos Segundos", getLocalPlayer(), 255, 0, 0, true ) outputChatBox ( "La Musica a comenzado !", getLocalPlayer, 255, 0, 0, true ) end elseif (source == GUIEditor_Button[2]) then local svol = getSoundVolume(sp)+1 while not setSoundVolume ( sp, svol ) do svol = svol + 1 end elseif (source == GUIEditor_Button[3]) then local svol = getSoundVolume(sp)-1 while not setSoundVolume ( sp, svol ) do svol = svol -1 end end end addEventHandler ( "onClientGUIClick", getRootElement(), onGuiClick ) function show ( ) guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) end bindKey ( "i","down", show ) Te faltaba un "end". Link to comment
Alexs Posted April 15, 2012 Share Posted April 15, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(0.2324,0.3033,0.4258,0.3617,"GUI Reproductora de Musica",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(41,48,339,19,"Porfavor Pon la URL de la cancion que quieres hacer sonar",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(40,70,373,33,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(312,109,101,43,"Escuchar",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(17,113,287,19,"Para escuchar una cancion necesitas pagar $3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(18,155,62,15,"VOLUMEN",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(16,179,29,27,"+",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(47,179,29,27,"-",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(106,172,73,35,"Pausar",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(184,172,73,35,"Detener",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(277,177,141,16,"GUI Creada POR ELMOTA",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,0,255) guiSetFont(GUIEditor_Label[4],"default-bold-small") guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) --[[ local volume = true --]] local sound = true function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "m", getLocalPlayer() ) if ( sound == true ) then local URL = guiGetText ( GUIEditor_Edit[1] ) sp = playSound(URL) outputChatBox ( "Sonido cargandose en Unos Segundos", getLocalPlayer(), 255, 0, 0, true ) outputChatBox ( "La Musica a comenzado !", getLocalPlayer, 255, 0, 0, true ) end elseif (source == GUIEditor_Button[2]) then local svol = getSoundVolume(sp)+1 while not setSoundVolume ( sp, svol ) do svol = svol + 1 end elseif (source == GUIEditor_Button[3]) then local svol = getSoundVolume(sp)-1 while not setSoundVolume ( sp, svol ) do svol = svol -1 end end end addEventHandler ( "onClientGUIClick", getRootElement(), onGuiClick ) function show ( ) guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) end bindKey ( "i","down", show ) Te faltaba un "end". es un error curioso, ya que por un end, uno al probarlo la consola deberia avisar, creo que es mejor que pruebe el resource antes de preguntar, por que uno queda de idiota por falta de un "end" OT: Edit: Alguien sabe como hacer esto: viewtopic.php?f=147&t=42431 ando algo apresurado por que el VPS solo dura 14 dias... Link to comment
Recommended Posts