Jump to content

DakiLLa

Members
  • Posts

    965
  • Joined

  • Last visited

Everything posted by DakiLLa

  1. guys..i think you are talking about different things
  2. hi there. i got one problem: i have next: addCommandHandler( "test", function ( player ) local name = getPlayerName( player ); local i = string.find( name, "|", 1, plain ); if i then outputChatBox( "You got a char '|' in "..i.." index" ); end; end ); if i have a '|' symbol in playername, then how can i replace it, if i know it's index position?
  3. try to setElementInterior of your vehicle after its spawn.. like this: addCommandHandler( "int", function( player ) local vehicle = getPlayerOccupiedVehicle( player ) if vehicle then local int = getElementInterior( player ) setElementInterior( vehicle, int ) end end )
  4. i think its impossible to attach train trailers at this moment.. there is an issue on roadmap: #3463
  5. DakiLLa

    Gameplay pics!

    ah ye, i was there and saw these 'beds with peds'...
  6. ah, ye, true, would be better...
  7. you can put this in 'onClientResourceStart' event: bindKey( "lalt", "down", function () showCursor( not isCursorShowing() ) end ) when you ingame, press left alt to show cursor and press left alt again to hide cursor
  8. DakiLLa

    Gameplay pics!

    lol hot coffe animations ftw
  9. try this: function explodeDestroy () local vehicles = getElementsByType( "vehicle" ) for k,v in ipairs( vehicles ) do if ( getElementHealth( v ) < 25 ) then setTimer( destroyElement, 10000, 1, v ) end end end addEventHandler( "onVehicleExplode", getRootElement (), explodeDestroy )
  10. DakiLLa

    Rope (cord)

    hey guys, one question: is there is an ID of the rope (attached to Levithan in one mission with robbing a casino) or attached to cranes.. ? but with helicopters in single player this rope is creating by opcode (.scm) with magnet 0788: enable_heli @34 magnet 1 so it cant be like an object, then its impossible to get an id. Or i'm wrong? Have you any ideas how to get an ID of the rope ? btw, if single player uses special opcode to create a rope, then you can make a function to activate a heli-magnet on helicopters, or not? cheers, thx for any replies
  11. DakiLLa

    bad pointers

    ah ye, forgot to put getElementType there.. thx for help. But strange, in dp-s i didnt write checks on element type... and it worked fine.. but anyway thx
  12. DakiLLa

    bad pointers

    hi. i'm trying to do something in nightlys and i have one question. Simple script with 'onMarkerHit' event: gResRoot = getResourceRootElement( getThisResource() ); addEventHandler( "onResourceStart", gResRoot, function () idlewood = createMarker( 2073.9887, -1831.4984, 13.5468, "cylinder", 2.5, 0, 255, 0, 50 ); addEventHandler( "onMarkerHit", idlewood, function ( player ) local vehicle = getPedOccupiedVehicle( player ); if vehicle then if isGarageOpen( 8 ) == false then setGarageOpen( 8, true ); else setGarageOpen( 8, false ); end end end ) end ) when i'm hitting the marker im getting a warning 'bad ped pointer' in line getPedOccupiedVehicle( player );. There were not errors like this one in dp-s.. so, whats my mistake?
  13. DakiLLa

    xml bugs?

    yea, thx a lot, hankey, it works fine now
  14. DakiLLa

    xml bugs?

    ehm... its my first time when i using data bases so i have started from xml.. I think that for sql's i need to have some experience, but i never tryed just to look what is this...
  15. DakiLLa

    xml bugs?

    hi. does xml has bugs in dp2.3? just i have a script which contains checks on xml nodes.. and sometimes script cant load file or something goes wrong so i cant do next operations.. well, the part of code: function onExitHouseMarkerHit( player ) -- when player hits marker... toggleAllControls( player, false ); setTimer( toggleAllControls, 2000, 1, player, true ); setTimer( xmlOperation, 1000, 1, source, player ); end function xmlOperation( marker, hitPlayer ) local houseNumber = getElementData( marker, "number" ); local hdb = xmlLoadFile( "houseDaBase.xml" ); local rootNode = xmlFindSubNode( hdb, "root", 0 ); local houseNode = xmlFindSubNode( hdb, "house"..tostring( houseNumber ), 0 ); local dim = xmlNodeGetAttribute( xmlFindSubNode( hdb, "house"..tostring( houseNumber ), 0 ), "dim" ); local playerDim = getElementDimension( hitPlayer ); if tonumber( dim ) == playerDim then local epX = xmlNodeGetAttribute( xmlFindSubNode( hdb, "house"..tostring( houseNumber ), 0 ), "epX" ); local epY = xmlNodeGetAttribute( xmlFindSubNode( hdb, "house"..tostring( houseNumber ), 0 ), "epY" ); local epZ = xmlNodeGetAttribute( xmlFindSubNode( hdb, "house"..tostring( houseNumber ), 0 ), "epZ" ); epX = tonumber( epX ); epY = tonumber( epY ); epZ = tonumber( epZ ); fadeCamera( hitPlayer, false, 1.0, 0, 0, 0 ); setTimer( fadeCamera, 1000, 1, hitPlayer, true, 1.0 ); setTimer( setElementInterior, 1000, 1, hitPlayer, 0, epX, epY, epZ ); setTimer( setElementDimension, 1000, 1, hitPlayer, 0 ); end end and after 5 minutes of good working script, i'm getting warnings (bad argument) in 'rootNode' and 'houseNode' nodes, so after these warnings script cant work fine.. and i need to restart a script again and again and again.. does this like bug and it fixed in 1.0 or i'm too dumb that i cant understand something ?
  16. eh..and what are these problems? i see that all going good when i'm driving.. btw thx for your script...it's rly better than mine..
  17. yea, the math.abs works perfect, and %360 multiplying points in geometry progression..wtf is this? anyway, thx for help
  18. hi. i'm writing simple drift system, but i have one problem.. Well, the way that i'm going: check player vehicle speed and angle of rotation of vehicle. The problem is: - I have set the min and max angle speed for vehicle after which it can call counting of points. minspeed = 0.4 maxspeed = 1.5 minturnspeed = math.rad(1) maxturnspeed = math.rad(45) - I can call counting of points ONLY when i'm driving in left way (turning the wheels to the left). function driftProcess() local vehicle = getPlayerOccupiedVehicle( gMe ) if vehicle then local vx, vy, vz = getElementVelocity(vehicle) local rx, ry, rz = getVehicleRotation(vehicle) local rvx, rvy, rvz = getVehicleTurnVelocity(vehicle) local speed = math.sqrt(vx*vx + vy*vy + vz*vz) local onGround = isVehicleOnGround(vehicle) -- this wont work for monster truck local upright =((rx >= 0 and rx <= 90) or (rx >= 270 and rx <= 360)) and ((ry >= 0 and ry <= 90) or (ry >= 270 and ry <= 360)) if onGround == true and upright == true then if speed >= minspeed and rvz >= minturnspeed then -- counting operators... ..but when i do check on negative angle, i can get points when i'm driving in direct way.. I'm bad with trigonometry, but i think that it looks like that: So i need to set that the vehicle can steer right and get points after that..but how? Thanks for any replies. May be the video will explain what i mean in more understandable form... *When i'm driving the left - i'm getting points (look on the chat). When the right - nothing*
  19. you cant replace hud elements, but you can create new images over the top of hud... like it was made on 'one' race server, they just placed an image over the top radar
  20. did you see his post? You have to pass strings! setPedAnimation ( APed, "ped", "WALK_drunk", -1, true, true, true ) p.s. , - lol
  21. ah..my mistake..forgot to read all topic , well, i have no more questions..thx
  22. eh..guys, sorry for offtopic.. i remember i saw something like 'attachElementToBone' function on wiki, but now i cant find it.. so, is there function like this ?
  23. man..you should to read carefully sintax of commandHandler on wiki...I think that you've passed wrong number of parametres if we take a look on a wiki, function funName( playerSource, commandName, [string arg1, string arg2, ...] ) so i think i know what you wanted to make.. here is your code with my corrects..i've not tested it, may be it have errors..check this.. function ticket( sourcePlayer, command, badPlName, money, reason ) money = tonumber( money ) --convert from string to number badPlayer = getPlayerFromNick( badPlName ) --get bad player if ( badPlayer ) then --if there is a bad player... local gpm = getPlayerMoney( badPlayer ) if ( gpm < money ) then setElementPosition ( badPlayer, 198.8221, 162.0566, 1003.0299 ) setElementInterior ( badPlayer, 3 ) takeAllWeapons ( badPlayer ) --remove all of the players weapons setTimer ( setElementPosition, 60000, 1, badPlayer, 2335.9614, 2454.5168, 14.9687 ) setTimer ( setElementInterior, 60000.0, 1, badPlayer, 0 ) outputChatBox ( "You've been finned " .. money .. " by a cop, you could not afford the fine and have been sent to jail for 1 minute.", badPlayer, 0, 100, 255 ) else takePlayerMoney(badPlayer, price) outputChatBox("You've been fined $150 - by a cop, for: " .. reason .. ".", badPlayer) end else outputChatBox( "I cant find a player with this nick...", sourcePlayer, 255, 0, 0 ) end end addCommandHandler ( "ticket", ticket )
×
×
  • Create New...