loler Posted June 6, 2010 Share Posted June 6, 2010 Hey all. I maked a stats gui but it didnt works when i type in console start stats it gives: [11:52:56] Starting Stats [11:52:56] SCRIPT ERROR: ...am Files/MTA San Andreas/server/mods/deathmatch/resources/Stats/shop.lua:31: ')' expected near 'playerMoney' [11:52:56] WARNING: Loading script failed: ...am Files/MTA San Andreas/server/mods/deathmatch/resources/Stats/shop.lua:31: ')' expected near 'playerMoney' [11:52:56] start: Resource 'stats' started Ok here is my code: function OpenStatusWindow() guiSetVisible( GUIEditor_Window[1], not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( guiGetVisible( GUIEditor_Window[1] ) ) end addCommandHandler("userpanel",OpenStatusWindow) function createGUI() bindKey("F5","down",OpenStatusWindow) GUIEditor_Window = {} GUIEditor_Label = {} GUIEditor_Image = {} -- Get data local playerMoney = getElementData(getLocalPlayer(), "Money") local playerPoints = getElementData(getLocalPlayer(), "Points") local playerWins = getElementData(getLocalPlayer(), "Wins") local playerLoses = getElementData(getLocalPlayer(), "Loses") GUIEditor_Window[1] = guiCreateWindow(229,191,508,515,"Stats gui by loler",false) GUIEditor_Label[1] = guiCreateLabel(12,18,5,5,"",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) GUIEditor_Label[2] = guiCreateLabel(30,28,161,24,"Player money:"playerMoney,false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) GUIEditor_Label[3] = guiCreateLabel(30,47,179,16,"Player points:"..playerPoints,false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Label[4] = guiCreateLabel(30,64,152,16,"Player wins:" ..playerWins,false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) GUIEditor_Label[5] = guiCreateLabel(29,83,163,19,"Player loses:"..playerLoses,false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[5],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) GUIEditor_Label[6] = guiCreateLabel(23,490,441,16,"Stats gui made by loler.May be not released without his permision.Have fun!!",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) GUIEditor_Image[1] = guiCreateStaticImage(227,53,272,375,"images/mtalogo.png",false,GUIEditor_Window[1]) -- Hide userpanel when Recource starts guiSetVisible( GUIEditor_Window[1], false) end addEventHandler("onClientResourceStart",resourceRoot,createGUI) Can anyone help me ? please Link to comment
The_Ex Posted June 6, 2010 Share Posted June 6, 2010 2 years of MTA scripting experience? REALLY? Your mistakes are simple and stupid and seems like you just copy your script here when it doesn't work. Did you at least read the line which produces error? GUIEditor_Label[2] = guiCreateLabel(30,28,161,24,"Player money:"playerMoney,false,GUIEditor_Window[1]) You're missing .. GUIEditor_Label[2] = guiCreateLabel(30,28,161,24,"Player money:"..playerMoney,false,GUIEditor_Window[1]) Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh SHIT and i was joking and I DONT COPY SCRIPTS but when i press F5 nothing happeneds , pls help me Link to comment
dzek (varez) Posted June 6, 2010 Share Posted June 6, 2010 addEventHandler("onClientResourceStart",resourceRoot,createGUI) resourceRoot is not defined Link to comment
Remp Posted June 6, 2010 Share Posted June 6, 2010 resourceRoot is defined by mta and exists in every resource (as the root element of that resource) Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 So how can i fix this script? Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 (edited) Ok i maked one more , pls dont say that i sthealed cuz i didnt ( speccialy for the_ex) i stayed 3 hours on it -.-' Client side: addCommandHandler("userpanel",OpenStatusWindow) function createGUI() bindKey("F5","down",OpenStatusWindow) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} local player = getPlayerName(getLocalPlayer()) local playerMoney = getElementData(getLocalPlayer(), "Money") local playerPoints = getElementData(getLocalPlayer(), "Points") local playerWins = getElementData(getLocalPlayer(), "Wins") local playerLoses = getElementData(getLocalPlayer(), "Loses") GUIEditor_Window[1] = guiCreateWindow(11,135,275,194,"User panel",false) GUIEditor_TabPanel[1] = guiCreateTabPanel(12,23,249,162,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("User",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(10,11,222,19,"Name: " .. player,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) GUIEditor_Label[2] = guiCreateLabel(10,32,222,19,"Money: $" .. playerMoney,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) GUIEditor_Label[3] = guiCreateLabel(10,52,222,19,"Points: " .. playerPoints,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Label[4] = guiCreateLabel(10,52,222,19,"Wins: " .. playerWins,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Label[5] = guiCreateLabel(10,52,222,19,"Loses: " .. playerLoses,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Tab[2] = guiCreateTab("Shop",GUIEditor_TabPanel[1]) GUIEditor_Label[6] = guiCreateLabel(18,14,142,16,"Repair:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[4],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) GUIEditor_Label[7] = guiCreateLabel(18,33,142,16,"Nitro:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[5],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) GUIEditor_Label[8] = guiCreateLabel(18,53,142,16,"Barrel:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[6],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) GUIEditor_Label[9] = guiCreateLabel(18,73,142,16,"Haystack:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[7],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) GUIEditor_Button[1] = guiCreateButton(67,14,46,17,"$3500",false,GUIEditor_Tab[2]) GUIEditor_Button[2] = guiCreateButton(62,34,46,17,"$2000",false,GUIEditor_Tab[2]) GUIEditor_Button[3] = guiCreateButton(50,54,46,17,"$1500",false,GUIEditor_Tab[2]) GUIEditor_Button[4] = guiCreateButton(88,74,46,17,"$3000",false,GUIEditor_Tab[2]) GUIEditor_Button[5] = guiCreateButton(92,94,46,17,"$4000",false,GUIEditor_Tab[2]) function fixv() triggerServerEvent("fixRequest", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[1],fixv,false) function nitro() triggerServerEvent"nitro", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[2],nitro,false) function barrel() triggerServerEvent("barrel", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[3],barrel,false) triggerServerEvent("haystack", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[4],haystack,false) GUIEditor_Tab[3] = guiCreateTab("Credits",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(7,6,233,127,"User panel by loler",false,GUIEditor_Tab[3]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[4] = guiCreateTab("Top Points",GUIEditor_TabPanel[1]) GUIEditor_Label[9] = guiCreateLabel(9,11,223,21,"Coming soon \"{SMILIES_PATH}/icon_wink.gif\" alt=\"\" title=\"Wink\" />",false,GUIEditor_Tab[4]) guiLabelSetColor(GUIEditor_Label[9],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[9],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[9],"left",false) -- Hide userpanel when Recource starts guiSetVisible( GUIEditor_Window[1], false) end addEventHandler("onClientResourceStart",resourceRoot,createGUI) 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 ) addEvent("haystack", true) addEventHandler("haystack", getRootElement(), function() local x,y,z = getElementPosition( player ) if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 99999 ) then takePlayerMoney(source, 99999) createObject ( 3374 , x , y , z ) outputChatBox("Haystack Successfully planted", 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("barrel", true) addEventHandler("barrel", getRootElement(), function() local x,y,z = getElementPosition( player ) if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 100000 ) then takePlayerMoney(source, 100000) createObject ( 1225 , x , y , z ) outputChatBox("Barrel Successfully planted", 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 ) Edited June 6, 2010 by Guest Link to comment
dzek (varez) Posted June 6, 2010 Share Posted June 6, 2010 hehe, maybe not stolen, but copied from another topic ;D Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 Nah , check ALL the mta scripting subforum and you will see Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 It isnt working , can anyone help me? Link to comment
dzek (varez) Posted June 6, 2010 Share Posted June 6, 2010 what is not working? any errors? you tried debugging? Link to comment
loler Posted June 6, 2010 Author Share Posted June 6, 2010 Nope it didnt gives any errors Link to comment
dzek (varez) Posted June 6, 2010 Share Posted June 6, 2010 and rest of the quesitions? what is not working?any errors? --- answered you tried debugging? Link to comment
The_Ex Posted June 6, 2010 Share Posted June 6, 2010 Ok i maked one more , pls dont say that i sthealed cuz i didnt ( speccialy for the_ex) I'm not the one who accused you for stealing scripts, lol. Start with debugging your code. https://wiki.multitheftauto.com/wiki/Debugging (/debugscript 3 is NOT debugging in general) Link to comment
Castillo Posted June 7, 2010 Share Posted June 7, 2010 Nah , check ALL the mta scripting subforum and you will see im sorry but u copyed it from my code at least server side parts https://forum.multitheftauto.com/viewtopic.php?f=91&t=27814&st=0&sk=t&sd=a&start=15 but well, i fixed all code for you. client side: GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function toggleVisible ( ) 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 ( "F6", "down", toggleVisible ) local player = getPlayerName(getLocalPlayer()) local playerMoney = getPlayerMoney(source) local playerPoints = getElementData(getLocalPlayer(), "Points") local playerWins = getElementData(getLocalPlayer(), "Wins") local playerLoses = getElementData(getLocalPlayer(), "Loses") GUIEditor_Window[1] = guiCreateWindow(11,135,275,194,"User panel",false) guiSetVisible( GUIEditor_Window[1], false) GUIEditor_TabPanel[1] = guiCreateTabPanel(12,23,249,162,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("User",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(10,11,222,19,"Name: " .. player,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) GUIEditor_Label[2] = guiCreateLabel(10,32,222,19,"Money: $ " ..playerMoney,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) GUIEditor_Label[3] = guiCreateLabel(10,52,222,19,"Points: " .. playerPoints,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Label[4] = guiCreateLabel(10,52,222,19,"Wins: " .. playerWins,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Label[5] = guiCreateLabel(10,52,222,19,"Loses: " .. playerLoses,false,GUIEditor_Tab[1]) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) GUIEditor_Tab[2] = guiCreateTab("Shop",GUIEditor_TabPanel[1]) GUIEditor_Label[6] = guiCreateLabel(18,14,142,16,"Repair:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[4],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) GUIEditor_Label[7] = guiCreateLabel(18,33,142,16,"Nitro:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[5],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) GUIEditor_Label[8] = guiCreateLabel(18,53,142,16,"Barrel:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[6],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) GUIEditor_Label[9] = guiCreateLabel(18,73,142,16,"Haystack:",false,GUIEditor_Tab[2]) guiLabelSetColor(GUIEditor_Label[7],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) GUIEditor_Button[1] = guiCreateButton(67,14,46,17,"$3500",false,GUIEditor_Tab[2]) GUIEditor_Button[2] = guiCreateButton(62,34,46,17,"$2000",false,GUIEditor_Tab[2]) GUIEditor_Button[3] = guiCreateButton(50,54,46,17,"$1500",false,GUIEditor_Tab[2]) GUIEditor_Button[4] = guiCreateButton(88,74,46,17,"$3000",false,GUIEditor_Tab[2]) GUIEditor_Button[5] = guiCreateButton(92,94,46,17,"$4000",false,GUIEditor_Tab[2]) GUIEditor_Tab[3] = guiCreateTab("Credits",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(7,6,233,127,"User panel by loler",false,GUIEditor_Tab[3]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[4] = guiCreateTab("Top Points",GUIEditor_TabPanel[1]) GUIEditor_Label[9] = guiCreateLabel(9,11,223,21,"Coming soon",false,GUIEditor_Tab[4]) guiLabelSetColor(GUIEditor_Label[9],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[9],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[9],"left",false) function fixv() triggerServerEvent("fixRequest", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[1],fixv,false) function haystack() triggerServerEvent("haystack", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[4],haystack,false) function barrel() triggerServerEvent("barrel", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[3],barrel,false) function nitro() triggerServerEvent("nitro", getLocalPlayer()) end addEventHandler("onClientGUIClick",GUIEditor_Button[2],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 ) addEvent("haystack", true) addEventHandler("haystack", getRootElement(), function() local x,y,z = getElementPosition( source ) if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 99999 ) then takePlayerMoney(source, 99999) createObject ( 3374 , x , y , z ) outputChatBox("Haystack Successfully planted", 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("barrel", true) addEventHandler("barrel", getRootElement(), function() local x,y,z = getElementPosition( source ) if isPedInVehicle(source) then if ( getPlayerMoney (source) >= 100000 ) then takePlayerMoney(source, 100000) createObject ( 1225 , x , y , z ) outputChatBox("Barrel Successfully planted", 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 ) greetings, Castillo Link to comment
loler Posted June 7, 2010 Author Share Posted June 7, 2010 No i copyed it from https://forum.multitheftauto.com/viewtop ... a&start=15 just the nitro and repair was made by you but the anothers are mine :P Link to comment
loler Posted June 7, 2010 Author Share Posted June 7, 2010 It shows only the money and the name and the 2nd doesent exist Link to comment
Castillo Posted June 8, 2010 Share Posted June 8, 2010 Anyone pls use my userpanel if u dont know how to make the other working. Click here! 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