raulrobi Posted May 30, 2010 Share Posted May 30, 2010 (edited) Hello I learned a bit GUI , but i added to GMS script Buy window and i deletd the another.It didnt works . I started it and when i go to server nothing happeneds . Can you help me ? pls . Here is my code: function guiToggleVisible ( ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) showCursor ( false ) else guiSetVisible ( myWindow, true ) showCursor ( true ) end end myWindow = guiCreateWindow ( 0, 0, .10, .10, "Buy window", true ) local tabPanel = guiCreateTabPanel ( 0, 10.0, 6, 2, true, myWindow ) local tabCommands = guiCreateTab( "Buy", tabPanel ) Buynitro_button = guiCreateButton( 0.1, 0.1, 0.50, 0.10, "Buy nitro", true, tabCommands ) Buyrepair_button = guiCreateButton( 0.1, 0.2, 0.50, 0.10, "Buy repair", true, tabCommands ) exit1_button = guiCreateButton( 0.30, 0.85, 0.5, 0.03, "Close Panel (F4)", true, tabCommands ) bindKey ( "u", "down", guiToggleVisible ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == exit1_button) then guiSetVisible( myWindow, false ) showCursor( false ) end end ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == buynitro_button) then getPlayerMoney(player) > 100 then local vehicle = getPedOccupiedVehicle(player) if vehicle then addVehicleUpgrade(vehicle, 1010) takePlayerMoney(player, 100) outputChatBox("You've bought a nitro", player, 0, 222, 0, true) else outputChatBox("You are not in a vehicle", player, 222, 0, 0, true) end else outputChatBox("Not enough cash, nitro costs 100", player, 222, 0, 0, true) end addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == Buyrepair_button) then if getPlayerMoney(player) > 100 then local vehicle = getPedOccupiedVehicle(player) if vehicle then fixVehicle(vehicle) takePlayerMoney(player, 100) outputChatBox("You've bought a repair", player, 0, 222, 0, true) else outputChatBox("You are not in a vehicle", player, 222, 0, 0, true) end else outputChatBox("Not enough cash, repair costs 100 ", player, 222, 0, 0, true) end end end ) Can anyone help me pls ? Edited May 30, 2010 by Guest Link to comment
kevin11 Posted May 30, 2010 Share Posted May 30, 2010 right... outputchatbox in a gui..... ok im not judging but uhm do it in serverside ok? we need server sided script if you want help Link to comment
dzek (varez) Posted May 30, 2010 Share Posted May 30, 2010 you have mixed server-side with client-side scripts.. Link to comment
knash94 Posted May 30, 2010 Share Posted May 30, 2010 Client side outputChatBox = outputChatBox (message, r, g, b) so no need to have outputChatBox (message, player, r, g, b) also if calling a player required function, try using getLocalPlayer() or before the script add: player = getLocalPlayer() Link to comment
raulrobi Posted May 30, 2010 Author Share Posted May 30, 2010 (edited) Well i nned to add local player = getLocallayer() ? k ty for helping but i need to test dont works... and i dont know making server side Edited May 30, 2010 by Guest Link to comment
raulrobi Posted May 30, 2010 Author Share Posted May 30, 2010 Better i quit script , bb all Link to comment
kevin11 Posted May 30, 2010 Share Posted May 30, 2010 bye = for losers just use guieditor from community way easier Link to comment
raulrobi Posted May 30, 2010 Author Share Posted May 30, 2010 I said i maked it with GMS scrit i deleted the another and i added the buy so Can you help me? Link to comment
kevin11 Posted May 30, 2010 Share Posted May 30, 2010 man.. why dont u make a whole new one cuz gms script is way diferent then what u wantI said i maked it with GMS scrit i deleted the another and i added the buy so Can you help me? Link to comment
kevin11 Posted May 30, 2010 Share Posted May 30, 2010 gave u wrong thing lol go to dmc ep world you know what i mean Link to comment
raulrobi Posted May 30, 2010 Author Share Posted May 30, 2010 (edited) I maked it with Gui editor i think i worked on it 3 or 4 hours , but it didnt works -.-' Can anyone help me ? When i type debugscript 3 it gives: [16:17:33] Starting resources............... [16:17:34] Server started and is ready to accept connections! [16:17:36] start: Requested by Console [16:17:36] Starting buy [16:17:36] SCRIPT ERROR: ...iles/MTA San Andreas/server/mods/deathmatch/resources/buy/Untitled 1.lua:13: unexpected symbol near '>' [16:17:36] WARNING: Loading script failed: ...iles/MTA San Andreas/server/mods/deathmatch/resources/buy/Untitled 1.lua:13: unexpected symbol near '>' [16:17:36] start: Resource 'buy' started [16:18:10] debugscript: Incorrect client type for this command Here is my code : GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(161,102,390,342,"Buy window",false) GUIEditor_Button[1] = guiCreateButton(31,25,90,18,"Buy nitro",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(30,46,91,17,"Buy repair",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(131,25,209,50,"Press Buy nitro to buy a niro\nPress buy repair to buy a repair",false,GUIEditor_Window[1]) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == GUIEditor_Button[1]) then getPlayerMoney(player) > 100 then local vehicle = getPedOccupiedVehicle(player) local player = getLocalPlayer() if vehicle then addVehicleUpgrade(vehicle, 1010) takePlayerMoney(player, 100) outputChatBox("You've bought a nitro", player, 0, 222, 0, true) else outputChatBox("You are not in a vehicle", player, 222, 0, 0, true) end else outputChatBox("Not enough cash, nitro costs $100", player, 222, 0, 0, true) end addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == GUIEditor_Button[2]) then if getPlayerMoney(player) > 100 then local vehicle = getPedOccupiedVehicle(player) local player = getLocalPlayer() if vehicle then fixVehicle(vehicle) takePlayerMoney(player, 100) outputChatBox("You've bought a repair", player, 0, 222, 0, true) else outputChatBox("You are not in a vehicle", player, 222, 0, 0, true) end else outputChatBox("Not enough cash, repair costs 100 ", player, 222, 0, 0, true) end end end ) Edited May 31, 2010 by Guest Link to comment
kevin11 Posted May 30, 2010 Share Posted May 30, 2010 lol listen to people someone said outputchatbox is wrong well.... we see u didnt look at it btw my offer stands for 1 more hour not more not less Link to comment
raulrobi Posted May 31, 2010 Author Share Posted May 31, 2010 Can anyone help me ? pls Link to comment
kevin11 Posted May 31, 2010 Share Posted May 31, 2010 Can anyone help me ? pls not if you're ignoring... please use outPutChatbox in server side and make a normal gui + variables (names) if u made that im willing to make you a server side Link to comment
raulrobi Posted May 31, 2010 Author Share Posted May 31, 2010 I used outputChatBox lol Client side outputChatBox = outputChatBox (message, r, g, b)so no need to have outputChatBox (message, player, r, g, b) also if calling a player required function, try using getLocalPlayer() or before the script add: player = getLocalPlayer() I used that in red ,it should to be outputChatBox = outputChatBox (message, r, g, b) ? °-° And i added : player = getLocalPlayer() Link to comment
raulrobi Posted May 31, 2010 Author Share Posted May 31, 2010 (edited) Please ok , can you help me please? Edited May 31, 2010 by Guest Link to comment
robhol Posted May 31, 2010 Share Posted May 31, 2010 posting tons and tons of posts directly after another... Link to comment
kevin11 Posted May 31, 2010 Share Posted May 31, 2010 robhol i know u dont like me but i agree... Link to comment
Castillo Posted June 1, 2010 Share Posted June 1, 2010 well, i made it for you but you must know that i wont make anything u post here so start to learn by yourself client side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(161,102,390,342,"Buy window",false) GUIEditor_Button[1] = guiCreateButton(31,25,90,18,"Buy nitro",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(30,46,91,17,"Buy repair",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(131,25,209,50,"Press Buy nitro to buy a niro\nPress buy repair to buy a repair",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) function guiToggleVisible ( ) if ( guiGetVisible ( GUIEditor_Window[1] ) == true ) then guiSetVisible(GUIEditor_Window[1], false) showCursor ( false ) else guiSetVisible(GUIEditor_Window[1], true) showCursor ( true ) end end bindKey ( "M", "down", guiToggleVisible ) function fixv() triggerServerEvent("fixRequest", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[2],fixv,false) function nitro() triggerServerEvent("nitro", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[1],nitro,false) server side: addEvent("nitro", true) addEventHandler("nitro", getRootElement(), function() if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 7000 ) then takePlayerMoney(source, 7000) addVehicleUpgrade(getPedOccupiedVehicle(source),1010) outputChatBox("Nitro Successfully added", source, 255, 255, 0, true) else outputChatBox("Not enough money.", source, 255, 0, 0, true) end else outputChatBox("You are not in a vehicle", source, 255, 0, 0, true) end end ) addEvent("fixRequest", true) addEventHandler("fixRequest", getRootElement(), function() if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 20000 ) then takePlayerMoney(source, 20000) fixVehicle(getPedOccupiedVehicle(source)) outputChatBox("Vehicle Successfully Fixed", source, 255, 255, 0, true) else outputChatBox("Not enough money.", source, 255, 0, 0, true) end else outputChatBox("You are not in a vehicle", source, 255, 0, 0, true) end end ) Link to comment
Castillo Posted June 1, 2010 Share Posted June 1, 2010 Thank you very much. no problem, and remember to start to learn!!! 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