Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. Aibo

    Arrest script

    1. getPlayerWantedLevel() returns integer. and you're trying to compare it with string. 2. == 1 or == 2 or == 3 or ... really? what about > 0? 3. addEventHandler must be called when both marker AND handler function exist function arrest(hitElement, weapon) local weap = getWeaponNameFromID(3) local playerTeam = getPlayerTeam(source) if ( playerTeam == "Police" ) then if ( getPlayerWantedLevel(hitElement) > 0 ) then if ( weap ) then arrestMarker = createMarker(1542.39966, -1675.01782, 13.55443, "cylinder", 2.5, 255, 255, 0, source) addEventHandler( "onMarkerHit", arrestMarker, mhit) toggleAllControls( hitElement, false ) local ax, ay, az = getElementPosition ( hitElement ) local cx, cy, cz = getElementPosition ( source ) local d = getDistanceBetweenPoints3D(ax, ay, az, cx, cy, cz) if ( d > 10 ) then setElementPosition( hitElement, cx-5, cy, cz ) end end end end end addEventHandler( "onPlayerDamage", root, arrest) function mhit(hitElement) if ( getPlayerTeam(source) ~= "Police" ) then if ( getPlayerWantedLevel(hitElement) > 0 ) then setElementInterior(hitElement, 6) setElementPosition(hitElement, 264.74969, 77.49036, 1001.03906) end end end
  2. i dont get your english in topic i dont get variable names i dont get this messed up indentation try your native language forums.
  3. Aibo

    Changing skin +1

    probably you call addEventHandler BEFORE you create the function itself. you should define function first. functions are the same as any variables — you can't use it until you define it. you can't and don't do stuff like: a = b + 1 b = 10 same with functions.
  4. Aibo

    Changing skin +1

    i bet you'll have to check if the next skin ID is valid, for example: function goRight(player) local newSkin = getElementModel (localPlayer) + 1 while not setElementModel (localPlayer,newSkin) and newSkin < 288 do newSkin = newSkin + 1 end end PS: you'll also have to check if new skin ID is not more than 288, cause it'll stuck in infinite loop otherwise (there are no valid skins after 288)
  5. https://wiki.multitheftauto.com/wiki/ProcessLineOfSight
  6. квадратные скобки означают набор символов. чтоб работало нормально надо указать "plain text" поиск. string.find("[u1tra]~On1xS~ [u1tra]~AirStrik3~ ", "[u1tra]~AirStrik3~", 1, true) см. http://lua-users.org/wiki/StringLibraryTutorial
  7. setElementRotation() doesnt do transitions, it just snaps the element into place. you can try to get object's current rotation when/if its still moving, do stopObject() and then calculate the needed rotation offset for new moveObject call. but it probably wont be correct with easing there.
  8. predefined global variable resourceRoot contains current resource root element, so no need to call 2 functions: addEventHandler("onClientResourceStart", resourceRoot, ..
  9. Aibo

    Easing

    you can just specify easing type string in moveObject function: moveObject (lift, 3500, 2919.8000488281, -790.9, 11.300000190735, 0, -90, 0, "InQuad") for type names see the Easing wiki page you've linked
  10. well you're discarding the version check, not sure if it's a good idea. addEventHandler( "onClientResourceStart", resourceRoot, function() if getVersion().sortable >= "1.1.0" then local shader, tec = dxCreateShader ( "uv_scroll.fx" ) if shader then engineApplyShaderToWorldTexture ( shader, "bobo_2" ) end end end )
  11. addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion().sortable < "1.1.0" then outputChatBox( "Resource is not compatible with this client." ) return end -- Create shader local shader, tec = dxCreateShader ( "uv_scroll.fx" ) if shader then -- Apply to world texture engineApplyShaderToWorldTexture ( shader, "bobo_2" ) -- Create object with model 4729 (billboard) local x,y,z = getElementPosition( getLocalPlayer() ) createObject ( 4729, x-15, y, z+3 ) end end )
  12. events are not functions server: function serialLockHandler() outputChatBox("Testing", source, 0, 255, 0) end addEvent("seriallock", true) addEventHandler("seriallock", root, serialLockHandler)
  13. Aibo

    Marker.

    it doesnt work that way, you'll have to use events for that. right now you're placing your marker in interior 9, that's why it's not showing.
  14. like "100 useless flame posts per minute" is better.
  15. Aibo

    Health

    no it doesn't. local noDamage = false function toggleStopDamage() noDamage = not noDamage outputChatBox(noDamage and "Damage is off" or "Damage is on") end bindKey("F1", "down", toggleStopDamage) function StopDamage() if noDamage then cancelEvent() end end addEventHandler("onClientPlayerDamage", localPlayer, StopDamage) you'll haev to add "admin check" yourself
  16. Aibo

    Health

    it's amazing how some people don't have any idea how to do this, but they still post.
  17. Aibo

    table.

    http://lua-users.org/wiki/TableLibraryTutorial
  18. Aibo

    Dude here! (2)

    onClientPlayerDamage getElementPosition getZoneName cancelEvent
  19. well if you check https://wiki.multitheftauto.com/wiki/Control_names page, you'll see that it's a built-in MTA command "screenshot". bindKey doesn't work here (as wiki says) and addCommandHandler doesn't seem to work here also (despite the wiki saying it should). but you can do it the other way around (client-side): addEventHandler("onClientKey", root, function(key, pressed) if key == getKeyBoundToCommand("screenshot") and pressed then -- do your stuff when someone presses a screenshot key end end)
  20. It will zip the files that you don't want to zip. For instance, you may have images in a folder with photoshop document which you don't have to zip, it will just make the .zip larger. Currently, I'm working on that feature in MTASE but I can't say when it'll come out since I want to fix as many bugs as possible before I release it. So, I don't want to suggest to wait for the new MTASE release. well, dont keep unrelated/unneeded files in resource folder.
  21. я же написал функцию, делает почти то же самое. а стандартной нет.
  22. function tobool(v) return tostring(v) == "true" end
  23. Windows should be able to zip files by itself: select all the files/folders IN your resource folder, right click > Send to > Compressed (zipped) folder
  24. getPlayerAccount возвращает класс account, а не строку: function Acc( thePlayer ) local name = getPlayerAccount( thePlayer ) outputChatBox( " акк - "..getAccountName(name), root, 255, 255, 0 ) end addCommandHandler("acc", Acc)
  25. your line 7 obviously says "if thePlayer and thePlayer ~= getLocalPlayer() then". how do you expect thePlayer to be localPlayer with that statement? it will never draw anything for local player. also calling setPlayerNametagShowing(thePlayer, false) every frame is redundant to say the least. lines 34-35 also redundant. you calculate distances for nothing and do return even there's no code after it to run. and client getElementsByType has a streamedIn parameter. you dont really need ALL players, not like you're planning to draw nametags for players that arent even streamed in, its just a waste of time.
×
×
  • Create New...