Jump to content

qaisjp

Retired Staff
  • Posts

    2,344
  • Joined

  • Days Won

    10

Everything posted by qaisjp

  1. Just forget what I said. Unimpressed.
  2. try this: local unique = md5(math.random(1,999)..'smama') function start() Speedboost = { createMarker (-3004,-841,0.11,"corona",10,255,0,0,105), } for i,v in pairs(Speedboost) do setElementData(v, unique, true, false) end end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), start ) Multiplier = 1.5 function SpeedBoost (player) if player ~= getLocalPlayer() then return end if not getElementData(source, unique) then return end if getElementType(player) == "player" then if isPedInVehicle ( player ) then local car = getPedOccupiedVehicle(player) if getVehicleController(car) == player then speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz +0.2) fixVehicle(car) playSoundFrontEnd(46) end end end end addEventHandler ( "onClientMarkerHit", getResourceRootElement(getThisResource()), SpeedBoost )
  3. destroyElement can be used server side (and client side, so try it server sided!!!) From server -> client: -- server function CreateStupidWindow(p) local name = getPlayerName(p) triggerClientEvent('StupidWindowPlease', root, name) end addCommandHandler('stupe', CreateStupidWindow) --client addEvent('StupidWindowPlease', true) function StupidWindow(stupidname) guiCreateWindow(0,0,1,1,stupidname or '', true) end addEventHandler('StupidWindowPlease', root, StupidWindow) This will make a stupid window for everyone when you type /stupe with the title of the window as the player who typed the command.
  4. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() truckSkins = { [206]=true, [133]=true } trucks = { [515]=true, [514]=true, [403]=true } playerClients = { } playerCols = { } playerBlips = { } jobClients = { } playerJobLocation = { }; local XMLTruckerLocations = xmlLoadFile ( "XML\\trucker_locations.xml" ) if ( not XMLTruckerLocations ) then local XMLTruckerLocations = xmlCreateFile ( "XML\\trucker_locations.xml", "trucker_locations" ) xmlSaveFile ( XMLTruckerLocations ) end local trucker_locations = xmlNodeGetChildren(XMLTruckerLocations) truckerLocations = {} for i,node in ipairs(trucker_locations) do truckerLocations[i] = {} truckerLocations[i]["x"] = xmlNodeGetAttribute ( node, "posX" ) truckerLocations[i]["y"] = xmlNodeGetAttribute ( node, "posY" ) truckerLocations[i]["z"] = xmlNodeGetAttribute ( node, "posZ" ) truckerLocations[i]["r"] = xmlNodeGetAttribute ( node, "rot" ) end xmlUnloadFile ( XMLTruckerLocations ) end ) function enterVehicle ( thePlayer, seat, jacked ) if ( trucks[getElementModel ( source )] ) and ( not truckSkins[getElementModel ( thePlayer )] ) and (seat == 0) then cancelEvent() outputChatBox ( "Only truckers drivers can drive Transports!", thePlayer ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) function startJob ( playerSource ) local x, y, z = getElementPosition ( playerSource ) if not playerClients[ playerSource ] then local numLocations = #truckerLocations if ( numLocations > 0 ) then repeatCount = 0; repeat local pickupPoint = math.random(numLocations) pickupx = truckerLocations[pickupPoint]["x"] pickupy = truckerLocations[pickupPoint]["y"] pickupz = truckerLocations[pickupPoint]["z"] pickupr = truckerLocations[pickupPoint]["r"] local jobDistance = getDistanceBetweenPoints3D ( x, y, z, pickupx, pickupy, pickupz ); repeatCount = repeatCount+1 until jobDistance > 100 and jobDistance < 800 + repeatCount*100 repeat local id = math.random( 10, 270 ) ped = createPed( tonumber( id ), pickupx, pickupy, pickupz ) setPedRotation ( ped, pickupr ) until ped playerClients[ playerSource ] = { }; table.insert( playerClients[ playerSource ], ped ); table.insert( jobClients, ped ); local pedBlip = createBlipAttachedTo ( ped, 41, 2, 255, 0, 0, 255, 1, 99999.0, playerSource) playerBlips[ playerSource ] = { }; table.insert( playerBlips[ playerSource ], pedBlip ); pedMarker = createMarker ( pickupx, pickupy, 0, cylinder, 6.5, 255, 255, 0, 150, playerSource) playerCols[ playerSource ] = { }; table.insert( playerCols[ playerSource ], pedMarker ); addEventHandler( "onMarkerHit", pedMarker, arrivePickup ) outputChatBox ( "Pickup the passenger with delivery located at the marker.", playerSource ); else outputChatBox ( "No passenger pickup points specified, contact an admin!", playerSource ); end else outputChatBox ( "You already have an assignment!", source ); end end addCommandHandler ("startjob", startJob); function arrivePickup ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then local x,y,z = getElementPosition(ped); local tx,ty,tz = getElementPosition(playerSource); setPedRotation(ped, findRotation(x,y,tx,ty) ); local numLocations = #truckerLocations if ( numLocations > 0 ) then local playerVehicle = getPedOccupiedVehicle ( playerSource ); if playerVehicle and trucks[getElementModel ( playerVehicle )] then local speedx, speedy, speedz = getElementVelocity ( playerSource ); local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5); if actualspeed < 0.25 then local occupants = getVehicleOccupants(playerVehicle); local seats = getVehicleMaxPassengers(playerVehicle); local freeSeats = 0; for seat = 0, seats do local occupant = occupants[seat]; if not occupant and tonumber(freeSeats) == 0 then freeSeats = freeSeats + 1; warpPedIntoVehicle ( ped, playerVehicle, seat ); if playerBlips[ playerSource ] then for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end end if playerCols[ playerSource ] then for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end end trailer = createVehicle ( 435, x-2 ,y-2 ,z+1) givePoint(playerSource) end end if tonumber(freeSeats) == 0 then outputChatBox ( "You don't have an empty seat for the passenger!", playerSource ); end else outputChatBox ( "Slow down to pick up the passenger!", playerSource ); end else outputChatBox ( "You do not have a driver vehicle!", playerSource ); end else outputChatBox ( "No passenger pickup points specified, contact an admin!", playerSource ); end end end end end addEvent("givePoint", true) function givePoint( playerSource ) local x,y,z = getElementPosition(ped); playerJobLocation[ playerSource ] = { }; playerJobLocation[ playerSource ] = { ["x"]=x, ["y"]=y, ["z"]=z }; repeat local dropOffPoint = math.random(numLocations) dropOffx = truckerLocations[dropOffPoint]["x"] dropOffy = truckerLocations[dropOffPoint]["y"] dropOffz = truckerLocations[dropOffPoint]["z"] local jobDistance = getDistanceBetweenPoints3D ( x, y, z, dropOffx, dropOffy, dropOffz ); until jobDistance > 1000 and jobDistance < 35000 local dropOffBlip = createBlip ( dropOffx, dropOffy, dropOffz, 41, 2, 255, 0, 0, 255, 1, 99999.0, playerSource) playerBlips[ playerSource ] = { }; table.insert( playerBlips[ playerSource ], dropOffBlip ); pedMarker = createMarker ( dropOffx, dropOffy, 0, cylinder, 6.5, 255, 255, 0, 150, playerSource) playerCols[ playerSource ] = { }; table.insert( playerCols[ playerSource ], pedMarker ); addEventHandler( "onMarkerHit", pedMarker, arriveDropOff ) outputChatBox ( "Drive your products to the destination marker.", playerSource ); end addEventHandler("givePoint", getRootElement(), givePoint) function arriveDropOff ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then local pedVehicle = getPedOccupiedVehicle ( ped ); local playerVehicle = getPedOccupiedVehicle ( playerSource ); if playerVehicle and trucks[getElementModel ( playerVehicle )] then if pedVehicle == playerVehicle then local speedx, speedy, speedz = getElementVelocity ( playerSource ); local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5); if actualspeed < 0.22 then removePedFromVehicle ( ped ); if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then destroyElement( ped ); playerClients[ playerSource ] = nil; end end for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end dx = tonumber(playerJobLocation[ playerSource ]["x"]); dy = tonumber(playerJobLocation[ playerSource ]["y"]); dz = tonumber(playerJobLocation[ playerSource ]["z"]); local tx,ty,tz = getElementPosition(playerSource); local jobDistance = getDistanceBetweenPoints3D ( dx, dy, dz, tx, ty, tz ); local jobDistanceKM = round(jobDistance/1000,2); local jobReward = round(10+(jobDistanceKM^0.75)*3000); givePlayerMoney ( playerSource, jobReward ); for k, jobLocation in pairs( playerJobLocation[ playerSource ] ) do if jobLocation then playerJobLocation[ playerSource ] = nil; end end outputChatBox ( "Job succesful, you earned "..jobReward.." dollar.", playerSource ); end else outputChatBox ( "Slow down to drop off the passenger!", playerSource ); end else outputChatBox ( "You have lost your passenger!", playerSource ); end else outputChatBox ( "You do not have a driver vehicle!", playerSource ); end end end end end function quitJob ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then destroyElement( ped ); playerClients[ playerSource ] = nil; end end for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end if playerJobLocation[ playerSource ] then for k, jobLocation in pairs( playerJobLocation[ playerSource ] ) do if jobLocation then destroyElement( jobLocation ); playerJobLocation[ playerSource ] =
  5. Dude. Chill out. And don't bump topics that are three freaking weeks old just to snark at other people. Sorry, didn't realise. Anyway, I did say it would never fit.
  6. qaisjp

    MTA Wallpapers

    Yeah.. really calming.
  7. qaisjp

    Strange View

    You have to post the pastebin, MTADiag doesn't fix it, MTADiag gives us information to help us fix your problem.
  8. What the fuck? Can't you just tell him to put the model of the Shamal interior inside the real shamal? It's not going to fit either way.
  9. Good server, I enjoyed it when playing alone. Didn't have the chance to play in a group. Bad things: EAR RAPE when using some powers. There is just killing, no stats or whatever.
  10. Perhaps scripting functions to detect if the player is using a controller, and what type (type 'a' should have the normal ps3/xbox controller design) so that you can custom-tailor your script (with function to turn off default controller actions) to the controller.
  11. qaisjp

    Source of Lua BBCode

    So does MTA wiki.
  12. Well, it depends on whether you are going to make it optimised, if your not going to make it optomised then its easy as hell.
  13. Hey there, since there are plenty of people who are willing to pay money for a script, I'm just making a topic to tell everyone that I'm available to script a resource for you and probably beat any other price. It's pretty simple, all you have to do is add me on Skype (qaisjp is my username) and tell me that you want to buy/request help. Payments are given over PayPal only, all code ownerships go to the creator (me) and the buyer. Reselling is prohibitied. Regards, qaisjp.
  14. Sounds like sarcasm above. Anyway, for a beginner and a first script, it's not some bad work. Remember to use Camel Casing in your functions.
  15. I would've done what Slothman said when I went open-source crazy, too late for that now
  16. qaisjp

    Problem

    // render video HRESULT hrVideo = pGraph->RenderFile( filePath, NULL ); then what was that
  17. qaisjp

    hey guys

    As if liking any page will make a difference...
×
×
  • Create New...