Jump to content

Falling ped with parachute?


Jmaniacs

Recommended Posts

1 hour ago, Master_MTA said:

u r welcome

i already maked the code, but when i make the setPedAnalogControlState the ped stays flying in the air xd

1 hour ago, Jmaniacs said:

i already maked the code, but when i make the setPedAnalogControlState the ped stays flying in the air xd

wait, now it works, but only falls

Link to comment

its so weight xdd, im not the best programmer

 

Spoiler

show = true
showR =  true
showM = true
showP = true
showRP = true
local name = getPlayerName(getLocalPlayer())
function editLogin()
if show then
			
			
		Remember = guiCreateCheckBox(0.431, 0.505, 0.01, 0.02, "", true, true)
        Username = guiCreateEdit(0.46, 0.368, 0.1, 0.05, "Username", true)
        Password = guiCreateEdit(0.46, 0.45, 0.1, 0.05, "", true)   
		setElementAlpha (Remember, 0.20)
		guiSetProperty(Username,"NormalTextColour","FF000000")
		guiEditSetMaxLength(Username, 25)
		guiSetProperty(Password,"NormalTextColour","FF000000")
		guiEditSetMaxLength(Password, 25) 
		guiEditSetMasked ( Password, true )					
		
			
			
	

local user, pw = loadLoginFromXML()
	
	if not( user == "" or pw == "") then
		guiCheckBoxSetSelected ( Remember, true )
		guiSetText ( Username, tostring(user))
		guiSetText ( Password, tostring(pw))
	else
		guiCheckBoxSetSelected ( Remember, false )
		guiSetText ( Username, tostring(user))
		guiSetText ( Password, tostring(pw))
	end
end
if not show then

destroyElement(Username)
	destroyElement(Password)
	destroyElement(Remember)
	

end
end

function editRegister()
if showR then
	UsernameRegister = guiCreateEdit(0.46, 0.368, 0.1, 0.05, "Username", true)
    PasswordRegister = guiCreateEdit(0.46, 0.45, 0.1, 0.05, "Password", true)
    ConfirmPasswordRegister = guiCreateEdit(0.46, 0.53, 0.1, 0.05, "Password", true)
	guiEditSetMaxLength(PasswordRegister, 25) 
	guiEditSetMasked ( PasswordRegister, true )	
	guiEditSetMaxLength(ConfirmPasswordRegister, 25) 
	guiEditSetMasked ( ConfirmPasswordRegister, true )	
end			
if not showR then

	destroyElement(UsernameRegister)
	destroyElement(PasswordRegister)
	destroyElement(ConfirmPasswordRegister)
end
end

function editMenu()
if showM then 
end			
if not showR then

end
end

function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

local screenW, screenH = guiGetScreenSize()
local sx,sy = screenW/1440,screenH/900

 --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  LOGIN PAGE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 
 
 myFont = dxCreateFont( "images/Dosis.ttf", 20 )
 
    function loginPage()

show = true
	----
	fadeCamera(player, true)
	setCameraMatrix(-10.12109375, 1031.1455078125, 19.7421875, -20.4775390625, 1074.880859375, 37.591014862061)
	dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "images/LoginP.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
   end

 --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  MENU PAGE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	function menuPage ()
	showM = true
   --
	dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "images/Menu.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--	dxDrawText("#07004c".."#%x%x%x%x%x%x", "") , screenW * 0.1938, screenH * 0.0100, screenW * 0.4764, screenH * 0.0556, tocolor(7, 0, 76, 255), 1.00, "bankgothic", "center", "center", false, false, false, true, false)
--	dxDrawText("Years Old: '23'", screenW * 0.7604, screenH * 0.4111, screenW * 0.9236, screenH * 0.4489, tocolor(7, 0, 76, 255), 1.40, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("", screenW * 0.7604, screenH * 0.4733, screenW * 0.9236, screenH * 0.5111, tocolor(7, 0, 76, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("", screenW * 0.7604, screenH * 0.5356, screenW * 0.9236, screenH * 0.5733, tocolor(7, 0, 76, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
   end
   
   
  --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  PAGE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	function page ()
	showP = true
   --
   dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "images/Pa.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
   end
    
  
 --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  REGISTER PAGE  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    function registerPage()
	showR = true
	dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "images/bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "images/RegisterP.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end


--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function onClickBtnLogin(_,state) --При нажатии на кнопку Login
	if state == "up" then
	if isMouseInPosition(screenW * 0.4354, screenH * 0.5611, screenW * 0.1250, screenH * 0.0489) then
		--- LOGIN BUTTON
		showM = true
			username = guiGetText(Username)
			
			password = guiGetText(Password)
				if guiCheckBoxGetSelected ( Remember ) == true then
					checksave = true
				else
					checksave = false
				end
			triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave)
		
	end
	
	if isMouseInPosition(screenW * 0.4354, screenH * 0.6256, screenW * 0.1250, screenH * 0.0478) then
	show =  false
	-- REGISTER BUUTTON
	removeEventHandler( "onClientRender",root, loginPage ) 	
	editLogin()
    removeEventHandler( "onClientClick", root, onClickBtnLogin )
	editRegister()
	addEventHandler("onClientRender", root,registerPage)
	
	addEventHandler( "onClientClick", root, onClickBtnRegister )

	end
end
end

function onClickBtnSpawn(_,state) --При нажатии на кнопку Login
	if state == "up" then
	if isMouseInPosition(screenW * 0.0000, screenH * 0.0000, screenW * 0.1958, screenH * 0.1367) then
		--- SPAWN BUTTON
		showM = false
			
		
		triggerServerEvent("onRequestSpawn",getLocalPlayer())
		
	end
end
end

function onClickBtnLogout(_,state) --goes to the login and logout the account
	if state == "up" then
	if isMouseInPosition(screenW * 0.2076, screenH * 0.9300, screenW * 0.1062, screenH * 0.0700) then
		--- LOGOUT BUTTON
		showM = false
		showL = true
		
		editLogin()
		triggerServerEvent("onRequestLogout",getLocalPlayer())
	end
end
end


function onClickBtnRegister(_,state) --При нажатии на кнопку Register and Cofirm
	if state == "up" then
	--REGISTER
		if isMouseInPosition(screenW * 0.4361, screenH * 0.6000, screenW * 0.1243, screenH * 0.0500)then
				
			username = guiGetText(UsernameRegister)
			password = guiGetText(PasswordRegister)
			passwordConfirm = guiGetText(ConfirmPasswordRegister)
			triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
		end
		--- BACK
		if isMouseInPosition(screenW * 0.4361, screenH * 0.6611, screenW * 0.1243, screenH * 0.0500) then
		showR = false
	editRegister()
	removeEventHandler("onClientRender", root,registerPage)

	removeEventHandler( "onClientClick", root, onClickBtnRegister )
show = true
editLogin()

addEventHandler("onClientRender", root,loginPage)
addEventHandler( "onClientClick", root, onClickBtnLogin )
		
			
		end
	end
end

--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

function loadLoginFromXML() --Загрузка логина и пароля из XML
	local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login")
    end
    local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
    local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
    if usernameNode and passwordNode then
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
    else
		return "", ""
    end
    xmlUnloadFile ( xml_save_log_File )
end
 
 
function saveLoginToXML(username, password) --Сохрание логина и пароля в XML
    local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login")
    end
	if (username ~= "") then
		local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
		if not usernameNode then
			usernameNode = xmlCreateChild(xml_save_log_File, "username")
		end
		xmlNodeSetValue (usernameNode, tostring(username))
	end
	if (password ~= "") then
		local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
		if not passwordNode then
			passwordNode = xmlCreateChild(xml_save_log_File, "password")
		end		
		xmlNodeSetValue (passwordNode, tostring(password))
	end
    xmlSaveFile(xml_save_log_File)
    xmlUnloadFile (xml_save_log_File)
end
addEvent("saveLoginToXML", true)
addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML)



function resetSaveXML() --Сохрание логина и пароля в XML
		local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml")
		if not xml_save_log_File then
			xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login")
		end
		if (username ~= "") then
			local usernameNode = xmlFindChild (xml_save_log_File, "username", 0)
			if not usernameNode then
				usernameNode = xmlCreateChild(xml_save_log_File, "username")
			end
		end
		if (password ~= "") then
			local passwordNode = xmlFindChild (xml_save_log_File, "password", 0)
			if not passwordNode then
				passwordNode = xmlCreateChild(xml_save_log_File, "password")
			end		
			xmlNodeSetValue (passwordNode, "")
		end
		xmlSaveFile(xml_save_log_File)
		xmlUnloadFile (xml_save_log_File)
end
addEvent("resetSaveXML", true)
addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)

function showLogin()
	setPlayerHudComponentVisible ("radar", false)
	exports["notices"]:addNotification("[ LOGIN ] Welcome to Surviving Zone",'info')
	editLogin()
	addEventHandler("onClientRender", root,loginPage)
	sound = playSound( "images/music.mp3" )
	addEventHandler( "onClientClick", root, onClickBtnLogin )
	local ped = createPed ( 0, -65.56640625, 1084.458984375, 100.761299133301 )
	givePedWeapon(ped, 46, 1, true)
	setPedAnalogControlState( ped, "fire", 1 )
	setPedAnalogControlState( ped, "jump", 1 )
	
	guiSetInputEnabled(true)
			showChat(false)
			showCursor(true)
end
addEvent("showLoginWindow", true)
addEventHandler("showLoginWindow", getRootElement(), showLogin)
addEventHandler("onClientResourceStart",resourceRoot,showLogin)

function showMenu()

	setPlayerHudComponentVisible ("radar", false)
	local pj = createPed ( 0, 88.67029, -42.73542, 0.86604, 220 )
	local pj2 = createPed ( 7, 89.7029, -39.73542, 0.86604, 220 )
	local veh = createVehicle ( 422, 88.67029, -37.73542, 0.86604, 0, 0, 130 )
	setPedAnimation(pj, "Crack", "Bbalbat_Idle_01")
	setPedAnimation(pj2, "dancing", "dance_loop")
	addPedClothes ( pj, "moto", "moto", 16 ) 
	addPedClothes ( pj, "player_torso", "torso", 0 ) 
	addPedClothes ( pj, "player_legs", "legs", 2) 
	setPedStat(pj, 23, 1000)
	setElementDimension ( pj, 666 )
	setElementDimension ( pj2, 666 )
	setElementDimension ( veh, 666 )
	setElementDimension (source, 666)	
	editMenu()
	addEventHandler("onClientRender", root,menuPage)
	addEventHandler( "onClientClick", root, onClickBtnSpawn )
	addEventHandler( "onClientClick", root, onClickBtnLogout )
	
	guiSetInputEnabled(true)
			showChat(false)
			showCursor(true)
end

addEvent("ShowMenuWindow", true)
addEventHandler("ShowMenuWindow", getRootElement(), showMenu)

function spawn()

	setPlayerHudComponentVisible ("radar", true)
	guiSetInputEnabled(false)
			showChat(true)
			showCursor(false)
end

addEvent("spawn", true)
addEventHandler("spawn", getRootElement(), spawn)


function hideMenuWindow() --Функция закрытия логин панели
	setPlayerHudComponentVisible ("radar", true)
showM = false
	if (pj == 1) then
	destroyElement(pj)
	end
	guiSetInputEnabled(false)
	showCursor(false)
	showChat(true)
	removeEventHandler( "onClientRender",root, menuPage ) 	
	removeEventHandler( "onClientClick",root, onClickBtnSpawn ) 	
	removeEventHandler( "onClientClick",root, onClickBtnLogout ) 
end

addEvent("hideMenuWindow", true)
addEventHandler("hideMenuWindow", getRootElement(), hideMenuWindow)

function showPage()
	if showP == false then
	showP = true
	addEventHandler("onClientRender", root,page)
	else
	showP = false
	RemoveEventHandler("onClientRender", root,page)
	end
end

bindKey ("F10", "down", showPage)

function hideLoginWindow() --Функция закрытия логин панели
	setPlayerHudComponentVisible ("radar", false)
	show = false
	guiSetInputEnabled(false)
	showCursor(true)
	showChat(false)
	stopSound( sound)
	removeEventHandler( "onClientRender",root, loginPage ) 	
	editLogin()
    removeEventHandler( "onClientClick", root, onClickBtnLogin )	
	removeEventHandler( "onClientClick", root, onClickBtnRegister )

end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

 

 

if you want can accept me in skype to communicate better

Link to comment
18 minutes ago, Jmaniacs said:

skype

if u have discord that will be better

any way i wasn't mean full code i just need small piece of it which spawn the ped and setting analoge stat

any way

change this 

	setPedAnalogControlState( ped, "fire", 1 )
	setPedAnalogControlState( ped, "jump", 1 )
	

to

	setPedAnalogControlState( ped, "jump", 1 )
setTimer(	setPedAnalogControlState,1000*2,1, ped, "fire", 1 )	

 

Link to comment
  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...