-
Posts
367 -
Joined
-
Last visited
Everything posted by kieran
-
Thanks so much for all your help guys, works amazingly now, learned a lot!
-
How do I get the amount? Would I just change money_for_iron = givePlayerMoney ( selling_iron*100 ) to ironMoney = ( selling_iron*100 ) and then use your event?
-
To be honest that's making me a little more confused.... How would I make the argument?
-
Then how could I save it? The whole GUI system is meant to take x amount away from the players "iron" and add the x amount of money to his account... Should I just try setting the money as data (save it as a number) then trigger an event server side to get the number and give the player that amount of money? There must be a way to set it client side, otherwise givePlayerMoney should just be server function, right?
-
Well I am pretty new to using element data to save to account data, my PC went down a few weeks ago and only got back to scripting last week... So forgot a lot. I am trying to get the data and then setAccountData to be the element data, which will be the players money in this case, I am trying to force the server to update cash from client. Without it updating from client to server it won't save, so this is only way I can think of as my GUI is client side. If this doesn't make sense try read it over a few times haha, I am bad at explaining it.
-
Thanks, works great.... But now there's the small problem of keeping clients cash when server goes off... Here is what I tried. Server Client It shows "attempt to call 'MyIronMoneyz' (a number value)" Basically I am trying to set element data after getting money client side so I can get it server side and set the account data. I tried using toString but no joy, same with tonumber. MyIronMoney = getPlayerMoney (tonumber( localPlayer )) setElementData (localPlayer, "moneyz.set", MyIronMoney) It says that problem is server side on line 7... After I get this working that's it pretty much done, rest is just designing GUI etc, which is easy.
-
It just returns true, how can I get it to return amount? money_for_iron = givePlayerMoney ( selling_iron*100 ) recieved_money_for_iron = (tostring (money_for_iron)) guiSetText ( you_recieve_iron, "You recieved: $" ..recieved_money_for_iron )
-
Thanks, works a treat... But I have one final issue it is now saying "attempt to concatenate global 'money_for_iron' (a boolean value) function SellMyIron(button,state) if(button == "left" and state == "up") then if (source == button_sell_iron) then setElementData (localPlayer, "Iron.pres",(getElementData (localPlayer, "Iron.pres"))) TheIron = getElementData( localPlayer, "Iron.pres" ) if (TheIron) then selling_iron = guiGetText(AmountIronSelling) if (tonumber( TheIron ) >= tonumber( selling_iron )) then setElementData (localPlayer, "Iron.pres",(getElementData (localPlayer, "Iron.pres")or 0 ) - selling_iron) money_for_iron = givePlayerMoney ( selling_iron*100 ) guiSetText ( you_recieve_iron, "Your recieved: " ..money_for_iron ) --outputChatBox (""..selling_iron) end end end end end Not really an important part, but would be nice to have in it. says problem is on line 11 (on above snippet)
-
It sort of works, but now it says "attempt to compare string with number" setElementData (localPlayer, "Iron.pres",(getElementData (localPlayer, "Iron.pres"))) TheIron = getElementData( localPlayer, "Iron.pres" ) if (TheIron) then selling_iron = guiGetText(AmountIronSelling) if ( TheIron ) >= ( selling_iron ) then Do I need to convert string into number? How can I do that?
-
I am in the middle of making a job script, it sets element data and I know how to get the data as there is a label that displays the players "iron". But I am trying to make a shop to sell the iron and I don't know how to get element data from a player that clicks a button. Client Server Basically I want to get element data, then if it's greater or equal to the number in the edit box it will give the player money, the money will be the amount in edit box * 100 and then it will take the amount from edit box away from element data.
-
@NeXuS™ Will this trigger it so that the marker itself may only be used by "hitElement" or will all players be able to use that marker? I am just asking as I tried a similar thing in a script before, but the marker and blip shown to all players.
-
@!#NssoR_) and @NeXuS™ works perfect, thanks! but one more question... I also wish to set marker only visible/collidable with the player that spawns it as the position will be random later, will it already do this as it triggers client side or will the whole server be able to interact with it?
-
I am working on some script, thinking of making it iron miner, anywat here is the problem. Basically, I am creating markers etc client side, so I am trying to set element data on client and get it on server, but I am having troubles with any ways of getting it to save as an amount... Client Progress_Window = {} function ProGUI(hitElement, matchingDimension) if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then if getPlayerTeam(hitElement) and getTeamFromName("Job 1") then playerTeam = getPlayerTeam(hitElement) checkTeam = getTeamFromName("Job 1") if tostring(playerTeam) == tostring(checkTeam) then if isPedOnGround ( hitElement ) then Progress_Window = guiCreateWindow(0.25, 0.9, 0.55, 0.05, "Testing Progress", true) guiWindowSetSizable(Progress_Window, false) guiSetProperty(Progress_Window, "CaptionColour", "FFFF0000") somebar = guiCreateProgressBar( 0.01, 0.4, 1, 1, true, Progress_Window ) if ( somebar ) then setProgress = setTimer(function() progress = guiProgressBarGetProgress(somebar) if (progress) >= (tonumber (100)) then --I want it to save when bar is 100. guiSetProperty(Progress_Window, "CaptionColour", "FF00FF00") setElementData (hitElement, "Iron.pres", ?+1)--I want to save this as an amount, here is where I am stuggling. killTimer(setProgress) CompletedProgress = setTimer(function() guiSetVisible(Progress_Window, false) destroyElement(Progress_Window) destroyElement(ProMark) killTimer(CompletedProgress) end, 10000, 0) elseif (progress) <= (tonumber (100)) then guiProgressBarSetProgress(somebar, progress+50) end end, 2000, 0) else outputChatBox ("Something went wrong!") end end end end end end function ProStart( hitElement ) ProMark = createMarker (-3293, 2216, 1517, "checkpoint", 1, 0, 200, 55, 255, hitElement) addEventHandler("onClientMarkerHit", ProMark, ProGUI) end addEvent( "GoPro", true ) addEventHandler( "GoPro", resourceRoot, ProStart ) Server GoProMark = createMarker (-497.0654296875, -196.90234375, 78.404663085938, "cylinder", 1, 0, 200, 55, 255) local GoProTeam = createTeam("Job 1", 20, 100, 150) function GoProTrigger ( hitElement, matchingDimension ) if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then if getTeamFromName("Job 1") then local J1T = getTeamFromName("Job 1") if J1T then if isPedOnGround ( hitElement ) then setPlayerTeam(hitElement, J1T) triggerClientEvent ( "GoPro", resourceRoot ) triggerClientEvent ( "ShowIron", resourceRoot ) elseif not isPedOnGround ( hitElement ) then outputChatBox("You must be on foot to change team!", hitElement, 255, 0, 0) end end end end end addEventHandler("onMarkerHit", GoProMark, GoProTrigger) function SaveIron(quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then MyIron = getElementData( source, "Iron.pres" ) if (MyIron) then setAccountData (account, "Iron.saved", MyIron) end end end end addEventHandler("onPlayerQuit", getRootElement(), SaveIron) As you see, GUI pops up, progress bar is complete, then I want to set the player to have 1 under the string Iron, but how can I do that? I had the idea of doing setElementData (hitElement, "Iron.pres", ?+1) where "?" would be something like getElementData (hitElement, "Iron.pres", ?) but didn't know what to put in "?" Sorry if it's not clear, it is the first time I am ever trying to make a script for a job...
-
Not really related to anything, so getting posted here... This is only for windows users, only tested on windows 7 First thing's first, 3Ds max users may have noticed "acwebbrowser.exe *32" taking up a lot of CPU, so I found a simple way to stop this using a batch file. First of all try killing the process in your services, restart your PC and if it's still there then follow the below instructions. Create a batch file and paste a shortcut to it in your startup folder by pressing: Start> All Programs > Startup Next you need to write the batch file. taskkill /im acwebbrowser.exe /f taskkill /im acwebbrowser.exe /f timeout /t 2 taskkill /im AutodeskDesktopApp.exe /f taskkill /im senddmp.exe /f timeout /t 20 exit I'll explain the above a bit more.... taskkill kills a task, "/im" is image name, you put the process you wish to stop after it. "/f" tells it to force the process to stop. "timeout /t x " is basically telling it to set a timer to do nothing, then /t allows you to specify "x" time in seconds, I have put it there as AutodeskDesktopApp.exe sometimes doesn't load straight away. exit is obvious, it closes the command prompt. We kill acwebbrowser twice as it starts up again automatically, so killing twice stops it from restarting.... I am not the brightest, but ey! It works! So the reason I have made this incredibly simple batch is to give 3Ds max users more speed, as this process is there just to notify you of updates, and that's it... I've heard there is other ways to stop it, but personally I think this is easiest way. Please remember, it may cause issues, this is just something that's helped me personally and I thought I'd share it. Oh, and to start it again just click the desktop shortcut for Autodesk Desktop App.
-
Ah, okay, will look into it! Thanks again. Oh and good luck on the DX stuff!
-
Basically my idea was to get progress bar, after it is complete a player would recieve a certain amount of an item and it would be added to an existing amount, like when you give a player money! I also want to get that number and place it in as a label or something, but I am unsure how to save it or even create it, I have found xmCreateChild which I think would work, but would be unsure how to get the data..... (Obviously need more than xmlCreateChild, but is one I thought would best describe my idea.)
-
@NeXuS™ It now works! I switched the code round a bit, thanks a lot bud! Can finally start adding this GUI to markers now. Oh, and if you don't mind me asking unrelated question, how could I go about giving a player data, such as iron = 10 or tokens = 10 or something? Would it be as simple as exporting to xml?
-
@NeXuS™Nope, still not working, I know, there was 1 or 2 typos you made, but sorted them and still no result, kills the timer after it goes to 10, the whole idea was to check the progress outside the timer.... Progress_Window = {} function clientResourceStart( ) Progress_Window = guiCreateWindow(0.25, 0.9, 0.55, 0.05, "Testing Progress", true) guiWindowSetSizable(Progress_Window, false) guiSetProperty(Progress_Window, "CaptionColour", "FFFF0000") somebar = guiCreateProgressBar( 0.01, 0.4, 1, 1, true, Progress_Window ) if ( somebar ) then progress = guiProgressBarGetProgress(somebar) --The else here said it wanted to close line 9 with end setProgress = setTimer(function() guiProgressBarSetProgress(somebar, progress+10) if (progress) >= (tonumber (100)) then guiSetProperty(Progress_Window, "CaptionColour", "FF00FF00") killTimer(setProgress) end end, 2000, 10) else outputChatBox ("Something went wrong!") end end addEventHandler( "onClientResourceStart", resourceRoot, clientResourceStart) --Sorted that
-
I am messing with progress bars as I plan to make some jobs which require them, the problem is I can't figure out how to check the percentage of the progress bar... I am basically trying to start it as red, if it's 100% it will change to green. Here's what I tried. Progress_Window = {} function clientResourceStart( ) Progress_Window = guiCreateWindow(0.25, 0.9, 0.55, 0.05, "Testing Progress", true) guiWindowSetSizable(Progress_Window, false) guiSetProperty(Progress_Window, "CaptionColour", "FFFF0000") somebar = guiCreateProgressBar( 0.01, 0.4, 1, 1, true, Progress_Window ) if ( somebar ) then progress = guiProgressBarGetProgress(somebar)--Problem starts here. if (progress) >= (tonumber (100)) then guiSetProperty(Progress_Window, "CaptionColour", "FF00FF00") else --Problem ends here. setTimer ( function() guiProgressBarSetProgress(somebar, progress+10) --See below example. end, 2000, 10 ) else outputChatBox ("Something went wrong!") --See below example. end end end addEventHandler( "onClientResourceStart", resourceRoot, clientResourceStart ) --See below example. And here is my original script that doesn't change color. Progress_Window = {} function clientResourceStart( ) Progress_Window = guiCreateWindow(0.25, 0.9, 0.55, 0.05, "Testing Progress", true) guiWindowSetSizable(Progress_Window, false) guiSetProperty(Progress_Window, "CaptionColour", "FFFF0000") somebar = guiCreateProgressBar( 0.01, 0.4, 1, 1, true, Progress_Window ) --Creates it in window at bottom, will be more visually pleasing later. if ( somebar ) then setTimer ( function() --Timer will change progress by 10% every 2 seconds. progress = guiProgressBarGetProgress(somebar) guiProgressBarSetProgress(somebar, progress+10) end, 2000, 10 ) else outputChatBox ("Something went wrong!") end end addEventHandler( "onClientResourceStart", resourceRoot, clientResourceStart )--Will be changed later, just getting used to it for now. I also wish to create a small label with the percentage showing, how could I do this? I know I need to do "progress = guiProgressBarGetProgress(somebar)" but what after that? Thanks for all help/suggestions!
-
Not quite, you know when you press F and run? Basically that! haha.... But these ideas are good, thanks guys! And I am making stuff then replacing the models and collision files @NeXuS™ I am not just chucking it in randomly lmao.... Using example from another resource, but is for cars that have same dimensions, my ships dimensions are different to that of all others, I could raise the ship when it's spawned, but that would mean it would sink when ever it is hit or someone starts to enter it..... But col shapes are a great idea! I can just do it so cancels event if player is out of col shape is long way but may work...
-
Was looking for a way to actually make one, as you could climb into it from far away if it was a big ship.... Thanks anyway!
-
Hey, so making some vehicle skins etc on 3Ds Max, one of the big things I can't get my head around is how to move where a player enters a vehicle. The best example I can think of is on the huge cargo ships so many servers have, usually you enter the vehicle from the top on these custom ships, when you'd usually enter close to the water on normal ship. If you know of the function(s) that I'd need please leave them. Thanks for reading, if this is wrong place to post I'm sorry and please move to trash or something.
-
I can answer the not taking in car part.... Just simply use isPedOnGround. Here is a small code (I admiteddly had a lot of help with) that will only set a players team ONLY if he is on foot. local jobTeam = createTeam("Test Team", 20, 100, 150) --Create the team local jobMarker = createMarker(7002.419921875, -4831.384765625, 9.60000038147, "cylinder", 2.0, 20, 100, 150, 255) --And marker for team VehiclesTable = {} local myBlip = createBlipAttachedTo ( jobMarker, 55 ) --Random blip, I just thought why not? function takeJob(hitElement, matchingDimension) --define what hitElement is if isElement(hitElement) and getElementType(hitElement) == "player" and matchingDimension then --If it's a player and the player is in the same dimension then do something. if getTeamFromName("Test Team") then local team = getTeamFromName("Test Team") --This defines team if team then --This checks team if isPedOnGround ( hitElement ) then --If the player is on foot setPlayerTeam(hitElement, team) --Then do something here, this will set the team... elseif not isPedOnGround ( hitElement ) then --If player is not on foot outputChatBox("You must be on foot!", hitElement, 255, 0, 0) --Output a message saying he needs to be on foot end end end end end addEventHandler("onMarkerHit", jobMarker, takeJob) --When player hits marker the function is triggered Honestly too lazy to edit it right now, but I hope this helps you with isPedOnGround!
-
Well I made the stuff..... But how about vehicle tutorials!? You make a ship that's got a steering wheel at top while it was originally at bottom..... How the heck you move the position? And then there's the small fact of sizes....... What size is it from 3D Max to in game!? Is 0.1 in 3D Max equal to 1 meter on MTA? These are sort of needed pieces of information still an amazing tutorial, I learned a LOT.
-
I'm using triggerServerEvent to trigger it server side.... In fact there is a problem, it won't do anything so instead of making new topic I'm just gonna be a d**k and revive this Server Client Basically, it triggers the event, but it says it expects element at first argument of setElementModel (Don't worry about the elseif, that was me checking it to see if it registered mouse click and it did). Anyone know what I'm doing wrong? Noticed there isn't a simple easy to read skin shop script on community, so this is basically the main purpose of this script... (Later all skin names, etc will be added)