Jump to content

Vercetti1010

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by Vercetti1010

  1. Looking from what you have posted, it looks to be okay. I would check for typos in the function name you are trying to call. Honestly I can't really nail the problem because it appears that this is only a portion of the script you are working on. You might want to use tonumber on the part where you set the element data though, looks like you are trying to do math on a string.
  2. This problem might be resolved already, but I think there is one cause of this that wasn't mentioned. If you are running windows vista, or windows 7, then it is important to run all mod tools as an administrator every time. If you don't it will store some files in a hidden folder called virtualstore, where the game will pull those files instead of what is in your GTA directory. If you have installed the stock files back, and you still get this problem, that is likely why you are getting it. The files in your virtualstore are modded and the game is using those files instead of the directory files. What you need to do is open up a folder, any folder will do. Hit alt, and click tools, then folder options. In the view tab under advanced settings, click show hidden folders and uncheck hide protected operating system files. It will prompt you if you really want to show your OS files, and you do, so click yes, or OK, or whatever it is that lets them be visible. Click apply and keep that window open. In another window, navigate to C:\Users\yourname\AppData\VirtualStore\Program Files. If you see a folder called rockstar games in there, highlight it, and press Shift + Delete to permanently delete that folder. It will ask if you really want to delete it, click yes. Now go back to the folder options window and check hide protected operating system files and click do not show hidden folders, then click OK. Make sure you have the stock files in your directory, then run the game again, it should be back to normal now. After this is fixed, make sure you use modding tools as an administrator always, and never mod your vehicles.ide, handling.cfg or what have you, just stick to texture and model mods.
  3. Looks like it is just layed out backwards there almost. Try something like this (Sorry if there are any errors, the wiki is down and i can't make 100% sure i put the exact right function) function findPlayerMoney(player,command,player2) if (player2) then local name = getPlayerFromName(player2) if (name) then local playerMoney = getPlayerMoney(name) outputChatBox(player2.." has $"..tostring(playerMoney),player,255,255,0) else outputChatBox("No player found for "..player2,player,255,0,0) end else outputChatBox("Player not specified. The proper command goes like: /cash player",player,255,0,0) end end addCommandHandler("cash",findPlayerMoney) If you find the nickname autocomplete function, it makes this script a lot better too, since you don't have to type out people's whole names when looking them up in a command. I can't remember that off the top of my head, so this will do for now. Good luck with your scripting!
  4. Yeah, I noticed it had been down too. The wiki taxi thing didn't really work either, so my server development is sort of grinding to a halt while the wiki is down, lol. Is there any news on the wiki being down or maybe an eta for when it will come back up?
  5. Read the wiki on how command handlers work. Also check out the function lists and get to know it. You can easily teach yourself how to make good scripts and you will be really proud of yourself when you make your first thing. Just go check out development.mtasa.com
  6. If you do find a way to do it, good luck getting the trains to drive normally. There's a weird circumstance that happens whenever I drive a train. It will speed up all of a sudden, going really fast as if a hack was present on it, often causing derailment. Unless you can circumvent that issue if you experience that as well, I wouldn't invest too much effort into making a huge train.
  7. SAMP might have protection against some glitches already. That would be the best explanation I think, since all that happens in single player, and it happened in DP versions of MTA. However, for future knowledge. It is probably best to ask about an SAMP issue on the SAMP forums, as scripting for SAMP and MTA are different and the functions on our wiki only work on MTA. If this doesn't answer your question, then I apologize, it took me a minute to get a grasp of what you were talking about.
  8. You have to use a combination of a clientside script and a serverside script. Buttons and other GUI elements can only be done clientside. However, things that can affect gameplay for you and others, such as fixing a car, are best done serverside. You can pull this off, but you will need to link the two scripts. Create a custom serverside event to trigger the fix. Have the GUI button trigger a function that has triggerServerEvent in it. How the window opens and goes away is totally up to you. I hope I have helped a little
  9. By default, when a car is created, the engine should be off. However, when a vehicle is entered, the cars engine will turn on by itself. To counteract this, the game must detect when people enter, exit, or die in a vehicle in order to force the engine to stop. Most vehicles will not operate when the engine is off, but helicopters, planes, bikes, etc. will still work even with the engine being off. I don't think I need to mention bicycles though. Anyway, the code below should take care of your problem. Make sure you test it before you put it on your server though. function carOffEnter(player,seat,jacked) if (seat == 0) and (jacked == false) then setVehicleEngineState(source,false) end end function carOffExit(player,seat,jacked) if (seat == 0) and (jacked == false) then setVehicleEngineState(source,false) end end function carOffDead(totalAmmo,killer,killerWeapon,bodypart,stealth) local car = getPedOccupiedVehicle(source) if (car ~= false) then setVehicleEngineState(car,false) end end addEventHandler("onVehicleEnter",getRootElement(),carOffEnter) addEventHandler("onVehicleStartExit",getRootElement(),carOffExit) addEventHandler("onPlayerWasted",getRootElement(),carOffDead)
  10. I might take interest in this. I (and Benji) scripted a server called MoP and Brigs MTA, it was around for a while but was ultimatley unpopular. Tell me what kind of scripts you want and I may cook some up if I get some free time.
  11. Look in the script for the function that starts the set of events. Then all you would have to do is add a command handler and make it call that function. You might have to toy around with it to get the variables to work with both onColShapeHit and addCommandHandler though. If you figure it out, make sure you add the bomb shop resource under your admin group in your ACL and protect the command.
  12. Use x-fire. It has a browser.
  13. It also seems to do this on my laptop. I run Windows Vista Ultimate 32 bit edition, so it isn't likely a problem with Windows 7. I tried running it in compatibility to XP and run as administrator and it still does it. I sent a bug report. Other than that, this program looks quite promising, especially for absent minded people like me who sometimes forget to put in parentheses and have to alt-tab MTA just to fix one careless mistake. Thanks a bunch 50p!
  14. That is extremely cool. I never thought about that. Props to you!
  15. Yeah, definitely use colshapes. Its a pain in the ass to use commands. Make sure the colshape only triggers for what element you want it to trigger on. For instance, if you don't add this check, if someone drives in it, it will trigger for both the vehicle AND the player. do something like this: function openGate(theElement,matchingDimension) if (source == theColShape and getElementType(theElement) == "player") then moveObject(.......) end end Also make sure you add an event handler and function for when they exit the col shape so the gate will automatically close. As for the actual movement of the object, go to the wiki (development.mtasa.com) and search for moveObject. What you are going to have to do is create the object in the closed position, get the coordinates (and rotation too!) and then move the object to the open position, then do the same. Once you do that, for the function that opens the gate, tell it to move the gate to the open position. For when you exit, trigger a function that moves the gate to the closed position. You can even put restrictions to who or what opens it too, such as teams or what kind of element. That's another subject though. Try out what I said and I'm sure you will find success.
  16. This is certainly good news. I didn't anticipate this being complete before I finished my server, lol. Good job devs. Perhaps this will give SAMP a run for its money. Too bad I won't be on all the time though, my college starts in a week
  17. well i guess i made a mistake when codeing it i didnt realize i was useing setVehicleLightState on the driver but now i do so i can recode it now and fix my noobish mistakes Next time just make sure you check what the source of your event/command is and what the functions you use return. That can save you a lot of hassle and perhaps save from using unnecessary variables.
  18. Sweet, it works. Thanks a lot 50p, really appreciate your help. Cheers!
  19. Oh! I need to set it to false rather than true. I tried making them propagated but it didn't fix it. Maybe if I put false it will. Also thanks for the tip on the event handlers. That will save me lines of unnecessary code in the future. I will update if the propagated thing works.
  20. There are no onClientGUIDoubleClicks in anything that I make. nothing really calls for a use of double clicking. Heres the code you requested. addEvent("onClientPayNSprayEnter",true) function payNSprayGUI(vehicle) c1,c2,c3,c4 = getVehicleColor(vehicle) paynsprayWindow = guiCreateWindow(0.25208333,0.30222,0.507638889,0.375556,"Pay 'n' Spray",true) guiWindowSetSizable(paynsprayWindow,false) colorChart = guiCreateStaticImage(0.0123,0.0651,0.9754,0.7426,"images/chart.png",true,paynsprayWindow) colorOneSelect = guiCreateEdit(0.015,0.8817,0.0602,0.0917,tostring(c1),true,paynsprayWindow) guiEditSetMaxLength(colorOneSelect,3) colorTwoSelect = guiCreateEdit(0.0821,0.8817,0.0602,0.0917,tostring(c2),true,paynsprayWindow) guiEditSetMaxLength(colorTwoSelect,3) colorThreeSelect = guiCreateEdit(0.1491,0.8817,0.0629,0.0917,tostring(c3),true,paynsprayWindow) guiEditSetMaxLength(colorThreeSelect,3) colorFourSelect = guiCreateEdit(0.2189,0.8817,0.0643,0.0917,tostring(c4),true,paynsprayWindow) guiEditSetMaxLength(colorFourSelect,3) colorOneLabel = guiCreateLabel(0.0205,0.8195,0.052,0.0503,"Color 1",true,paynsprayWindow) guiLabelSetColor(colorOneLabel,255,255,255) guiLabelSetVerticalAlign(colorOneLabel,"top") guiLabelSetHorizontalAlign(colorOneLabel,"left",false) colorTwoLabel = guiCreateLabel(0.0848,0.8195,0.0616,0.0444,"Color 2",true,paynsprayWindow) guiLabelSetColor(colorTwoLabel,255,255,255) guiLabelSetVerticalAlign(colorTwoLabel,"top") guiLabelSetHorizontalAlign(colorTwoLabel,"left",false) colorThreeLabel = guiCreateLabel(0.1546,0.8225,0.0575,0.0533,"Color 3",true,paynsprayWindow) guiLabelSetColor(colorThreeLabel,255,255,255) guiLabelSetVerticalAlign(colorThreeLabel,"top") guiLabelSetHorizontalAlign(colorThreeLabel,"left",false) colorFourLabel = guiCreateLabel(0.2244,0.8225,0.0534,0.0414,"Color 4",true,paynsprayWindow) guiLabelSetColor(colorFourLabel,255,255,255) guiLabelSetVerticalAlign(colorFourLabel,"top") guiLabelSetHorizontalAlign(colorFourLabel,"left",false) paintButton = guiCreateButton(0.3105,0.8373,0.1382,0.1331,"Paint Vehicle: $1500",true,paynsprayWindow) randomButton = guiCreateButton(0.4624,0.8373,0.1395,0.1361,"Random Colors: $500",true,paynsprayWindow) repairButton = guiCreateButton(0.617,0.8373,0.1409,0.1361,"Repair Vehicle: $5000",true,paynsprayWindow) exitButton = guiCreateButton(0.7784,0.8373,0.145,0.1361,"Exit",true,paynsprayWindow) setVehicleFrozen(getPedOccupiedVehicle(getLocalPlayer()),true) showCursor(true,true) local dim = math.random(1,65535) setElementDimension(vehicle,dim) setElementDimension(getLocalPlayer(),dim) addEventHandler("onClientGUIClick",paintButton,paintVehicle) addEventHandler("onClientGUIClick",randomButton,randomColors) addEventHandler("onClientGUIClick",repairButton,repairCar) addEventHandler("onClientGUIClick",exitButton,exitPayNSpray) end function paintVehicle(button,state,abX,abY) local c1 = guiGetText(colorOneSelect) local c2 = guiGetText(colorTwoSelect) local c3 = guiGetText(colorThreeSelect) local c4 = guiGetText(colorFourSelect) local c1 = tonumber(c1) local c2 = tonumber(c2) local c3 = tonumber(c3) local c4 = tonumber(c4) if (c1 == nil or c2 == nil or c3 == nil or c4 == nil) then outputChatBox("Only numbers are accepted in the color field.",255,0,0) elseif ((c1 >= 0 and c1 <= 126) and (c2 >= 0 and c2 <= 126) and (c3 >= 0 and c3 <= 126) and (c4 >= 0 and c4 <= 126)) then local c1 = math.floor(c1) local c2 = math.floor(c2) local c3 = math.floor(c3) local c4 = math.floor(c4) local cost = 1500 triggerServerEvent("onVehicleSpray",getPedOccupiedVehicle(getLocalPlayer()),c1,c2,c3,c4,cost) else outputChatBox("Valid numbers are 0 through 126.",255,0,0) end end function randomColors(button,state,abX,abY) guiSetText(colorOneSelect,math.random(0,126)) guiSetText(colorTwoSelect,math.random(0,126)) guiSetText(colorThreeSelect,math.random(0,126)) guiSetText(colorFourSelect,math.random(0,126)) local c1 = guiGetText(colorOneSelect) local c2 = guiGetText(colorTwoSelect) local c3 = guiGetText(colorThreeSelect) local c4 = guiGetText(colorFourSelect) local cost = 500 triggerServerEvent("onVehicleSpray",getPedOccupiedVehicle(getLocalPlayer()),c1,c2,c3,c4,cost) end function repairCar(button,state,abX,abY) local cost = 5000 triggerServerEvent("onVehicleRepair",getPedOccupiedVehicle(getLocalPlayer()),cost) end function exitPayNSpray(button,state,abX,abY) removeEventHandler("onClientGUIClick",paintButton,paintVehicle) removeEventHandler("onClientGUIClick",randomButton,randomColors) removeEventHandler("onClientGUIClick",repairButton,repairCar) removeEventHandler("onClientGUIClick",exitButton,exitPayNSpray) destroyElement(paynsprayWindow) showCursor(false,false) setVehicleFrozen(getPedOccupiedVehicle(getLocalPlayer()),false) setElementDimension(getPedOccupiedVehicle(getLocalPlayer()),0) setElementDimension(getLocalPlayer(),0) end addEventHandler("onClientPayNSprayEnter",getRootElement(),payNSprayGUI)
  21. Hi. I have a problem with the resources that I make that include GUIs. The GUIs themselves work as intended, however, if I doubleclick something that doesn't trigger anything (most prominent being empty space in a window), my game will crash. I noticed this happens on almost all GUI related things I made, except for a few. I haven't changed the way I make GUIs and there are no errors in my code (well, none that debugscript 3 puts at least). I am running MTA 1.0 nightly r1457 if that helps any. Any help in this matter is appreciated.
  22. Oh, right. My mistake. I didn't read the script name and the parameters threw me off.
  23. It looks to me that you've mixed up the command handler parameters in your function. http://development.mtasa.com/index.php? ... andHandler playerSource is the player that gave the command. theCommand is the command that was given. and you can put various arguements after that, say you were making a command to set your position somewhere, you would add x,y,z or something of that nature. just make player first and it should work fine. also, server.outputchatbox is not necessary. All you need is outputChatBox() I recommend you get familiar with the wiki. It has all the info you need to get started, such as scripting functions, how to manage your server and documentation on several things like Weapon IDs and whatever. development.mtasa.com
  24. The first one Talidan posted should work, at least according to the wiki it should. All the functions it uses are compatible with DP2.x. It could just be one of those times where things just refuse to work though. I always seem to have functions not work for no reason. Is it possible to use setGravity instead of changing the velocity of the player?
  25. Hey Talidan, I tested that script, and It didn't exactly work right. I am using DP2.X if you are wondering, and I chose the correct script. The parachute will open, but every time a frame is rendered, it gives a warning for getElementRotation saying its a nil value. My fall speed isn't slowed. The parachute will go away when you hit water or land though so that works. How can I make it slow me down?
×
×
  • Create New...