Jump to content

DakiLLa

Members
  • Posts

    965
  • Joined

  • Last visited

Everything posted by DakiLLa

  1. hi. i have one problem here... well, i have a table with objects. How to get randomly an object and make with him some operations? lets suppose something like this: 'board from fallout' rows = 10 columns = 10 board = {} local count = 0 function createBoard () for i = 1,rows do for j = 1, columns do board[count] = createObject ( 1697, -2274.5741875 + 4.466064 * j, 1858.0903320313 + 5.362793 * i, 102.6078, math.deg( 0.555 ), 0, 0 ) count = count + 1 end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createBoard ) and i want to attach a marker to one of these blocks (randomly). function test () rndBlock = math.random (1, #board) m_block = board[rndBlock] m = createMarker ( 0, 0, 0, "corona", 2.0, randInt(0,255), randInt(0,255), randInt(0,255), 150 ) attachElementToElement ( m, m_block ) end addCommandHandler ( "test", test ) but something wrong, i dont know how to make it..can you help ?
  2. hm..strange, cse it works fine for me but with one lag: setTimer function is laggy in dp-versions.. you will have changing world time to 00.00 after you write the command..i have somethin like your script here: vehicles = {} function toggleFlashingLights ( thePlayer, key, keyState ) if getPlayerOccupiedVehicleSeat ( thePlayer ) == 0 then if vehicles[getPlayerOccupiedVehicle ( thePlayer )] then killTimer ( vehicles[getPlayerOccupiedVehicle ( thePlayer )] ) vehicles[getPlayerOccupiedVehicle ( thePlayer )] = nil else vehicles[getPlayerOccupiedVehicle ( thePlayer )] = setTimer ( toggleVehicleLights, 250, 0, getPlayerOccupiedVehicle ( thePlayer ) ) end end end addCommandHandler ( "flash", toggleFlashingLights ) function toggleVehicleLights ( car ) if ( getVehicleOverrideLights ( car ) ~= 2 ) then setVehicleOverrideLights ( car, 2 ) else setVehicleOverrideLights ( car, 1 ) end end may be it will help...
  3. anyway, this is not topic theme. Will ask for all your questions on server.. **topic can be closed**
  4. i've meant that i will remove levels and exp...
  5. you cant use this function in execute command p.s.: super, i will remove lvdm gamemode from server in short time, so, you dont need to set your exp and lvl data's..
  6. oh..i just forgot edit word "open" of word "close" in editinig my post.. doesnt help all the same..
  7. ehm, i have made something, but no result..where i have mistakes ? g_res_root = getResourceRootElement ( getThisResource () ) addEventHandler ( "onClientResourceStart", g_res_root, function () x, y = guiGetScreenSize () p_wnd = guiCreateWindow ( x-280, y-600, 243, 164, "test", false ) close () end ) function close ( ) local currentAlpha = guiGetAlpha ( p_wnd ) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha ( p_wnd, newAlpha ) if newAlpha ~= 0 then setTimer ( open, 50, 1, p_wnd ) end end
  8. Hi. I want to make a smooth opening and closing gui menus. I know that i need to use guiGetAlpha and guiSetAlpha but i dont know how to use it correctly. Can you help me with small example or just tell what i need to do. thx
  9. addEvent ( "setPasswordForLock", true, "passLockValue" ) addEventHandler ( "setPasswordForLock", g_root, function ( passLockValue ) local vehicle = getPlayerOccupiedVehicle ( source ) setElementData ( vehicle, "password", passLockValue ) setVehicleFrozen ( vehicle, true ) setVehicleDamageProof ( vehicle, true ) outputChatBox ( "Password "..passLockValue.." was set successfully!", source, 0, 255, 0 ) end ) This function triggers from client side with gui, i dont think that gui is important here...
  10. hi. i have made a parking script, but there is one problem with setVehicleDamageProof function: when player who was set damage proof state to "true" has quit the server, damage proof state automatically set to "false", so, everyone can blow up vehicle.. Well, as i think, this is function lag, and it's impossible to fix this..may be there are alternative ways to solve this problem, but i dont know, what to do... Can anybody help ?
  11. Great, thx for help. This is what i need..
  12. well, and if i want to use more than three spawnpoits, how will be looking this part of script ? in my first post we have three sp.points and three coordinates (xyz). how to be with five sp.points and three coordinates ? i mean this part: x = spawns[randomNumber][1] y = spawns[randomNumber][2] z = spawns[randomNumber][3]
  13. Hello. I have one question about randoms: let's suppose that i have 3 spawnpoints with coordinates X1 Y1 Z1, X2 Y2 Z2, X3 Y3 Z3. How to make that player will be spawns randomly in one of these spawnpoints ?
  14. hi. i have an idea: is it possible to move object to place, where player camera is seeing at this moment, like tank "hat" on Rhino? Something like moving missle silo in roof of vehicle:
  15. DakiLLa

    drift script

    hm, if i will use onClientRender for this, but i think it will not get a result there is some server functions. I dont know what i need to use, onMarkerHit and Leave - wrong ways to activate this script i think..somebody help i really need this script working nice!
  16. you can use this function only in mta 1.0 version.
  17. try to see here example 3,i think you need it..
  18. want more examples? try to see here
  19. DakiLLa

    drift script

    hi. I want to make not too much difficult code for drift. I tryed to make it with marker, for begin. And i have two questions: how to calculate numbers of "getVehicleTurnVelocity" like 400 not 0.00456789...e" ? example from wiki gives only decimal value.. And how to sum all picked up values from turnVelocity when player is in marker? This code gives me result when player only hits marker. function onMarkerHit ( thePlayer, matchingDimension ) if source == marker then local vehicle = getPlayerOccupiedVehicle ( thePlayer ) if ( not vehicle ) then outputChatBox ( "You need to be in a vehicle to activate this marker!", thePlayer, 255, 0, 0 ) else local x, y, z = getVehicleTurnVelocity ( vehicle ) actualturn = ( x^2 + y^2 + z^2)^(0.5) outputChatBox ( "Your current turn velocity: " .. actualturn .. " points.", thePlayer, 0, 255, 0 ) end end end addEventHandler ( "onMarkerHit", marker, onMarkerHit )
  20. but you can make a check, if account of any player is not guest, and then do what you want to do with accounts. something like this: save player money when he leaves a server. And it's work great for me i dont have any problems with deleting accounts. And dont use names of keys like "rpg.money" it deletes accounts too. I dont know why, so, use usual names of keys, like in my example. local account = getClientAccount ( source ) local guest = isGuestAccount ( account ) if ( guest ) then outputDebugString ( "*" ..getClientName ( source ).. " has left server with guest account." ) else --Money local money = getPlayerMoney ( source ) if ( money ) then setAccountData ( account, "money", money ) outputDebugString ( "*" ..getClientName ( source ).. " has left server. Saving his data..OK!" ) end end
  21. hi. one problem with setting velocity. I want to push off player if he hits a marker but i have no result. What's wrong or setElementVelocity cant set other speeds without Z-speed ? marker = createMarker ( 768.1605, -37.0261, 1000.6464, "cylinder", 9.0, 255, 150, 0, 150 ) function onMarkerHit ( thePlayer, matchingDimension ) if source == marker then setElementVelocity ( thePlayer, 0, -0.9, 0.0 ) end end addEventHandler ( "onMarkerHit", marker, onMarkerHit )
  22. hi. I have saved team name in player account data. And when i want to set player to this team, player switching to the nil value team. How to make that player will be switch to the saved team, not nil value? strings in accounts.xml <account name="PlayerOne" password="..." ip="..."> <data team="Cops"/> </account> script.lua function try (thePlayer, commandName) local account = getClientAccount ( thePlayer ) local guest = isGuestAccount ( account ) if ( guest ) then outputDebugString ( "Failed to load account data! Guest account" ) else local checkedTeam = getAccountData ( account, "team" ) if ( checkedTeam ) then setPlayerTeam ( thePlayer, checkedTeam ) outputDebugString ( "Setting player team to the saved team." ) else outputDebugString ( "Failed to load team!" ) end end end addCommandHandler ( "team", try )
  23. so, is anybody using this resource? and can anybody post there small example how to save..hmm, players money, when they will be disconnect from the server? it will be usefull to understand functions of this resource and how to realise them.
×
×
  • Create New...