cokacola

Members
  • Content Count

    108
  • Joined

  • Last visited

Community Reputation

1 Neutral

About cokacola

  • Rank
    Punk-@ss B*tch
  • Birthday 25/01/1995

Details

  • Gang
    Bizzy's Private Army
  • Location
    NSW, Australia
  • Interests
    Coding, web dev, little desktop and game dev also.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ah. Well people who make resources/addons/etc for things say MTA or Garry's Mod, usually seem to call it scripting. But I am familiar with the term programming of course, I am one myself. I do all sorts. Web dev, desktop dev, some game scripting, game dev, mobile dev. Bit of everything really. And I wasn't saying I want to be paid for scripting, i was simply asking how much I'd have to pay someone else to do it because I don't have the time.
  2. Ah by resource? I figured most coders charged by the hour I mean if I had a good functional resource I could probably fix or upgrade stuff myself, but I don't have the time to get it to a functional playable fun state. But if there arent' any then the server will just have to be dead until one day in the future when I'm less busy, maybe when I'm done with university haha
  3. First off, no idea if this is the right section, if it isn't, feel free to move it. Second off, RPG(Yea, yea. I don't much play them at all but I know someone who seems to love the idea of having one). Probably not full time, but I am curious what respected scripters will charge. I assume it'll be by the hour so what it is your doing shouldn't matter too much. Basically just need skills with Lua and the MySQL library / SQL language. I don't expect it to be something ridiculous like $5 an hour, I just want to know whether or not I will be able to afford it when I got a job. So, anyone around here even looking for scripting jobs? If so, what do you charge and have you any proof that you aren't gonna scam me? Wouldn't want to have to go after you Just FYI, I am an MTA scripter of sorts myself, but I have absolutely no time for it. Which I imagine most people here probably don't either, but I thought I'd ask anyway. I manage to work maybe an hour or two a week if lucky. The other guy doesn't enjoy it much I don't think. So many random skype callings. I don't much like being called on Skype without my permission.
  4. Tried that, can't seem to cancel the explode event. Went clientside and canceled the onClientVehicleDamage if the health was below a certain point though. Did this: function handleVehicleDamage(attacker, weapon, loss, x, y, z, tyre) if getElementHealth(source) < 250 or (getElementHealth(source)-loss) < 250 then setElementHealth(source, 250) cancelEvent() end end addEventHandler("onClientVehicleDamage", root, handleVehicleDamage) In case anyone else wants to know how.
  5. Hi. I'd like to stop vehicles exploding and rather just leave them on fire(or low health) to disable them. Unfortunately, no matter how much I try, I cannot stop them exploding. Do I need to hook a clientside event for this and cancel it or what?
  6. Hey, thought I'd create a topic to release a few scripts I've created for my LAN server. Some of them probably need a bit of work or could be made a bit prettier(or maybe commented..) but they're fun at least. Littlebird Weapons I replaced my Sparrow with a littlebird and created some weapons for it with limited ammo. This is probably better with the actual littlebird model, so if you'd like me to turn this script into a resource with the littlebird model, let me know and I will. use O to switch weapons between the minigun and the missiles. Left ALT to fire. Problems: Well, I used the ammo available in the actual minigun object for the ammo limit. So, when you run out it seems to reload the minigun when you run out of ammo. Can probably be fixed so it doesn't do that. CODE Serverside: function initVehicle(veh) setElementData(veh,"a51.littlebird.gunAmmo",1000) setElementData(veh,"a51.littlebird.missileAmmo",30) setElementData(veh,"a51.littlebird.selectedWeapon",1) --1 = gun, 2 = missiles setElementData(veh,"a51.littlebird.hasInit",true) triggerClientEvent("cl_a51LittlebirdInit", getRootElement(), veh) end function switchWeapon(plr) local veh = getPedOccupiedVehicle(plr) if(getElementType(plr) ~= "player" or not veh or not getElementData(veh, "a51.littlebird.hasInit") or getVehicleOccupant(veh) ~= plr) then return end local cwep = getElementData(veh,"a51.littlebird.selectedWeapon") if(cwep == 1) then outputChatBox("Rockets Selected",plr) setElementData(veh,"a51.littlebird.selectedWeapon",2) else outputChatBox("Minigun Selected",plr) setElementData(veh,"a51.littlebird.selectedWeapon",1) end end function vehicleEnter(plr,seat,jacked) if(not getElementData(source, "a51.littlebird.hasInit") or seat ~= 0) then return end if(not getElementData(source, "a51.littlebird.hasInit")) then initVehicle(source) end bindKey(plr,"o","down",switchWeapon) end addEventHandler("onVehicleEnter",getRootElement(),vehicleEnter) function vehicleLeave(plr,seat,jacker) if(not getElementData(source, "a51.littlebird.hasInit")) then return end unbindKey(plr,"o","down",switchWeapon) --unbindKey(plr,"alt","down",fireWeapon) end addEventHandler("onVehicleExit",getRootElement(),vehicleLeave) function slb(plr,cmd) local x,y,z = getElementPosition(plr) x = x - 5 y = y - 5 local v = createVehicle(469,x,y,z,0,0,263.28314208984) initVehicle(v) end addCommandHandler("slb",slb) function myrot(plr) local rx,ry,rz = getElementRotation(plr) outputChatBox(rx..","..ry..","..rz,plr) end addCommandHandler("myrot",myrot) Client: local lbData = {} function fireWeapon(key,keystate,veh) if(not getElementData(veh, "a51.littlebird.hasInit") or getVehicleOccupant(veh) ~= getLocalPlayer()) then return end local cwep = getElementData(veh,"a51.littlebird.selectedWeapon") if(cwep == 1) then local firing = "ready" if(keystate == "down") then firing = "firing" end setWeaponState(lbData[veh]["gunLeft"],firing) setWeaponState(lbData[veh]["gunRight"],firing) elseif(keystate == "down") then local ammo = getElementData(veh,"a51.littlebird.missileAmmo") if(ammo < 1) then return end local x,y,z = getElementPosition(veh) local rx,ry,rz = getElementRotation(veh) createProjectile(veh, 19, x+5,y+5,z-2, 1.0, nil) createProjectile(veh, 19, x+5,y-5,z-2, 1.0, nil) setElementData(veh,"a51.littlebird.missileAmmo",ammo-1) end end addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then local veh = getPedOccupiedVehicle(thePlayer) if(veh and getElementData(veh, "a51.littlebird.hasInit") and getVehicleOccupant(veh) == getLocalPlayer()) then bindKey("lalt","both",fireWeapon, veh) end end end ) function attachRotationAdjusted ( from, to ) -- Note: Objects being attached to ('to') should have at least two of their rotations set to zero -- Objects being attached ('from') should have at least one of their rotations set to zero -- Otherwise it will look all funny local frPosX, frPosY, frPosZ = getElementPosition( from ) local frRotX, frRotY, frRotZ = getElementRotation( from ) local toPosX, toPosY, toPosZ = getElementPosition( to ) local toRotX, toRotY, toRotZ = getElementRotation( to ) local offsetPosX = frPosX - toPosX local offsetPosY = frPosY - toPosY local offsetPosZ = frPosZ - toPosZ local offsetRotX = frRotX - toRotX local offsetRotY = frRotY - toRotY local offsetRotZ = frRotZ - toRotZ offsetPosX, offsetPosY, offsetPosZ = applyInverseRotation ( offsetPosX, offsetPosY, offsetPosZ, toRotX, toRotY, toRotZ ) attachElements( from, to, offsetPosX, offsetPosY, offsetPosZ, offsetRotX, offsetRotY, offsetRotZ ) end function applyInverseRotation ( x,y,z, rx,ry,rz ) local DEG2RAD = (math.pi * 2) / 360 rx = rx * DEG2RAD ry = ry * DEG2RAD rz = rz * DEG2RAD local tempY = y y = math.cos ( rx ) * tempY + math.sin ( rx ) * z z = -math.sin ( rx ) * tempY + math.cos ( rx ) * z local tempX = x x = math.cos ( ry ) * tempX - math.sin ( ry ) * z z = math.sin ( ry ) * tempX + math.cos ( ry ) * z tempX = x x = math.cos ( rz ) * tempX + math.sin ( rz ) * y y = -math.sin ( rz ) * tempX + math.cos ( rz ) * y return x, y, z end function initVehicle(veh) local x,y,z = getElementPosition(veh) local rx,ry,rz = getElementRotation(veh) local gunLeft = createWeapon("minigun",x,y,z) local gunRight = createWeapon("minigun",x,y,z) setWeaponClipAmmo(gunLeft,1000) setWeaponClipAmmo(gunRight,1000) setElementRotation(gunLeft,0,0,- setElementRotation(gunRight,0,0,- setElementPosition(gunLeft,x,y+1,z-1) setElementPosition(gunRight,x,y-1,z-1) setElementCollisionsEnabled(gunLeft,false) setElementCollisionsEnabled(gunRight,false) attachRotationAdjusted(gunLeft,veh) attachRotationAdjusted(gunRight,veh) --attachElements(gunRight,veh,1,1,0,rx,ry,rz) setElementAlpha(gunLeft,0) setElementAlpha(gunRight,0) lbData[veh] = {} lbData[veh]["gunLeft"] = gunLeft lbData[veh]["gunRight"] = gunRight bindKey("lalt","both",fireWeapon, veh) end addEvent("cl_a51LittlebirdInit", true) addEventHandler("cl_a51LittlebirdInit",getLocalPlayer(),initVehicle) local screenWidth, screenHeight = guiGetScreenSize ( ) local root = getRootElement () function updateCamera () local veh = getPedOccupiedVehicle(getLocalPlayer()) if(veh) then local splr = getVehicleOccupant(veh) if(splr == getLocalPlayer() and getElementData(veh, "a51.littlebird.hasInit")) then local cwep = getElementData(veh,"a51.littlebird.selectedWeapon") local ammo = 0 if(cwep == 1) then ammo = getWeaponClipAmmo(lbData[veh]["gunLeft"]) else ammo = getElementData(veh,"a51.littlebird.missileAmmo") end dxDrawText(ammo, 44, screenHeight - 41, screenWidth, screenHeight) end end end addEventHandler ( "onClientPreRender", root, updateCamera ) I'll post more as I find them. I also have a fuel script that has a lot of the fuel stations in SA, but it's got XML files for the lua stations and server and clientside code so I guess like the littlebird above it'd probably work better as a resource.
  7. Hey guys, can't seem to think of how to do this(probably simple) but I am creating a couple jets that will follow a player after they fly over the restricted area, and I can't seem to think of how to determain what direction the ped needs to turn the plane(left or right) to point the plane in the direction of the player. Any ideas? EDIT: If you could give me a couple pointers on not having them manage to fly down into the ground, that would be helpful too(I want them to keep the altitude they started at). Thing is, I don't want to set the rotation, I want to actually use the set control thing so the ped properly flies(otherwise it looks rather weird), so I need to know whether to make them fly up, down, left or right. EDIT 2: Here is the full code if you want to see what I have so far: local Rzone1 = createColSphere(175.84280, 1889.23828,1, 200.0) --createMarker ( 175.84280, 1889.23828, 22.4141, "cylinder", 100.0) function planeFly(ped,plane,target) if(ped and plane and target) then local tx,ty,tz = getElementPosition(target) local px,py,pz = getElementPosition(plane) local rx,ry,rz = getElementRotation(plane) --local px,py = findRotation(px,py,tx,ty) --if(rx > px) then -- --elseif(rx < px) then -- --end setPedControlState(plane,"forwards",true) local rrx,rry,rrz = findRotation(px,py,tx,ty) if(rrx == nil) then rrx = 0 end if(rry == nil) then rry = 0 end if(rrx > 1) then rrz = -20 elseif(rrx < 0) then rrz = 20 else rrz = 0 end setElementRotation(plane,rrx,rry,rrz) --TEMPORARY! I want to make the vehicle drive properly! if(getDistanceBetweenPoints2D(px,py,tx,ty) < 100) then local bom = createProjectile(getLocalPlayer(), 20, (px+10), (py+5), (pz-10), 10.0, target ) end setTimer(planeFly,500,1,ped,plane,target) end -- end function makePlanes(target) local v1 = createVehicle(520,358.43,2038.49,335.4141) local v2 = createVehicle(520,308.43,2138.49,335.4141) local p1 = createPed(287,0,0,0) local p2 = createPed(287,0,0,0) warpPedIntoVehicle(p1,v1) warpPedIntoVehicle(p2,v2) setPedControlState(p1,"special_control_up",true) setPedControlState(p2,"special_control_up",true) --setTimer(setPedControlState,5000,1,p1,"special_control_uo",false) --setTimer(setPedControlState,5000,1,p2,"special_control_down",false) planeFly(p1,v1,target) planeFly(p2,v2,target) end function boemRadius(player, a) local x,y,z = getElementPosition(player) if (z >= 30) then local target = getPedOccupiedVehicle(player) if(target) then if(getVehicleType(target) == "Plane" or getVehicleType(target) == "Helicopter") then --[[local x,y,z = math.random(354.43,358.43),math.random(2028.49,2038.49),math.random(28.4141,35.4141) local bom = createProjectile(getLocalPlayer(), 20, x, y, z, 10.0, target ) setTimer( boemRadius, 2000, 1, player )]]-- setTimer(makePlanes,math.random(1000,5000),1,target) end end end end addEventHandler("onClientColShapeHit", Rzone1, boemRadius) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end (All in a clientside file)
  8. Looks like javascript to me. I think this forum is meant to be for Lua scripts for MTA, that isn't Lua and doesn't appear to have a whole lot to do with MTA either. It is too packed together for me to bother trying to figure out what it all does, but it looks like it is Google related.
  9. Basically I want the player to be damaged a certain amount based on how fast the car is going(not at all if it isn't going to fast), whether or not it is rolling, how damaged the car is, etc.
  10. I tried this(one of many kinds of randomness) : function vehicleDamage(theHitElement, force, bodypart, collisionX, collisionY, collisionZ, velocityX, velocityY, velocityZ, hitElementForce, model) if(getElementData(player,"kcar") ~= true) then local fDamageMultiplier = getVehicleHandling(source).collisionDamageMultiplier local damage = force * fDamageMultiplier local perc = (damage/1000) * 100 local player = getVehicleOccupant(source) local newHealth = getElementHealth(player) - perc setElementHealth(player,newHealth) end end addEventHandler("onClientVehicleCollision", root, vehicleDamage) But I just die, even if I am stopped and reversing into a wall. Plus I cannot figure out a good ratio for damage to player damage. Any idea?
  11. Hey guys, I quickly made up a little script to damage players in car accidents but the problem is it simply takes the vehicles damage of the player. The main problem with this is, if the player has 1 health and then breaks a headlight whilst the car is barely moving, the player will still be killed. I have a function(found it in my script, I think it came from the wiki) that can get the cars speed, but I am not entirely sure how to work it into this little script. Script for car damage: function vehicleLoss(loss) local thePlayer = getVehicleOccupant(source) if(thePlayer) then -- Check there is a player in the vehicle if(getElementData(thePlayer,"kcar") ~= true) then local th = getElementHealth(thePlayer)-tonumber(loss) if(th <= 0) then setElementHealth(thePlayer,0) else setElementHealth(thePlayer,th) end end end end addEventHandler("onVehicleDamage", getRootElement(), vehicleLoss) function kCar(plr,cmd) if(plr) then if(getElementData(plr,"kcar") == true) then setElementData(plr,"kcar","no") outputChatBox("You will now die in car accidents",plr) else setElementData(plr,"kcar",true) outputChatBox("You will no longer die in car accidents",plr) end end end addCommandHandler("kc",kCar) Little speed function I think I found on the wiki long ago: function getPlayerSpeed(player,mph) local velX,velY,velZ=getElementVelocity(getPedOccupiedVehicle(player) or player) return (velX^2+velY^2+velZ^2)^0.5*(mph and 100 or 161) end Now, while I might be able to work that out if I try some more, I'd also like to take rolling into consideration, so even if the vehicle isn't going incredibly fast, rolling down a hill could still kill the driver of the vehicle. Now, I am going to try some ideas if I can...right after I code the part that actually damages passengers(Don't worry, I know how to do this). Now, onto something slightly less important; I was playing on a server that added extra seats and such to the Nevada plane(probably a whole bunch of other vehicles too) I'd like to do something similar and was wondering how people go about coding this custom seats?(glue the player inside and work a mouse-movable camera script or something?)
  12. try something like this: <?php $fp = fsockopen("127.0.0.1", 22005, $errno, $errstr, 10); if (!$fp) { echo "Server is offline"; } else { echo "Server is online"; fclose($fp); } ?> If the server does not respond within 10 seconds, PHP will output "The server is offline", otherwise it will output "The server is online" Of course, replace 127.0.0.1 with your servers IP address and 22005 with your servers port.
  13. cokacola

    querying ASE

    Hey guys, when making a server browser, what is the best way to get the list of current MTA servers? I'd be doing this with C#. Is there an API? I tried with game-monitor, but their forum is down and the only SDK I found was from 2005. Any idea how I go about this?
  14. cokacola

    Math Problem

    http://wiki.multitheftauto.com/wiki/SetPedControlState --I've always used that, is there any big difference between the two? does that one not work on players?
  15. cokacola

    Math Problem

    I thought it would be on a timer or something, but I don't know much about players following players, so I cannot be greatly of assistance.