Jump to content

Chlorek

Members
  • Posts

    131
  • Joined

  • Last visited

Posts posted by Chlorek

  1. Hi. Is it possible (and if it is, how can I do that) to get Z-Asix position of ground under vehicle wheels. I need that to work with every vehicle with wheels (it should work fine with every car: monster, super gt, nrg-500 etc). I think about getting wheels height and size but I think it might not be possible.

    Thanks for help, Chlorek.

  2.   
    local tabs = guiCreateTabPanel(5, 20, width-10, height-25, false, mainWindow) 
    local tabLogin = guiCreateTab("Login", tabs) 
    local tabRegister = guiCreateTab("Register", tabs) 
    local nameStatic = guiCreateLabel((width-60)/2, 5, 60, 20, "Username:", false, tabLogin) 
    local nameEdit = guiCreateEdit((width-200)/2, 25, 200, 25, "", false, tabLogin) guiEditSetMaxLength(nameEdit, 25) --guiSetProperty(nameEdit, "TextFormatting", "HorzCentred") 
    local passwdStatic = guiCreateLabel((width-60)/2, 65, 60, 20, "Password:", false, tabLogin) 
    local passwdEdit = guiCreateEdit((width-200)/2, 83, 200, 25, "", false, tabLogin) guiSetProperty(passwdEdit, "MaskText", "True") guiEditSetMaxLength(passwdEdit, 30) 
    local loginbtn = guiCreateButton(0.1, 0.8, 0.8, 0.1, "Log Me In", true, tabLogin) 
      
    

    This is my code, loginbtn is invisible when I set relative to false and use pixels. It happens only when I create button in a tab. And in relative mode my button is clicked when I click wherever in Login tab.

    My button click event handler (OH, it's register button handler, but they are the same so no matter):

      
    unction sendRegisterRequest(button, state) 
        if button == "left" and state == "up" then 
            triggerServerEvent("sendRegisterRequest", getLocalPlayer(), guiGetText(nameEditReg), guiGetText(passwdEditReg), guiGetText(rpasswdEditReg)) 
        end 
    end 
    addEventHandler("onClientGUIClick", registerbtn, sendRegisterRequest) 
      
    

  3. -> timer pls

    setTimer(spawn, 5000, 1) 
    

    -> skin problem

    Just set player skin when spawning:

    bool spawnPlayer ( player thePlayer, float x, float y, float z, [ int rotation = 0, int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil ] ) 
    

    Also in your spawn() function there is no 'source' variable. It is in the one you have called by the event but you do not pass it to the spawn() function.

  4. Hi there. I am scripting some GUI and I found some problems with buttons in tabs. First of all I have to use relative=true when creating button (when I don't I do not see button). However when I used it I found another one problem - whereever I click in the tab the button is activated, but should only if button is clicked - really weird problem. Thanks for help!

  5. While I am reading a lot of pages on mtasa wiki I meet so many pages with "--remove pls-- " instead of contents. And my question is why something like this appears so often? There are functions (not depracted) which are modified to this "--remove plz--" text :? To read articles I have to look to history. Can anybody explain me that? These changes are from user called "Dzeku Nooow" :roll:

  6. My code:

    createProjectile ( getLocalPlayer(), 19, x, y, z, 10, nil, rx, ry, rz-180, 0, 0, 0, 0) 
    

    Variables rx, ry and rz are a vehicle rotation then I am using them to create projectile. And here is my problem, when my car is turned north or south is it working alright but when a car is turned (even a bit) east or west it doesn't work, bcuz projectile is created in wrong destination like in mirror (instead of moving some left it is moving some right). Plz help, I am scripting that from 2 hours and no progress :roll:

  7. Ja osobiście jestem zdania, że żaden "gotowiec" nie jest zbyt dobry. Każdy będzie oczekiwał czegoś innego. Dlatego uważam, że jeżeli już używać jakiś skryptów to lepiej jako podstawę do własnego gamemoda (czasem zaoszczędza to sporo czasu na początku). Chyba, że nie zna się kompletnie lua to radzę pisać od podstaw bo prędzej czy później mając własny serwer i tak będzie wam to potrzebne.

  8. local theMarker 
      
        function cMarker (thePlayer, commandName) 
            if (thePlayer) then 
                local x,y,z = getElementPosition (thePlayer) 
                theMarker = createMarker ( x,y,z+0.5, "checkpoint", 4, 0, 255, 0, 0, getRootElement()) ---- ( Type of marker = Checkpoint, 4 = radius, (size), 0 Red, 255 Green, 0 Blue) 
                if (theMarker) then 
                    outputChatBox ("Event Marker Created", thePlayer) 
                else 
                    outputChatBox ("Failed to Create Marker", thePlayer) 
                end 
            end 
        end 
        addCommandHandler ("createmarker", cMarker) 
          
          
        function rMarker (thePlayer, commandName) 
            if (isElement(theMarker) == true) then 
                destroyElement(theMarker) 
                outputChatBox ("Marker has been destroyed!", thePlayer) 
            else 
                outputChatBox ("There is not any Event marker!", thePlayer) 
            end 
        end 
        addCommandHandler ("destroymarker", rMarker) 
      
    

    Variables defined inside of any functions are available for this function only. They aren't available in every function;]

    It's really importnat so you should remember that!

  9. Removing created marker (simple version with one marker removing only).

    local theMarker 
      
        function cMarker (thePlayer, commandName) 
            if (thePlayer) then 
                local x,y,z = getElementPosition (thePlayer) 
                theMarker = createMarker ( x,y,z, "arrow", 1.5, 255, 255, 0, 255, getRootElement()) 
                if (theMarker) then 
                    outputChatBox ("Entry Marker Created", thePlayer) 
                else 
                    outputChatBox ("Failed to Create Marker", thePlayer) 
                end 
            end 
        end 
        addCommandHandler ("createentrymarker", cMarker) 
      
        function rMarker (thePlayer, commandName) 
        if (isElement(theMarker) == true) then 
                destroyElement(theMarker) 
                outputChatBox ("Marker has been destroyed!", thePlayer) 
        else 
        outputChatBox ("There is not any entry marker!", thePlayer) 
        end 
        end 
        addCommandHandler ("removemarker", rMarker) 
      
    

    Should work.

    You can write script to creating many entry markers and then removing it, that is not much more lines of code.

×
×
  • Create New...