el_motoblock Posted January 3, 2012 Share Posted January 3, 2012 Сделал худ на основе ultimatehud(в коммюнити,работает), но ни чего там не прорисовывается вообще. function hudvisible ( ) --Gets some elements local hour, mins = getTime () time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins) moneycount=getPlayerMoney(getLocalPlayer()) money= '$' ..moneycount ammo = getPedTotalAmmo ( getLocalPlayer ) phealth = math.floor (getElementHealth ( getLocalPlayer() )) armor = math.floor(getPedArmor ( getLocalPlayer() )) oxygen = math.floor(getPedStat ( getLocalPlayer, 225 )) --Draws all images dxDrawImage(57.0,632.0,452.0,264.0,"cw_style_hud.png",0.0,0.0,0.0,tocolor(200,200,200,255),false) --время dxDrawText(tostring (time),246.0,637.0,323.0,653.0,tocolor(255,255,255,255),0.8,"bankgothic","right","center",false,false,false) --бабло dxDrawText(tostring (money),372.0,663.0,491.0,684.0,tocolor(0,150,0,255),1.0,"pricedown","right","center",false,false,false) --здоровье dxDrawText(tostring (phealth).."%",456.0,773.0,498.0,795.0,tocolor(200,20,20,255),1.0,"pricedown","right","center",false,false,false) dxDrawText("Здоровье",449.0,792.0,505.0,809.0,tocolor(255,30,30,255),1.0,"default","center","center",false,false,false) --броня dxDrawText(tostring (armor).."%",399.0,773.0,441.0,795.0,tocolor(50,50,255,255),1.0,"pricedown","right","center",false,false,false) dxDrawText("Броня",395.0,792.0,451.0,809.0,tocolor(30,30,255,255),1.0,"default","center","center",false,false,false) --O2 dxDrawText(tostring (oxygen).."%",342.0,773.0,384.0,795.0,tocolor(150,150,255,255),1.0,"pricedown","right","center",false,false,false) dxDrawText("Кислород",338.0,792.0,394.0,809.0,tocolor(50,50,250,255),1.0,"default","center","center",false,false,false) --патроны dxDrawText(tostring (ammo).."%",434.0,746.0,496.0,766.0,tocolor(50,255,50,255),1.0,"default-bold","right","center",false,false,false) --Прорисовка оружия weapon = getPedWeapon ( getLocalPlayer() ) if ( weapon == 1 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 2 ) then -- the elseif works correctly here, we won't use here through. dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 3 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 4 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 5 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 6 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 7 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 8 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 9 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 10 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 11 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 12 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 14 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 15 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 16 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 17 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 18 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 22 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 23 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 24 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 25 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 26 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 27 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 28 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 29 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 30 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 31 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 32 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 33 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 34 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 35 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 36 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 37 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 38 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 39 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 40 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 41 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 42 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 43 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 44 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 45 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if ( weapon == 46 ) then dxDrawImage(434.0,685.0,64.0,64.0,"images/fist.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end --Gets the vehicle & checks if is the ped in a vehicle (for evade the debug spam with bad arguments when someone is on foot) vehicle = getPedOccupiedVehicle(getLocalPlayer()) if ( vehicle ) then --checking -- Gets some vehicle elements (gear, speed in MPH and KMH and health) speedx, speedy, speedz = getElementVelocity ( vehicle ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.floor(actualspeed*180) -- Kilometers per hour vehiclehealth = math.floor(getElementHealth ( vehicle )) -- And finally, draws --скорость dxDrawText("Скорость КМ/Ч",338.0,844.0,394.0,861.0,tocolor(50,50,250,255),1.0,"default","center","center",false,false,false) dxDrawText(tostring (kmh),342.0,825.0,384.0,847.0,tocolor(150,150,255,255),1.0,"pricedown","right","center",false,false,false) --здоровье тачки dxDrawText("Здоровье тачки",449.0,844.0,505.0,861.0,tocolor(255,30,30,255),1.0,"default","right","center",false,false,false) dxDrawText(tostring (vehiclehealth).."%",456.0,825.0,498.0,847.0,tocolor(200,20,20,255),1.0,"pricedown","right","center",false,false,false) end end addEventHandler ("onClientRender", root, hudvisible ) --This will disable original hud function hideall(player) showPlayerHudComponent ( "ammo", false ) showPlayerHudComponent ( "area_name", false ) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "breath", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "vehicle_name", false ) showPlayerHudComponent ( "weapon", false ) end addEventHandler ( "onClientResourceStart", resourceRoot, hideall ) function showall(player) showPlayerHudComponent ( "ammo", true ) showPlayerHudComponent ( "area_name", true ) showPlayerHudComponent ( "armour", true ) showPlayerHudComponent ( "breath", true ) showPlayerHudComponent ( "clock", true ) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "money", true ) showPlayerHudComponent ( "vehicle_name", true ) showPlayerHudComponent ( "weapon", true ) end addEventHandler ( "onClientResourceStop", resourceRoot, showall ) Может кто понял что ни так? Заранее спасибо. Link to comment
MX_Master Posted January 4, 2012 Share Posted January 4, 2012 getLocalPlayer это функция, а ты ее и как функцию, и как переменную юзаешь (без скобок). Ты или правильно пиши вызов функции getLocalPlayer() или юзай переменную localPlayer Link to comment
el_motoblock Posted January 4, 2012 Author Share Posted January 4, 2012 Спасибо. Но у меня кислород не вырисовывается oxygen = math.floor(getPedStat ( getLocalPlayer(), 225 )) --O2 dxDrawText(tostring (oxygen),342.0,773.0,384.0,795.0,tocolor(150,150,255,255),1.0,"pricedown","right","center",false,false,false) Link to comment
Kenix Posted January 4, 2012 Share Posted January 4, 2012 Проверь возвращаемое значение ну и в /debugscript 3 смотри. Link to comment
el_motoblock Posted January 4, 2012 Author Share Posted January 4, 2012 Проверь возвращаемое значение ну и в /debugscript 3 смотри. Неа насчёт скрипта ошибок не вылезало Link to comment
MX_Master Posted January 4, 2012 Share Posted January 4, 2012 возможно, что-то рисуется поверх и искомое не видно Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now