Xperia Posted December 6, 2012 Share Posted December 6, 2012 Tengo un hud hecho, y en ese script, en client side, quiero quitarlo, pero al reconectar, el hud vuelve.¿Que le hago? function quitar() showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "ammo", false) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "wanted", false ) showPlayerHudComponent ( "radar", true ) end addEventHandler("onClientResourceStart",getRootElement(),quitar) Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 function quitar ( ) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "ammo", false) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "wanted", false ) showPlayerHudComponent ( "radar", true ) end addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 Porque no ocultas el HUD al mostrar el que creaste? Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 ¿Que lo haga en otro script? Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 (edited) Probalo asi de nuevo. function quitar ( ) showPlayerHudComponent (source, "armour", false ) showPlayerHudComponent (source, "health", false ) showPlayerHudComponent (source, "money", false ) showPlayerHudComponent (source, "clock", false ) showPlayerHudComponent (source, "weapon", false ) showPlayerHudComponent (source, "ammo", false) showPlayerHudComponent (source, "money", false ) showPlayerHudComponent (source, "wanted", false ) showPlayerHudComponent (source, "radar", true ) end addEventHandler ( "onPlayerJoin", getRootElement(), quitar ) Edited December 6, 2012 by Guest Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 ¿Que lo haga en otro script? Al mostrar el HUD que vos creaste, ahi ocultas el de GTA. Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Probalo asi de nuevo. function quitar ( ) showPlayerHudComponent (source, "armour", false ) showPlayerHudComponent (source, "health", false ) showPlayerHudComponent (source, "money", false ) showPlayerHudComponent (source, "clock", false ) showPlayerHudComponent (source, "weapon", false ) showPlayerHudComponent (source, "ammo", false) showPlayerHudComponent (source, "money", false ) showPlayerHudComponent (source, "wanted", false ) showPlayerHudComponent (source, "radar", true ) end addEventHandler ( "onPlayerJoin", getRootElement(), quitar ) Probalo asi ahora. Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 Lo pongo ahi y nada. Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Probalo con "onResourceStart" , ya que "onPlayerJoin" es server-side. Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 Tampoco. PD: Tambien probe "onClientResourceStart". Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Tampoco. Probalo en un script nuevo , con "onPlayerJoin" y en server-side. Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 @Xperia: Probaste con lo que yo te dije? Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 Tampoco. PD: Si Solid. Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Pues , entonces nosé. Yo tengo tambien mi hud y con eso anda bien. Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 Pues , entonces nosé. Yo tengo tambien mi hud y con eso anda bien. ¿En server-side? Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Pues , entonces nosé. Yo tengo tambien mi hud y con eso anda bien. ¿En server-side? Client. Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 Tampoco. PD: Si Solid. Postea tu HUD. Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 function speed ( ) addEventHandler ( "onClientRender", root, getspeed ) end addEventHandler ("onClientVehicleEnter", root, speed) function wylacz ( ) removeEventHandler ( "onClientRender", root, getspeed ) end addEventHandler("onClientVehicleExit", root, wylacz) addEventHandler("onClientRender",getRootElement(), function ( ) weaponID = getPedWeapon(getLocalPlayer()) weapName = getWeaponNameFromID(weaponID) health = getElementHealth (localPlayer) dxDrawText("Player Health: "..tostring(math.floor(health+0.5)).." %",20.0,264.0,296.0,280.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Weapon Name: "..weapName,20.0,285.0,296.0,301.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) if isPedInVehicle (localPlayer) == false then return end Vname = getVehicleName(getPedOccupiedVehicle(localPlayer)) health = getElementHealth (getPedOccupiedVehicle(localPlayer)) sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) dxDrawText("Vehicle Name: "..Vname,20.0,307.0,296.0,323.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Vehicle Health: "..tostring(math.floor(health*0.1)).." %",20.0,328.0,296.0,344.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Speed: "..tostring(kmhs).." Km/h",20.0,348.0,296.0,364.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) end ) function quitar ( ) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "ammo", false) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "wanted", false ) showPlayerHudComponent ( "radar", true ) end addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) EDIT: Uso el spawn de 50p. Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Si usas el spawn de 50p , editaste el "c_main" para que no aparescan los elementos?. Link to comment
Xperia Posted December 6, 2012 Author Share Posted December 6, 2012 Si usas el spawn de 50p , editaste el "c_main" para que no aparescan los elementos?. Este post fue un poco "fail", al parecer lo tenia bien, pense que el spawn de 50p afectaba pero me entro en una oreja y me salio por otra.Igualmente, ya me funciona, gracias Solid y NOD. Link to comment
Castillo Posted December 6, 2012 Share Posted December 6, 2012 function speed ( ) addEventHandler ( "onClientRender", root, getspeed ) end addEventHandler ("onClientVehicleEnter", root, speed) function wylacz ( ) removeEventHandler ( "onClientRender", root, getspeed ) end addEventHandler("onClientVehicleExit", root, wylacz) addEventHandler("onClientRender",getRootElement(), function ( ) weaponID = getPedWeapon(getLocalPlayer()) weapName = getWeaponNameFromID(weaponID) health = getElementHealth (localPlayer) dxDrawText("Player Health: "..tostring(math.floor(health+0.5)).." %",20.0,264.0,296.0,280.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Weapon Name: "..weapName,20.0,285.0,296.0,301.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) if isPedInVehicle (localPlayer) == false then return end Vname = getVehicleName(getPedOccupiedVehicle(localPlayer)) health = getElementHealth (getPedOccupiedVehicle(localPlayer)) sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) dxDrawText("Vehicle Name: "..Vname,20.0,307.0,296.0,323.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Vehicle Health: "..tostring(math.floor(health*0.1)).." %",20.0,328.0,296.0,344.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText("Speed: "..tostring(kmhs).." Km/h",20.0,348.0,296.0,364.0,tocolor(0,255,0,255),0.5,"bankgothic","left","top",false,false,false) end ) function quitar ( ) setTimer ( function ( ) for _, component in ipairs ( { "armour", "health", "money", "clock", "weapon", "ammo", "money", "wanted", "radar" } ) do showPlayerHudComponent ( component, false ) end end ,5000, 1 ) end addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar ) Lo ocultara 5 segundos despues de spawnear. Link to comment
NodZen Posted December 6, 2012 Share Posted December 6, 2012 Estoy para eso! ( dentro de lo que sepa ) . Link to comment
BorderLine Posted December 7, 2012 Share Posted December 7, 2012 function quitar() showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "ammo", false) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "wanted", false ) showPlayerHudComponent ( "radar", true ) end addEventHandler("onClientPlayerJoin",getLocalPlayer(),quitar) addEventHandler("onClientPlayerWasted",getLocalPlayer(),quitar) addEventHandler("onClientPlayerSpawn",getLocalPlayer(),quitar) intenta eso y cuando reinicies script matate.. Deberia funcionar Link to comment
Recommended Posts