Mefisto_PL Posted February 13, 2013 Posted February 13, 2013 Hello.. I have an error in my code, but idk where. When I have smaller than 50 points then guiSetText should be changed, but no.. With money it's working perfectly, but with points not.. function DanceStripGui ( ) local money = getPlayerMoney ( getLocalPlayer() ) local points = getElementData ( getLocalPlayer(), "Points" ) if ( source == StripBuyBtn ) then if ( money >= 500 ) and ( points >= 50 ) then guiSetVisible ( StripWindow, false ) showCursor ( false ) guiSetInputEnabled ( false ) takePlayerMoney ( 500 ) setCameraInterior ( 5 ) setCameraMatrix ( 2232.5283, -1108.1843, 1051, 2229.2053, -1106.5839, 1050.5828 ) showPlayerHudComponent ( "radar", false ) setTimer ( setCameraTarget, 15005, 1, getLocalPlayer() ) setTimer ( setCameraInterior, 15005, 1, 2 ) setTimer ( setElementPosition, 15000, 1, getLocalPlayer(), 1204.8, 11.665545463562, 1001 ) setTimer ( setElementInterior, 15000, 1, getLocalPlayer(), 2 ) setTimer ( showPlayerHudComponent, 15000, 1, "radar", true ) local PedSkin = getElementModel ( getLocalPlayer() ) setElementModel ( Guy, PedSkin ) else if ( money <= 500 ) and ( points <= 50 ) then guiSetText ( StripMoneyLabel, "( You don't have enough money and points ! ($500 and 50P) )" ) elseif ( money <= 500 ) then guiSetText ( StripMoneyLabel, "( You don't have enough money ! ($500) )" ) elseif ( points <= 50 ) then guiSetText ( StripMoneyLabel, "( You don't have enough points ! (50P) )" ) end end end end addEventHandler ( "onClientGUIClick", StripBuyBtn, DanceStripGui )
Castillo Posted February 13, 2013 Posted February 13, 2013 function DanceStripGui ( ) local money = getPlayerMoney ( ) local points = getElementData ( localPlayer, "Points" ) if ( money >= 500 ) then if ( points >= 50 ) then guiSetVisible ( StripWindow, false ) showCursor ( false ) guiSetInputEnabled ( false ) takePlayerMoney ( 500 ) setCameraInterior ( 5 ) setCameraMatrix ( 2232.5283, -1108.1843, 1051, 2229.2053, -1106.5839, 1050.5828 ) showPlayerHudComponent ( "radar", false ) setTimer ( setCameraTarget, 15005, 1, getLocalPlayer() ) setTimer ( setCameraInterior, 15005, 1, 2 ) setTimer ( setElementPosition, 15000, 1, getLocalPlayer(), 1204.8, 11.665545463562, 1001 ) setTimer ( setElementInterior, 15000, 1, getLocalPlayer(), 2 ) setTimer ( showPlayerHudComponent, 15000, 1, "radar", true ) local PedSkin = getElementModel ( getLocalPlayer() ) setElementModel ( Guy, PedSkin ) else guiSetText ( StripMoneyLabel, "( You don't have enough points ! (50P) )" ) end else guiSetText ( StripMoneyLabel, "( You don't have enough money ! ($500) )" ) end end addEventHandler ( "onClientGUIClick", StripBuyBtn, DanceStripGui, false ) Also, if you take the money client side, it won't sync with the server side, you must do it server side. And the skin will be only changed on your client only.
Mefisto_PL Posted February 13, 2013 Author Posted February 13, 2013 But where is this line? guiSetText ( StripMoneyLabel, "( You don't have enough money and points ! ($500 and 50P) )" )
Castillo Posted February 13, 2013 Posted February 13, 2013 function DanceStripGui ( ) local money = getPlayerMoney ( ) local points = getElementData ( localPlayer, "Points" ) if ( money < 500 and points < 50 ) then return guiSetText ( StripMoneyLabel, "( You don't have enough money and points ! ($500 and 50P) )" ) end if ( money >= 500 ) then if ( points >= 50 ) then guiSetVisible ( StripWindow, false ) showCursor ( false ) guiSetInputEnabled ( false ) takePlayerMoney ( 500 ) setCameraInterior ( 5 ) setCameraMatrix ( 2232.5283, -1108.1843, 1051, 2229.2053, -1106.5839, 1050.5828 ) showPlayerHudComponent ( "radar", false ) setTimer ( setCameraTarget, 15005, 1, getLocalPlayer() ) setTimer ( setCameraInterior, 15005, 1, 2 ) setTimer ( setElementPosition, 15000, 1, getLocalPlayer(), 1204.8, 11.665545463562, 1001 ) setTimer ( setElementInterior, 15000, 1, getLocalPlayer(), 2 ) setTimer ( showPlayerHudComponent, 15000, 1, "radar", true ) local PedSkin = getElementModel ( getLocalPlayer() ) setElementModel ( Guy, PedSkin ) else guiSetText ( StripMoneyLabel, "( You don't have enough points ! (50P) )" ) end else guiSetText ( StripMoneyLabel, "( You don't have enough money ! ($500) )" ) end end addEventHandler ( "onClientGUIClick", StripBuyBtn, DanceStripGui, false )
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