Jump to content

kevin433

Members
  • Posts

    66
  • Joined

  • Last visited

kevin433's Achievements

Snitch

Snitch (10/54)

0

Reputation

  1. Yeah, sorry. I didn't thought of that when I created the script. The problem is that I don't need help very often, and then I write automatically in my language. (Either norwegian or german) 1. No, I didn't get any errors 2. I got infinite money when I stayed in the checkpoint and the checkpoint were I had to empty it was the same I was standing in. That was the problem. I fixed it now. Thanks! Can you just show me a little snippet of code which show how I can improve it?
  2. Ok, I now decided to make it Client and Server-side, but I have some problems. When I enter the checkpoint the ckeckpoint doesn't get deleted and I just get infinite money. Can someone help me with this? here's my code: Client-side: MullCheckpoints = { {-2363.0908203125,1017.8466796875, 50.6953125}, --> SF {-1723.16015625,1368.2421875, 7.046875}, {-1803.8447265625,959.4697265625, 24.890625}, {-1930.8134765625,831.3427734375, 38.341430664063}, {-1813.7744140625,615.0048828125, 35.171875}, {-2685.2626953125,270.13671875, 4.3359375}, {-2333.34375,-133.62890625, 35.3203125}, -- <-- SF {-2146.5927734375,-2445.44921875, 30.625}, -- ANGEL PINE {784.13671875,-1607.7431640625, 13.3828125}, --> LS {1194.9658203125,-880.6630859375, 43.038318634033}, {2116.013671875,-1777.853515625, 13.390511512756}, {2374.3203125,-1936.41796875, 13.546875}, {2393.4794921875,-1492.53515625, 23.828125}, {2337.5322265625,73.4375, 26.479593276978}, {206.5341796875,-170.6806640625, 1.578125}, -- <-- LS {1903.111328125,2099.689453125, 10.8203125}, {2059.3154296875,2214.3447265625, 10.8203125}, {2147.62109375,2812.025390625, 10.8203125}, {2369.4150390625,2575.9501953125, 10.8203125}, {2441.6962890625,2002.6728515625, 10.8203125}, {2630.16796875,1843.37109375, 10.8203125}, {2627.6259765625,1669.390625, 10.8203125}, {2842.8544921875,2393.1708984375, 10.8203125} } function MarkerCreaten() randommuell = math.random(#MullCheckpoints) muellblip = createBlip(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3], 11, 2, 255,0,0,170, 0, 99999.0) muellmark = createMarker(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3],"checkpoint", 6.0, 255,0,0,170) end addEvent("MuellMarkerCreaten", true) addEventHandler("MuellMarkerCreaten", getRootElement(), MarkerCreaten) function CheckpointHit(player) if(getElementData(player, "MussEntleeren") == 0) then if(getElementData(player, "Muell") >= 100) then destroyElement(muellblip) destroyElement(muellmark) muellblip = createBlip(-1871.685546875,-1718.490234375, 21.75, 11, 2, 255,0,0,170,0,99999.0) muellmark = createMarker(-1871.685546875,-1718.490234375, 21.75, "checkpoint", 6.0, 255,0,0,170) outputChatBox("Du musst deinen Trashmaster entleeren!") setElementData(player, "MussEntleeren", 1) else destroyElement(muellblip) destroyElement(muellmark) muellblip = createBlip(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3], 11, 2, 255,0,0,170, 0, 99999.0) muellmark = createMarker(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3],"checkpoint", 6.0, 255,0,0,170) local muellrandom = math.random(30) triggerServerEvent("Geldbekommen", getLocalPlayer(), player, muellrandom) outputChatBox("Du hast "..muellrandom.." Muelleinheiten geladen!") setElementData(player, "Muell", getElementData(player, "Muell")+muellrandom) end else destroyElement(muellblip) destroyElement(muellmark) muellblip = createBlip(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3], 11, 2, 255,0,0,170, 0, 99999.0) muellmark = createMarker(MullCheckpoints[randommuell][1],MullCheckpoints[randommuell][2],MullCheckpoints[randommuell][3],"checkpoint", 6.0, 255,0,0,170) outputChatBox("Du hast deinen Trashmaster entleert und 1000$ verdient!") triggerServerEvent("Geldbekommen", getLocalPlayer(), player, 166.66667) setElementData(player, "MussEntleeren", 0) setElementData(player, "Muell", 0) end end addEventHandler("onClientMarkerHit", getRootElement(), CheckpointHit) Server-side function MuellMoney(player, muell) if(getElementData(player, "InJob") == 1) then if(getElementData(player, "Hauptjob") == 5 or getElementData(player, "Hauptjob") == 6) then if(getPedSkin(player) == 27) then if(player and muell) then setElementData(player, "Muell", 0) local rechnung = muell*6 setElementData(player, "Geld", getElementData(player, "Geld")+rechnung) setPlayerMoney(player, getElementData(player, "Geld")) outputChatBox("Dein Trashmaster wurde entleert und du hast ".. rechnung .."$ verdient!", player) end end end end end addEvent("Geldbekommen", true) addEventHandler("Geldbekommen", getRootElement(), MuellMoney)
  3. Hello everyone! I'm currently trying to create a "trash" job for my server. The objective is to get in the Trashmaster, and then random a checkpoint appears. Each time the person enters the checkpoint, a random value gets added to the existing value of the person, and if the value is e.g above 100, he must drive back to a specific checkpoint where he gets his value updatet to 0. My only problem with this is to create the Checkpoints. I really want this to be server-side, but when I create a checkpoint and then delete it, it gets deleted for everyone. Is there any other way to make it server-side without deleting the checkpoint for everyone, or do I just have to do it client-side?
  4. Try this (Not tested, but I think it should work): function enterVehicle (player) local id = getElementModel (source) if normalcars[getElementModel (source)] then if (getAccountData (getPlayerAccount (player), "License-A") == "false") then --removePedFromVehicle ( player) outputChatBox ( "You're not allowed to drive this car! Buy a license at the office!", player,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (player), "License-A") == "true") then outputChatBox ( "You're allowed to drive this car!", player) end elseif aircrafts[getElementModel (source)] then if (getAccountData (getPlayerAccount (player), "License-B") == "false") then --removePedFromVehicle (player) outputChatBox ( "You're not allowed to fly this aircraft! Buy a license at the office!", player,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (player), "License-B") == "true") then outputChatBox ( "You're allowed to fly this aircraft!", player) end elseif military[getElementModel (source)] then if (getAccountData (getPlayerAccount (player), "License-C") == "false") then --removePedFromVehicle (player) outputChatBox ( "You're not allowed to use military vehicles or aircrafts! Buy a license at the office!", player,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (player), "License-C") == "true") then outputChatBox ( "You're allowed to use military vehicles or aircrafts!", player) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) As MaddDog said, source is not the player, but the vehicle which has been entered.
  5. Thank you varez and 50p! Works great now!
  6. I'd like to answer your question but I don't get your idea. I meant when the remaining gas in the Gasstation is dropping, the fuel price is getting higher per liter. Like this: Remaining Gas in station: 500 Remaining gas in Car: 50/70 "standard" gas price: 9$ After I have filled up my car it should be like this:
  7. Hi, I'm currently trying to fix my vehicle system, since it was messed up. I store the car information in the SQL Database, and I want to create a DB with this: executeSQLCreateTable("Vehicles", "CarID INT IDENTITY,Owner TEXT ,ModelID INTEGER, PosX FLOAT, PosY FLOAT, PosZ FLOAT, PosRotX FLOAT,PosRotY FLOAT, PosRotZ FLOAT, Color1 INT, Color2 INT, Color3 INT, Color4 INT, Damage FLOAT, KMH1 INT, KMH2 INT, MaxFuel INT, CurrentFuel INT, Locked INT") I want to give "CarID" a uniqe ID, so every vehicle can have a uniqe ID. But IDENTITY isn't working, it doesn't even set a value in the "CarID" field. I also tried "AUTO_INCREMENT", but this also doesn't work. EDIT: Fixed it....
  8. I just added the coordinates from every Gas Station right to in the Table, and now I just load the remaining gas amount in the Gas Station with a "Gas Station ID". Here's a little question, because I don't want to create a new Topic just because of a small math thing: How can I get a higher Gas price when the amount of gas is getting "smaller"?
  9. I've created a Table in the SQL Database, and it's layout is like this: PosX FLOAT PosY FLOAT PosZ FLOAT Liter (amount of fuel in english) INTEGER I then want to store them into a table when I start the server.
  10. Thank you 50p! My last thing I want to ask is: How should I load them into the Table?
  11. Hi, I just wondered how I set up tables which have e.g 3 coords and this 5 times. Like this: x,y,z x2,y2,z2 x3,y3,z3 I know how to do it in SA:MP, but not in MTA. I've also searched through the forum and google for a tutorial for "how I create tables in LUA", but I didn't found anything like this. I want this because I want to load multiple coordinates for the gas stations, and then later check if the Player is near them.
  12. Thanks for your answer Hankey. We re-installed GTA and MTA, and then it finally worked.
  13. Hi, My friend got a problem. When he starts MTA, he is sees the splash-screen, but the game is minimzed. He then can't maximize it, it won't "open". After that he has to stop the .exe through the Task-manager. I searched in the forum for solutions, but everything we tried didn't work. We also tried the "Known issues" page on the MTA WIKI, but those solutions didn't work either. His PC specs are: Windows 7 Home Premium 64-bit Intel Core 2 Dou T6600 @ 2.2GHz Ati Radeon HD 4570 4GB RAM The singleplayer and SA:MP are also working. We tried to run MTA with admin' rights and run with the gta_sa.exe and the MultiTheftAuto.exe in XP Service Pack 3.0 compatible mode. But that didn't work either. We both wonder now why it doesn't work.
  14. Found it there. Thanks robhol!
  15. Before I started scripting in MTA:SA I've messed around with some files. I wanted to test something out, therefore I wrote the word "ROFL" in the code of a file I don't remember the name of. Now everytime I start my server it says: "ROFL" is in the same colour as the "Connected!" message. I've searched through every resource that that my server has running, but I haven't found "ROFL" in any of them. I've even searched through the Server-files for the word "ROFL", but it's neither there. When I deactivated the resource "admin" it disappeared. I then searched through the code of it again, but I couldn't find it. Where else can it be?
×
×
  • Create New...