BriGhtx3 Posted May 28, 2011 Posted May 28, 2011 (edited) I want to ask how i can create a gui like this : 2. How do i create a speedometer? I want to make one by myself, but i don't know how to get the Player speed and to rotate the needle. Edited May 28, 2011 by Guest Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Aibo Posted May 28, 2011 Posted May 28, 2011 gui iblabla image is created by using guiCreateStaticImage or dxDrawImage. and other gui functions: https://wiki.multitheftauto.com/wiki/Cli ... _functions speed is calculated from vehicle element velocity (see example): https://wiki.multitheftauto.com/wiki/GetElementVelocity then resulting speed is passed to dxDrawImage of a needle as rotation parameter (adjusted to some degree range if needed) ?
karlis Posted May 28, 2011 Posted May 28, 2011 (edited) this is more compact function getPlayerSpeed(player,mph) local multiplier=mph and 100 or 161 --in case mph argument is true, it will return speed in mph, else-kph local velX,velY,velZ=getElementVelocity(getPedOccuipiedVehicle(player) or player) return (velx^2+velY^2+velZ^2)^0.5*multiplier end use getPlayerSpeed(getLocalPlayer(),true/false), and it works clientside too. Edited May 28, 2011 by Guest [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
BriGhtx3 Posted May 28, 2011 Author Posted May 28, 2011 Thanks to both of you First I create my IPOD/Cellphone then a Speedometer. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Aibo Posted May 28, 2011 Posted May 28, 2011 this is more compactuse getPlayerSpeed(getLocalPlayer(),true/false), and it works clientside too. even more compact function getPlayerSpeed(player,mph) local velX,velY,velZ=getElementVelocity(getPedOccuipiedVehicle(player) or player) return (velx^2+velY^2+velZ^2)^0.5*(mph and 100 or 161) end ?
karlis Posted May 28, 2011 Posted May 28, 2011 this is more compactuse getPlayerSpeed(getLocalPlayer(),true/false), and it works clientside too. even more compact getPlayerSpeed(player,mph) local velX,velY,velZ=getElementVelocity(getPedOccuipiedVehicle(player) or player) return (velx^2+velY^2+velZ^2)^0.5*(mph and 100 or 161) end true, but omg what i was a noob, i forgot to put "function" word at first!! EDIT:lol how we found it out same time. [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
BriGhtx3 Posted May 28, 2011 Author Posted May 28, 2011 Why is here an error? Debugscript doesn't say anything, and when i press F4 or type /handy, the image doesn't show oO function IPhone() local x,y = guiGetScreenSize() guiCreateStaticImage( 20,200, 229, 405, "bg.png", false ) end addCommandHandler("handy", IPhone) bindKey("F4", "down", IPhone) Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
BriGhtx3 Posted May 28, 2011 Author Posted May 28, 2011 Yes Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
karlis Posted May 28, 2011 Posted May 28, 2011 define gui size before the function, as it doesn't change. [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
BriGhtx3 Posted May 28, 2011 Author Posted May 28, 2011 What do you mean? Edit : I added onClientResourceStart, and I didn't see it too. I think the position is wrong. But why? Edit 2 : Got it! phone = guiCreateStaticImage( screenWidth/2 - 299, screenHeight - 380, 229, 405, "bg.png", false ) My error? The client.lua file was in the Handy folder. The image too. In the meta the image is in the handy folder but in the code is written : bg.png. The paths weren't the same but both right. And now : How do I hide it? Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
karlis Posted May 28, 2011 Posted May 28, 2011 guiSetVisible(element gui-widget,bool visible) [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
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