#Dv^ Posted June 12, 2016 Posted June 12, 2016 Hola! Hice un panel para comprar vehículos, el problema es cuando lo compran obtienen el vehículo, pero cuando mueren vuelven a obtener el dinero que tenían antes y comprar el vehiculo de nuevo ¿Cómo arreglo eso?Es decir que no recuperen el dinero despues de haber comprado el vehiculo, si tenían $100.000 y gastaron $80.000, se quedaran restantes $20.000, y cuando mueran, no vuelvan a recuperar lo que tenian antes de comprar el vehículo, sino que les salga al chat que necesitan dinero para comprar Muchas Gracias. GUIEditor = { label = {} } panel = guiCreateWindow(322, 205, 569, 285, "Panel de Vehículos by: Vido~># 1.0", false) guiWindowSetSizable(panel, false) hunter = guiCreateButton(41, 53, 152, 41, "$90.000", false, panel) tanque = guiCreateButton(41, 164, 152, 41, "$150.000", false, panel) hydra = guiCreateButton(368, 53, 152, 41, "$100.000", false, panel) at400 = guiCreateButton(368, 164, 152, 41, "$50.000", false, panel) cerrar = guiCreateButton(203, 234, 152, 41, "Cerrar", false, panel) guiSetProperty(cerrar, "NormalTextColour", "FFFE0000") GUIEditor.label[1] = guiCreateLabel(92, 38, 157, 15, "Hunter", false, panel) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(426, 38, 133, 21, "Hydra", false, panel) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.label[3] = guiCreateLabel(94, 149, 141, 15, "Tanque", false, panel) guiSetFont(GUIEditor.label[3], "default-bold-small") GUIEditor.label[4] = guiCreateLabel(425, 149, 134, 15, "AT-400", false, panel) guiSetFont(GUIEditor.label[4], "default-bold-small") ----------------------------------------------------------------- guiSetVisible(panel, false) function abrirocerrar() if (guiGetVisible(panel) == false) then guiSetVisible(panel, true) showCursor(true) else guiSetVisible(panel, false) showCursor(false) end end bindKey("F5", "down", abrirocerrar) function cerrarboton() guiSetVisible(panel, false) showCursor(false) end addEventHandler("onClientGUIClick", cerrar, cerrarboton, false) function hunter1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position createVehicle ( 425, x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Hunter", 255, 0, 0) takePlayerMoney ( 80000) end addEventHandler ("onClientGUIClick", hunter, hunter1,false) function hydra1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position createVehicle ( 520, x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Hydra", 255, 0, 0) takePlayerMoney ( 80000 ) end addEventHandler ("onClientGUIClick", hydra, hydra1,false) function tanque1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position createVehicle ( 432, x + 10 , y , z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Tanque", 255, 0, 0) takePlayerMoney ( 800000 ) end addEventHandler ("onClientGUIClick", tanque, tanque1,false) function at4000() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position createVehicle ( 577 , x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un AT-400", 255, 0, 0) takePlayerMoney ( 800000 ) end addEventHandler ("onClientGUIClick", at400, at4000,false)
PDMTA Posted June 13, 2016 Posted June 13, 2016 GUIEditor = { label = {} } panel = guiCreateWindow(322, 205, 569, 285, "Panel de Vehículos by: Vido~># 1.0", false) guiWindowSetSizable(panel, false) hunter = guiCreateButton(41, 53, 152, 41, "$90.000", false, panel) tanque = guiCreateButton(41, 164, 152, 41, "$150.000", false, panel) hydra = guiCreateButton(368, 53, 152, 41, "$100.000", false, panel) at400 = guiCreateButton(368, 164, 152, 41, "$50.000", false, panel) cerrar = guiCreateButton(203, 234, 152, 41, "Cerrar", false, panel) guiSetProperty(cerrar, "NormalTextColour", "FFFE0000") GUIEditor.label[1] = guiCreateLabel(92, 38, 157, 15, "Hunter", false, panel) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(426, 38, 133, 21, "Hydra", false, panel) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.label[3] = guiCreateLabel(94, 149, 141, 15, "Tanque", false, panel) guiSetFont(GUIEditor.label[3], "default-bold-small") GUIEditor.label[4] = guiCreateLabel(425, 149, 134, 15, "AT-400", false, panel) guiSetFont(GUIEditor.label[4], "default-bold-small") ----------------------------------------------------------------- guiSetVisible(panel, false) function abrirocerrar() if (guiGetVisible(panel) == false) then guiSetVisible(panel, true) showCursor(true) else guiSetVisible(panel, false) showCursor(false) end end bindKey("F5", "down", abrirocerrar) function cerrarboton() guiSetVisible(panel, false) showCursor(false) end addEventHandler("onClientGUIClick", cerrar, cerrarboton, false) function hunter1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position if getPlayerMoney( getLocalPlayer ) >= 80000 then createVehicle ( 425, x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Hunter", 255, 0, 0) takePlayerMoney ( 80000) end end addEventHandler ("onClientGUIClick", hunter, hunter1,false) function hydra1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position if getPlayerMoney( getLocalPlayer ) >= 80000 then createVehicle ( 520, x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Hydra", 255, 0, 0) takePlayerMoney ( 80000 ) end end addEventHandler ("onClientGUIClick", hydra, hydra1,false) function tanque1() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position if getPlayerMoney( getLocalPlayer ) >= 800000 then createVehicle ( 432, x + 10 , y , z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un Tanque", 255, 0, 0) takePlayerMoney ( 800000 ) end end addEventHandler ("onClientGUIClick", tanque, tanque1,false) function at4000() local luckyBugger = getLocalPlayer() -- get the local player local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position if getPlayerMoney( getLocalPlayer ) >= 800000 then createVehicle ( 577 , x , y + 10, z ) -- create the tank 10 units above them outputChatBox ( "Has obtenido un AT-400", 255, 0, 0) takePlayerMoney ( 800000 ) end end addEventHandler ("onClientGUIClick", at400, at4000,false) Ya lo testee y funciona bien, solo era agregar getPlayerMoney Suerte.
#Dv^ Posted June 13, 2016 Author Posted June 13, 2016 Pero a los vehiculos no me puedo subir y tampoco los demás players pueden verlo, solo yo ._.
aka Blue Posted June 13, 2016 Posted June 13, 2016 Porque lo has creado en cliente. Haz un trigger al servidor, creando el vehículo.
#Dv^ Posted June 13, 2016 Author Posted June 13, 2016 Gracias, ya lo hice y funciona pero lo hice por medios de comandos Y otra pregunta, hice otro panel pero que estable esto function estilo100() setPedWalkingStyle(localPlayer,133) outputChatBox("#2971D5[#4E5861ES#2971D5]#FFFFFFAhora caminas como las Prostitutas.", 255, 1, 1, true) end addEventHandler("onClientGUIClick", estilo10, estilo100, false) tendría que tambien pasarlo al servidor? Por que solo el player puedo ver como camina mientras que los demás lo ven normal Te lo agradezco
aka Blue Posted June 13, 2016 Posted June 13, 2016 Si, pásalo también a servidor mediante un trigger.
Bc# Posted June 14, 2016 Posted June 14, 2016 no pude evitar pensar que estas haciendo una funcion para cada estilo cuando vi esto: function estilo100() Si es asi, te convendria usar un argumento en la funcion y usar varias veces la misma. Ya que ese es el uso mas optimo de las funciones, sino solo haces un if y listo.
Recommended Posts