Jump to content

cokacola

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by cokacola

  1. hello, i seem to have a problem. Well, i am attaching a cargo ship to my boat but no matter what i do, it always spawns with the side of the boat facing me, so the boat goes sideways.. theCargo = createObject(10230, 1016.2437133789, -2473.1711425781, 6.6930656433105, 0, 10, 0) function attachCargo(thePlayer) local car = getPedOccupiedVehicle(thePlayer) if(car) then local rx, ry, rz = getVehicleRotation(car) setObjectRotation(theCargo, rx, ry, rz) attachElements(theCargo, car, 0, -25, 0) setObjectRotation(theCargo, rx, ry, rz) outputChatBox("Here is the cargo!", thePlayer) else outputChatBox("This function only works in vehicles.", thePlayer) end end addCommandHandler("cargo", attachCargo) i have tried every form of rotation i could, and even, like above, setting the boats roation on the cargo ships rotation. so does anyway know how the fix this annoying bug?
  2. Hello, i know this topic is a few months old, but i have infact made a successful cruise control script, even though it is kinda weird --some form of cruise control theCruiseTimer = "noone-nothing" function cruiseOff(thePlayer) --its on, so turn it off killTimer(theCruiseTimer) theCruiseTimer = "noone-nothing" setControlState ( thePlayer, "accelerate", false ) setControlState ( thePlayer, "brake_reverse", false ) end function cruiseOn(thePlayer, speed, theCar) theCar1 = getPedOccupiedVehicle(thePlayer) if(theCar1) then local x1, y1, z1 = getElementVelocity(theCar) local speed1 = math.sqrt(x1^2 + y1^2 + z1^2) * 161 if(speed1 < speed) then setControlState ( thePlayer, "brake_reverse", false ) setControlState ( thePlayer, "accelerate", true ) elseif(speed1 > speed) then setControlState ( thePlayer, "accelerate", false ) setControlState ( thePlayer, "brake_reverse", true ) end else cruiseOff(thePlayer) end end function cruiseControl(thePlayer) local theCar = getPedOccupiedVehicle(thePlayer) if(theCruiseTimer == "noone-nothing") then if(theCar) then local x, y, z = getElementVelocity(theCar) .sqrt(x^2 + y^2 + z^2) * 161 local speed = math local.sqrt(x^2 + y^2 + z^ speed =2) * 161 math.sqrt(x^2 + y^2 + z^2) * 161 --its off, so turn it on theCruiseTimer = setTimer(cruiseOn, 50, 0, thePlayer, speed, theCar) else outputChatBox("Error: players don't have cruise control switches. Must be in car.", thePlayer) end else cruiseOff(thePlayer) end end addCommandHandler("ct", cruiseControl) it is a bit weird, so you may wanna remove the setControlState ( thePlayer, "brake_reverse", true ) and anything other setControlState with "brake_reverse" in it, thats only if you dis-like the constant breaking though. Now, when you type /ct this function should keep the car going what ever km/h speed your car is driving. have fun P.S. i don't care if anyone else has posted theirs already, so what, i posted mine too
  3. cokacola

    Gui help

    Thanks that method did work, no more showing GUIs to everyone for no apparent reason thanks again
  4. cokacola

    Gui help

    Hello, quick question, is there a specific way to make a GUI window show for only one person? I have a client side event and it is triggered serverside, but it shows for all players. I cant find any way to stop it..
  5. Yes i have a local 1.0 server and it works fine for me
  6. I have been wondering, has anyone got a working method to connect train trailers to trains? I tried with attachTrailerToVehicle but no avail Also, any one know how to SPAWN a brown streak trailer?
  7. is there an object ID i can use to create lights? like no traffic lights, but an actual light source, and for it to be an element, for example, i would have a slot on the wall with a light, if i unlock the door, its on, otherwise the light is off .. or "deleted" any help thanks. this could also be used to light up area 69 at night(i don't care if the lights move) thanks again Edit - figured it out, just make a marker using the carona or whatever(glowing ball of "light") now, help for something else instead: how do i loop through mysql results in lua? function createCars () local handler = mysql_connect("localhost", "root", "[passcoded.haha]********[/passcoded.haha]", "furbanjMTA") local result = mysql_query(handler, "SElECT * FROM `cars`") local numres = mysql_num_rows(result) while ( row=mysql_fetch_assoc(result) ) do --how its done in PHP crs = createVehicle ( row["model"], row["x"], row["y"], row["z"], 0.0, 0.0, row["rot"] ) setElementData ( crs, "vehdata.carown", row["owner"] ) end end somethinglike that, exept this is never ending. Thanks.. i like mysql and i am just attempting to make car ownership system(this is indeed in MTA 1.0 nightly) Edit2: fixed it, for all those wondering: local result = mysql_query(handler, "SElECT * FROM `cars`") if ( result ) then while true do local theCar= mysql_fetch_assoc(result) if (not theCar) then break end crs = createVehicle ( theCar["model"], theCar["x"], theCar["y"], theCar["z"], 0.0, 0.0, theCar["rot"] ) setElementData ( crs, "vehdata.carown", theCar["owner"] ) --outputChatBox("car ID " .. theCar["model"] .. " has been spawned.") end else outputDebugString("Error executing the query: (" .. mysql_errno(handler) .. ") " .. mysql_error(handler)) end
  8. ahh thanks, i have been using the GuiEditor resource, and didn't realize that it did not add that this time
  9. I cant take this anymore...all my GUi's work, but this one...does anyone see anything wrong with this line: armed_Window[1] = guiCreateWindow(287,125,215,157,"Join the Armed Forces",false) my other GUIs work, but this one is evil...
  10. I am about to start building a roleplay script for my server, and it probably won't be done for a very long time. My question is, should I build it in 1.0 or dp2.3? because 1.0 roadmap says its like 91% done, so i just wondered witch one to build it in. I am thinking 1.0 but unshore. Edit: another question also, if I do choose MTA 1.0 to build it, i did play with this once, and could never figure out how to make peds just wonder around without coding a huge movement script with forward key on peds and sensless amounts of markers so anyone know how to do that? just make them wonder the city, and maybe drive too? Edit2: i have decided to go with 1.0, but still need to know how to make bots walk / drive around like in singleplayer.
  11. hmm... why do i keep using source i do it evertime something doesn't work... okay well i will look into this i hope every1 is like this when they start not just me
  12. okay thanks i think i figured out how to debug the other night.. /debugscript 3 but it only shows me what i see in the console
  13. yea it was fixed...BTW silverFang this did work thanks
  14. *bump* anyone got a clue what's wrong with this yet? as far as i can remember its returning no errors...i didn't try doing it in XML because its too confusing.. but i cannot make it work and i think its SQL related
  15. hmm "player you're trying to heal is not in the front seat" aka bad argument at 'getPlayerOccupiedVehicle' (this line: if ( getPlayerOccupiedVehicle ( playerToHeal ) == getPlayerOccupiedVehicle ( thePlayer ) ) then ) yea i changed playerToheal to playerToHeal to see if it would work...
  16. so i should set it to...something else?(the vehicle occupied thingy) abnd what should i set it to? oh also, if it helps that much i will indent my code before posting o i can't help but show you my first job script ever(you can tell me how to improve it if you wish, for example, the map blip and text comes up on everyones screen not just the player doing the job - main reason i am posting it here - ) --dilivery mission createMarker(2221.9304199219, -1173.4736328125, 25.7265625, cylinder) truckJobMarkersStrt = createColCircle ( 2221.9304199219, -1173.4736328125, 10.0 ) function truckJobStart ( thePlayer ) playerUse = getClientName(source) missionon = playerUse outputChatBox("You've started a delivery mission. Get to the truck marker on the map to finnish and get paid.", playerUse) truckJobBlip = createBlip ( 857.07098388672, -1292.5166015625, 13.617831230164, 51, 2, 255, 0, 0, 255, 0 , getRootElement() ) end addEventHandler ( "onColShapeHit", truckJobMarkersStrt, truckJobStart ) function finnishTruckJob ( thePlayer ) playerUse = getClientName(thePlayer) if ( missionon == playerUse) then outputChatBox("Thanks for the crack! here is m..m...money..", playerUse) setPlayerWantedLevel(thePlayer, 3) givePlayerMoney(thePlayer, 5000) missionon = "none" destroyElement ( truckJobBlip ) end end truckJobEndMark = createColCircle(857.07098388672, -1292.5166015625, 10.0) addEventHandler ( "onColShapeHit", truckJobEndMark, finnishTruckJob )
  17. but indentation takes effort.... i'll edit the post
  18. yea it works now... "player in front seat has full health" every if just errors 1 after the other ... function medicJob ( thePlayer, command, playerToHeal ) medicPlayer = getClientName(thePlayer) healingPlayer = getPlayerFromNick(playerToHeal) playerTeam = getPlayerTeam ( thePlayer ) medicTeam = getTeamName ( playerTeam ) if ( medicTeam == "Medic" ) then if ( getPlayerOccupiedVehicle ( thePlayer ) == "Ambulance" ) then if ( getPlayerOccupiedVehicle ( playerToheal ) == "Ambulance" ) then if ( getElementHealth(healingPlayer) > 99 ) then if ( getPlayerMoney(healingPlayer) < 250 ) then setElementHealth(healingPlayer, 100) takePlayerMoney(healingPlayer, 250) givePlayerMoney(medicPlayer, 250) else outputChatBox("This player does not have enough money to be healed($250 required).", medicPlayer) outputChatBox("You do not have enough money to be healed($250 requires)", healingPlayer) end else outputChatBox("the player in the front seat has full health already.", medicPlayer) end else outputChatBox("the person you want to heal is not in the front seat of ths vehicle.") end else outputChatBox("You are not in an ambulance.", medicPlayer) end else outputChatBox("You'r not a medic.", medicPlayer) end end addCommandHandler("heal", medicJob) Edit: added indentation - since apparently it makes it easier to read or something...never made sense to me, it just a effort taking time thingy
  19. oops...i put soure there once to see if i would work...and i left it there it wasn't usually ... it used to be thePlayer getPlayerOccupiedVehicle ( thePlayer ) example on that ?
  20. bad argument @ 'getVehicleOccupent' in game it says "You are not the driver of this vehicle"
  21. okay, bored of making new topics, so this thread is for my questions on my server's scripts now okay mail script(few threads down) isn't working.. ticket script is working but i have a new non-working script.. i have tried and tried and tried to make this work, but i keep getting "you are not a medic" even when i am on the medic team... p.s - this script has no warnings or errors at all.. function medicJob ( thePlayer, command, playerToHeal ) medicPlayer = getClientName(thePlayer) healingPlayer = getPlayerFromNick(playerToHeal) medicTeam = getPlayerTeam ( thePlayer ) if ( medicTeam == "Medic" ) then -- also tried "medic" "teamMedic" and "teammedic" but i think its this line that is not working, as it says... "you are not a medic" if ( getVehicleOccupant(source, 0) == medicPlayer ) then if ( getVehicleOccupant(source, 1) == healingPlayer ) then if ( getElementHealth(healingPlayer) == 100 ) then if ( getPlayerMoney(healingPlayer) < 250 ) then setElementHealth(healingPlayer, 100) takePlayerMoney(healingPlayer, 250) givePlayerMoney(medicPlayer, 250) else outputChatBox("This player does not have enough money to be healed($250 required).", medicPlayer) outputChatBox("You do not have enough money to be healed($250 requires)", healingPlayer) end else outputChatBox("the player in the front seat has full health already.", medicPlayer) end else outputChatBox("the person you want to heal is not in the front seat of ths vehicle.") end else outputChatBox("You are not the driver of this vehicle.", medicPlayer) end else outputChatBox("You'r not a medic.", medicPlayer) end end addCommandHandler("heal", medicJob) help would be good
  22. i am confused....small example maybe?
  23. your in the credits... yes it worked thankyou thank you thank-you thank.you thank you! ^ okay now, is it possible, to have the reason(last parameter) go more than 1 word? or d i just add dashes oh well, just gotta solve my mail script now...few posts down oh well, feel free to use the script, and, in the script he posted above, if the player has enough money change takePlayerMoney(badPlayer, price) to: takePlayerMoney(badPlayer, money) and it works, oh and 1 more thing, if you use it, give him credit(and maybe me for the idea, but he basicly scripted it, because my code done nothing ) Edit: to save a new topic... should this work? --car indacators - /lc for left indicator, /rc for right indicator. function carindonl ( sourcePlayer ) sourcePl = getPlayerFromNick ( sourcePlayer ) setVehicleLightState ( sourcePl, 0, 1 ) setVehicleLightState ( sourcePl, 1, 1 ) end function carindonr ( sourcePlayer ) sourcePl = getPlayerFromNick ( sourcePlayer ) setVehicleLightState ( sourcePl, 1, 0 ) setvehicleLightState ( sourcePl, 1, 1 ) end function carindl () setTimer ( carindonl, 1000, 10 ) end function carindr () setTimer ( carindonr, 1000, 10 ) end addCommandHandler("lc", carindl) addCommandHandler("rc", carindr) it doesn't, but it says something to do with the setvehicleLightState's value being "nil" oh and whats the easiest job to script?
  24. is it not being passed codewise? or when its typed because i use this(example) "/ticket bizzycola 100 horrible" and it just returns an error
×
×
  • Create New...