-
Posts
188 -
Joined
-
Last visited
Everything posted by Toffbrown
-
thanks for helping me, im greatly thankful for your help. sorry if i might need your help again :3
-
Ah that worked and i did not know you could have two shotcuts to equal another function "local gSelectedRow, gSelectedColumn" Cool it works but does not take players money, i don't really need the checking of the players cash
-
Thanks again, It says line 66 a nil value local gSelectedRow, gSelectedColumn = guiGetSelectedItem(GUIEditor_gridlist[1])
-
Ahh i was half asleep when i was creating it, maybe i should just fuck it and just give up
-
i used an example off another resource addEvent("givecred",true) addEventHandler("givecred",root, function (money,number) if (tonumber(number) > 0) then if ( getPlayerMoney (source) >= money ) then takePlayerMoney(source, money) local acc = getPlayerAccount ( source ) setElementData(source,"credi",getElementData(source,"credit")+number) setAccountData(acc,"credit",getElementData(source,"credit")) end end end ) this was what it originally was
-
Check if players money is more than 100 then if it is then take 100 else it outputs and says "You do not have enough money to buy Nitro"
-
i will post a picture of my GUI (first time using GUI with an Account so sorry of my difficulties)
-
Oh i see, i think so define number
-
Thanks that worked and it should be taking the money off me, and i have it defined local acc = getPlayerAccount ( client )
-
trololooooo giveNitro was triggered was outputted thanks man now the other problem is [2014-06-19 20:55:53] ERROR: mechupgrades\s.lua:74: attempt to compare number with nil which is because number has no value
-
Yeah Citizen, that is bassically what i mean. where the the player can can buy from the NPC and use at anytime he wants on anycar because he/she bought one, so i would use to apply the object addVehicleUpgrade ( playersource, 1010 ) because 1010 is 10x nitro so he can use it 10 times unless his care is destroyed.
-
Neither do i "toffbrown" version="1" type="script" name="upgrades" />
-
outputChatBox("same here too") and outputChatBox("ok, here is ok too") worked but still says [2014-06-18 23:48:43] ERROR: Client (Mr.Toff) triggered serverside event giveboomnitro, but event is not added serverside
-
No man
-
Oh i know that but it was referring to what you said previous, and still does not work IDK what we did wrong
-
Exact same error and i tried changing the Cylinder to cylinder but thats changes nothing and still says server side is not added when you guys can even clearly see i added it, Do you have an idea of how i can do it differently, i have a NPC who the player buys say nitro and then he can apply it later on to his car
-
thanks for helping me man Client local marker = createMarker( 1220.8000488281, -1427.3000488281, 12.39999961853, "Cylinder", 1.5, 0, 0, 0, 0) ----local ped = createPed(305,1220.8000488281, -1427.5999755859, 13.39999961853) createBlip (2000.763671875, 1539.0169677734, 13.5859375, 23 ,2 ) outputChatBox("this is alright",client) myFont = dxCreateFont( "BEBAS.ttf", 20 ) -- Create custom font GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_gridlist = {} windowjob = guiCreateWindow(392, 176, 408, 437, "Parts", false) guiWindowSetSizable(windowjob, false) guiSetVisible(windowjob, false) GUIEditor_Memo[1] = guiCreateMemo(25, 27, 367, 108, "This is the Vehicle Upgrades store, you can buy these objects to apply to your vehicle of any sort", false, windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_gridlist[1] = guiCreateGridList(21, 258, 366, 111, false, windowjob) guiGridListAddColumn(GUIEditor_gridlist[1], "Upgrades", 0.5) guiGridListAddColumn(GUIEditor_gridlist[1], "Price", 0.5) for i = 1, 3 do guiGridListAddRow(GUIEditor_gridlist[1]) end guiGridListSetItemText(GUIEditor_gridlist[1], 0, 1, "Colour", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 0, 2, "$100", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 1, "Nitro", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 2, "$1000", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 1, "Repair", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 2, "$250", false, false) GUIEditor_Button[2] = guiCreateButton(206, 379, 174, 48, "Cancel", false, windowjob) GUIEditor_Button[1] = guiCreateButton(21, 379, 175, 48, "Buy!", false, windowjob) function GuiOpen(hitElement) setElementData ( localPlayer, "ownskin", getElementModel (localPlayer) ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, GuiOpen) function GuiClose(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, GuiClose) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) triggerServerEvent ( "giveNitro", getLocalPlayer(), guiGetText( GUIEditor_gridlist[1], 1, 1)) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (305,1220.8000488281, -1427.5999755859, 13.39999961853) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 15 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Upgrades", x, y+1.5, _, _, tocolor( 255, 255, 0, 255 ), 1, myFont, "center", "center" ) end end end ) Server function() setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end) addEventHandler("onResourceStart",resourceRoot, function() local players = getElementsByType ( "player" ) for i,p in ipairs(players) do setElementData(p,"NitroT",false) setElementData(p,"FixT",false) setElementData(p,"ColourT",false) local sourceAccount = getPlayerAccount ( p ) if isGuestAccount ( sourceAccount ) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) else if (getAccountData(sourceAccount, "Nitro")) then setElementData(p,"Nitro",getAccountData(sourceAccount, "Nitro")) end if (getAccountData(sourceAccount, "Fix")) then setElementData(p,"Fix",getAccountData(sourceAccount, "Fix")) end if (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Colour",getAccountData(sourceAccount, "Colour")) end if not (getAccountData(sourceAccount, "Nitro")) and not (getAccountData(sourceAccount, "Fix")) and not (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) end ) addEventHandler("onPlayerLogout",getRootElement(), function (acc) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) setAccountData(acc,"Fix",getElementData(source,"Fix")) setAccountData(acc,"Colour",getElementData(source,"Colour")) setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end ) addEventHandler("onPlayerLogin", root, function ( _, theCurrentAccount) if (getAccountData(theCurrentAccount, "Nitro")) then setElementData(source,"Nitro",getAccountData(theCurrentAccount, "Nitro")) end if (getAccountData(theCurrentAccount, "Fix")) then setElementData(source,"Fix",getAccountData(theCurrentAccount, "Fix")) end if (getAccountData(theCurrentAccount, "Colour")) then setElementData(source,"Colour",getAccountData(theCurrentAccount, "Colour")) end end ) addEvent("giveNitro",true) addEventHandler("giveNitro",root, function (number) -- lets say number for example if (tonumber(number) > 0) then if ( getPlayerMoney (client) >= 100 ) then takePlayerMoney(client, 100) local acc = getPlayerAccount ( client ) setElementData(client,"Nitro",getElementData(client,"Nitro")+number) setAccountData(acc,"Nitro",getElementData(client,"Nitro")) else outputChatBox("You do not have enough money to buy Nitro",client,255,0,0,false) end end end ) -------addEvent("givenitro",true) --addEventHandler("givenitro",root, --function (money,100) --if (tonumber(number) > 0) then --if ( getPlayerMoney (source) >= 100 ) then ---takePlayerMoney(source, 100) --local acc = getPlayerAccount ( source ) ---setElementData(source,"Nitro",getElementData(source,"Nito")+number) --setAccountData(acc,"Nitro",getElementData(source,"Nitro")) --else ---outputChatBox("You do not have enough money to buy Nitro",source,255,0,0,false) ---end --end ---end
-
oh aha sorry about that It output fine still error [2014-06-18 19:01:39] ADMIN: Resource 'mechupgrades' restarted by Mr.Toff(toff) [2014-06-18 19:01:39] Stopping mechupgrades [2014-06-18 19:01:39] Resource 'mechupgrades' changed, reloading and starting [2014-06-18 19:01:40] Starting mechupgrades [2014-06-18 19:01:40] SCRIPT ERROR: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 19:01:40] ERROR: Loading script failed: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 19:01:40] mechupgrades restarted successfully [2014-06-18 19:01:54] ERROR: Client (Mr.Toff) triggered serverside event giveNitro, but event is not added serverside [2014-06-18 19:02:02] SCRIPT: Mr.Toff(toff) set his script debug mode to 3 [2014-06-18 19:02:06] ADMIN: Resource 'mechupgrades' restarted by Mr.Toff(toff) [2014-06-18 19:02:06] Stopping mechupgrades [2014-06-18 19:02:06] Starting mechupgrades [2014-06-18 19:02:06] SCRIPT ERROR: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 19:02:06] ERROR: Loading script failed: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 19:02:06] mechupgrades restarted successfully [2014-06-18 19:02:16] ERROR: Client (Mr.Toff) triggered serverside event giveNitro, but event is not added serverside
-
you can't use local player with server side though
-
i tried that but says the same error not executing serverside
-
Thanks ill try that
-
its not setting the elements to the account for instance the Nitro and when i click buy it says its not added serverside when it is unless i am triggering the wrong event in serverside....? [2014-06-18 12:21:37] Starting mechupgrades [2014-06-18 12:21:37] SCRIPT ERROR: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 12:21:37] ERROR: Loading script failed: mechupgrades\s.lua:1: '<name>' expected near '(' [2014-06-18 12:21:37] mechupgrades restarted successfully [2014-06-18 12:21:42] ERROR: Client ((S.W.A.T)Mr.Toff) triggered serverside event givenitro, but event is not added serverside [2014-06-18 12:22:35] ERROR: Client ((S.W.A.T)Mr.Toff) triggered serverside event givenitro, but event is not added serverside [2014-06-18 12:28:16] ADMIN: Resource 'mechupgrades' restarted by (S.W.A.T)Mr.Toff(toff) and i don't see where on line 1 it needs a close bracket
-
I can not get it to work properly ----- Cient local marker = createMarker( 1220.8000488281, -1427.3000488281, 12.39999961853, "Cylinder", 1.5, 0, 0, 0, 0) ----local ped = createPed(305,1220.8000488281, -1427.5999755859, 13.39999961853) createBlip (2000.763671875, 1539.0169677734, 13.5859375, 23 ,2 ) myFont = dxCreateFont( "BEBAS.ttf", 20 ) -- Create custom font GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_gridlist = {} windowjob = guiCreateWindow(392, 176, 408, 437, "Parts", false) guiWindowSetSizable(windowjob, false) guiSetVisible(windowjob, false) GUIEditor_Memo[1] = guiCreateMemo(25, 27, 367, 108, "This is the Vehicle Upgrades store, you can buy these objects to apply to your vehicle of any sort", false, windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_gridlist[1] = guiCreateGridList(21, 258, 366, 111, false, windowjob) guiGridListAddColumn(GUIEditor_gridlist[1], "Upgrades", 0.5) guiGridListAddColumn(GUIEditor_gridlist[1], "Price", 0.5) for i = 1, 3 do guiGridListAddRow(GUIEditor_gridlist[1]) end guiGridListSetItemText(GUIEditor_gridlist[1], 0, 1, "Colour", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 0, 2, "$100", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 1, "Nitro", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 1, 2, "$1000", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 1, "Repair", false, false) guiGridListSetItemText(GUIEditor_gridlist[1], 2, 2, "$250", false, false) GUIEditor_Button[2] = guiCreateButton(206, 379, 174, 48, "Cancel", false, windowjob) GUIEditor_Button[1] = guiCreateButton(21, 379, 175, 48, "Buy!", false, windowjob) function GuiOpen(hitElement) setElementData ( localPlayer, "ownskin", getElementModel (localPlayer) ) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, GuiOpen) function GuiClose(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, GuiClose) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) function removeUpWindow() guiSetVisible(windowjob, false) showCursor(false) triggerServerEvent ( "giveNitro", localPlayer, guiGetText( GUIEditor_gridlist[1], 1, 1)) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeUpWindow, false) local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (305,1220.8000488281, -1427.5999755859, 13.39999961853) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 15 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Upgrades", x, y+1.5, _, _, tocolor( 255, 255, 0, 255 ), 1, myFont, "center", "center" ) end end end ) ----Server function() setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end) addEventHandler("onResourceStart",resourceRoot, function() local players = getElementsByType ( "player" ) for i,p in ipairs(players) do setElementData(p,"NitroT",false) setElementData(p,"FixT",false) setElementData(p,"ColourT",false) local sourceAccount = getPlayerAccount ( p ) if isGuestAccount ( sourceAccount ) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) else if (getAccountData(sourceAccount, "Nitro")) then setElementData(p,"Nitro",getAccountData(sourceAccount, "Nitro")) end if (getAccountData(sourceAccount, "Fix")) then setElementData(p,"Fix",getAccountData(sourceAccount, "Fix")) end if (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Colour",getAccountData(sourceAccount, "Colour")) end if not (getAccountData(sourceAccount, "Nitro")) and not (getAccountData(sourceAccount, "Fix")) and not (getAccountData(sourceAccount, "Colour")) then setElementData(p,"Nitro",0) setElementData(p,"Fix",0) setElementData(p,"Colour",0) end ) addEventHandler("onPlayerLogout",getRootElement(), function (acc) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) setAccountData(acc,"Fix",getElementData(source,"Fix")) setAccountData(acc,"Colour",getElementData(source,"Colour")) setElementData(source,"Nitro",0) setElementData(source,"Fix",0) setElementData(source,"Colour",0) end ) addEventHandler("onPlayerLogin", root, function ( _, theCurrentAccount) if (getAccountData(theCurrentAccount, "Nitro")) then setElementData(source,"Nitro",getAccountData(theCurrentAccount, "Nitro")) end if (getAccountData(theCurrentAccount, "Fix")) then setElementData(source,"Fix",getAccountData(theCurrentAccount, "Fix")) end if (getAccountData(theCurrentAccount, "Colour")) then setElementData(source,"Colour",getAccountData(theCurrentAccount, "Colour")) end end ) addEvent("giveNitro",true) addEventHandler("giveNitro",root, function () if (tonumber(100) > 0) then if ( getPlayerMoney (source) >= 100 ) then takePlayerMoney(source, 100) local acc = getPlayerAccount ( source ) setElementData(source,"Nitro",getElementData(source,"Nitro")+number) setAccountData(acc,"Nitro",getElementData(source,"Nitro")) else outputChatBox("You do not have enough money to buy Nitro",source,255,0,0,false) end end end ) -------addEvent("givenitro",true) --addEventHandler("givenitro",root, --function (money,100) --if (tonumber(number) > 0) then --if ( getPlayerMoney (source) >= 100 ) then ---takePlayerMoney(source, 100) --local acc = getPlayerAccount ( source ) ---setElementData(source,"Nitro",getElementData(source,"Nito")+number) --setAccountData(acc,"Nitro",getElementData(source,"Nitro")) --else ---outputChatBox("You do not have enough money to buy Nitro",source,255,0,0,false) ---end --end ---end Any help would be appreciated been working on this for a day or two and going no where with it
-
what about nitro though would i store it then setElementData and then add it to the current vehicle
-
Thanks heaps i had a fairly rough idea i would need those