Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. it will (though in lua string starts at character 1, not 0). also string.find('ftwmta', '[mtaftw]', 0) -- true string.find('ffffffff', '[mtaftw]', 0) -- true -- [mtaftw] is a set of symbols to search for, without any order
  2. well, time to learn then :3 http://lua-users.org/wiki/PatternsTutorial it's a good thing ©
  3. instead of using string.find 3 times (and string.lower 6 times), you can use patterns. function detectFake(oldn, newn) -- this will match [fp], (fP), [fP|, or any other combination, regardless the case if newn:find("[%[%(%|][fF][pP][%]%)%|]*") then outputChatBox ("That nametag is not allowed, choose another.", source, 255, 0, 0) cancelEvent() end end addEventHandler ("onPlayerChangeNick", root, detectFake) -- you can also use this pattern in gsub: newPlayerName = playerName:gsub("[%[%(%|][fF][pP][%]%)%|]*", "") EDIT: changed escaping from \ to %, dunno which way is more "correct", but % dont break the string in highligther :3
  4. you dont need to decrypt passwords (SMF uses SHA1 with salt anyway, good luck with that) you need to compare a hash of the entered password with a hash stored in database. if it matches — entered password is correct. all you want is SMF's hashing algorithm
  5. every .lua file in a resource is also a code block, that can have it's local variables. any variable that is not "local" in this code block is accessible in other .lua files (in the same resource). viewtopic.php?f=91&t=33520
  6. because your "vitesse" function is never called. and why are creating yet another function inside that function and never call it either? you dont need to create a function every line, you know. myMarker1 = createMarker(1630.8,154.3,34.1,"cylinder",15,255,255,10,0) function MarkerHit1 ( hitElement, matchingDimension ) if getElementType( hitElement ) == "vehicle" then local vehicle = hitElement local controller = getVehicleController ( vehicle ) local speed = ( function( x, y, z ) return math.floor( math.sqrt( x*x + y*y + z*z ) * 155 ) end )( getElementVelocity( vehicle ) ) if speed and speed > 90 then fadeCamera ( controller, false, 1.0, 0, 0, 0, 255 ) setTimer ( fadeCamera, 500, 0.5, controller, true, 0.5) end end end addEventHandler( "onMarkerHit", myMarker1, MarkerHit1 )
  7. Aibo

    Strange error

    its =, not ==. == is for comparison. and function toggleRemover() removerEnabled = not removerEnabled end addCommandHandler("vremover", toggleRemover)
  8. if newNick:gsub("#%x%x%x%x%x%x","gtfo") == "gtfo" then
  9. i had some troubles with sdk, so i just JSONed everything myself for this (dont need convertToObjects and all that anyway). so where exactly it fails, in lua or in php? do you get any reply from the geoIP site?
  10. im not even sure about that. is this post helping: more like "i dont know anything about the issue, but i'll post anyway". have you ever even run linux?
  11. will briggs registered 18 Jan 2011 and has 122 posts. you registered 17 Mar 2011 and already got 213 posts.
  12. as a matter of fact, he does. pretty stupid way, posting "ya", "ok" and other senseless messages.
  13. Aibo

    GeoLocation IP

    you can make a script that calls some geoIP site's API (that supports POST/JSON). DDC servers use http://ipinfodb.com/ for that. or setup your own geoIP database. (can be downloaded here, for example: http://ipinfodb.com/ip_database.php)
  14. Aibo

    Login GUI

    you could at least made the inputs and the buttons the same size
  15. как продавать торты (быдлололопсевдокод): торты = 1 пока (торты > 0) надо продавать(торты) конец
  16. because you're messing up the whole syntax by simply copying a line. the function is inside setTimer (whis is not closed on the same line). here's how it should be (assuming you want something done in the same timer), with line breaks: setTimer(function() local x,y,z = getElementPosition(veh) setElementPosition(marker,x-4,y+2,z+1,100) x,y,z = getElementPosition(veh1) setElementPosition(marker2,x-4,y+2,z+1,100) setElementInterior(marker, 0) end,1000,0)
  17. i replied in your other topic, you didnt even bother to undestand. now you want it to move UP, but setting rotation with moveObject. seriously, why?
  18. moveObject uses relative rotation. so to place it back after you've rotated it 90 on Z axis you need to rotate it -90 degrees on Z axis (not by setting object rotation parameters from createObject)
  19. gui can make use of relative position/size, while dx functions use absolute screen coordinates. for dx you need to calculate scaling according to current resolution (using your "reference" resolution or relative screen coordinates). search the forums, it has been discussed: viewtopic.php?f=91&t=33478 viewtopic.php?f=91&t=33412 viewtopic.php?f=91&t=30225 viewtopic.php?f=91&t=31314 etc
  20. you should always check if player is in a vehicle, before doing anything with the (supposedly) vehicle element. even in race mode player can be not in a vehicle at all. function MapStarting(mapInfo, mapOptions, gameOptions) for id, player in ipairs(getElementsByType("player")) do local playerAccount = getPlayerAccount ( player ) local playerPlayedMaps = getAccountData ( playerAccount, "MapsPlayed" ) or 0 local playerTeam = getTeamName ( getPlayerTeam ( player ) ) local playerVehicle = getPedOccupiedVehicle ( player ) setAccountData ( playerAccount, "MapsPlayed", tonumber(playerPlayedMaps) + 1 ) if playerVehicle and playerTeam == "Red" then setVehicleColor ( playerVehicle, 3, 3, 3, 3 ) elseif playerVehicle and playerTeam == "Blue" then setVehicleColor ( playerVehicle, 7, 7, 7, 7 ) end end end addEventHandler ( "onMapStarting", getRootElement(), MapStarting )
  21. because spawnkill is a function, not an element. and use [lua] tags.
  22. local targetTeam = getTeamName(getPlayerTeam(targetPlayer)) getPlayerTeam() returns team, not it's name.
  23. Aibo

    table problem

    problem is in this line then: checkpoints = {v[1], v[2], v[3]} this syntax doesn't put any values to checkpoints. probably because [ and ] used to denote a numeric index in a table, like {[1] = 1, [2] = "two"} you can try checkpoints = v, or copy this way local x,y,z = v[1], v[2], v[3] checkpoints[i] = { x, y, z } -- or checkpoints[i] = { unpack(v) }
  24. Aibo

    table problem

    why dont you do something like: addEvent("createNewCheckpoint",true) addEventHandler("createNewCheckpoint",getRootElement(), function (player,id) outputDebugString(tostring(id)) -- and see what is there? local x, y, z = checkpoints[tonumber(id)][1], checkpoints[tonumber(id)][2], checkpoints[tonumber(id)][3] triggerClientEvent(player,"createCheckpointsForPlayer",player,x,y,z,id) end)
  25. Aibo

    table problem

    how can this work fine if "id" is (probably) nil? im sorry, but this is confusing. your event "returnCreatedCheckpoints" puts data from some table to another table. then, event "createNewCheckpoint" doesn't add any new data, but takes some from the table created by "returnCreatedCheckpoints". and where is "createNewCheckpoint" event is triggered? is "id" passed to it correctly? nvm, found that.
×
×
  • Create New...