Jump to content

Newbie

Members
  • Posts

    208
  • Joined

  • Last visited

Posts posted by Newbie

  1. Im getting strange collision bug for object: vcarshade

    This bug only happens sometimes, i can drive through the object..

    I've tryed to:

    Server

    function RestoreCols ( ) 
        triggerClientEvent ( "collisionRestore", getRootElement(), collisionRestore ) 
    end 
    addCommandHandler("eik", RestoreCols) 
      
    function RestoreModel ( ) 
        triggerClientEvent ( "restoreClientModel", getRootElement(), restoreClientModel ) 
    end 
    addCommandHandler( "nx", RestoreModel ) 
      
    

    Client

    function RestoreCollision ( ) 
        engineRestoreCOL ( 8557 ) 
        engineRestoreCOL ( 8558 ) 
        engineRestoreCOL ( 3458 ) 
        engineRestoreCOL ( 8838 )    
    end 
    addEvent ( "collisionRestore", true ) 
    addEventHandler ( "collisionRestore", getRootElement(), RestoreCollision ) 
      
    function ResetModel ( ) 
        engineRestoreModel ( 8557  ) 
        engineRestoreModel ( 8558  ) 
        engineRestoreModel ( 3458  ) 
        engineRestoreModel ( 8838  )    -- Object / Vehicle to restore to default GTA one. 
    end 
      
    addEvent ( "restoreClientModel", true ) 
    addEventHandler ( "restoreClientModel", getRootElement(), ResetModel ) 
    

    Does have no effect.. Im getting annoying by this bug

  2. I'll already did it by other way.

    It adds account!

    function registerr ( username, password ) 
        if ( username and password and type ( username ) == 'string' and type ( password ) == 'string' ) then 
        account = addAccount ( username, password ) 
        exports.bar_messages:outputMessageBar("Successfully signed up! Now you can play", source, 0, 0, 0, 5000) 
        end 
    end 
    addEvent( "register1", true ) 
    addEventHandler( "register1", root, registerr ) 
    

    How can i make that when player click's register button "as shown upper" to check if account already exists ?

  3. outputChatBox("Error creating account, contact the server admin.",source)

    Client

    addEventHandler("onClientGUIClick", root, 
    function (button, state) 
        if button == "left" and state == "up" then 
        if (source == buttonHover) then 
        username = exports.dxEditBox:getText( "1" ) 
        password = exports.dxEditBox:getText( "2" ) 
        triggerServerEvent("register1", localPlayer, username, password) 
        outputChatBox("Username: ".. username .." Password: " .. password .."",255,255,255,true) 
    end 
    end 
    end) 
      
    

    Server

    function registerr( username, password ) 
    if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then 
                    local accountAdded = addAccount(username,password) 
                    if(accountAdded) then 
                            outputChatBox("Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login",source) 
                    else 
                            outputChatBox("Error creating account, contact the server admin.",source) 
                    end 
            else 
                    outputChatBox("Error creating account, correct syntax: /register ",source) 
            end 
    end 
    addEvent( "register1", true ) 
    addEventHandler( "register1", root, registerr ) 
      
    

  4. function checkForHunter(number,sort,model) 
        if sort == "vehiclechange" then 
            if model == 425 then 
                if (getElementData(source, "Hunter") == false) then 
                    setTimer(hunterBonus,200,1,source) 
                end 
            end 
        end 
    end 
    addEvent('onPlayerPickUpRacePickup') 
    addEventHandler("onPlayerPickUpRacePickup",getRootElement(),checkForHunter) 
      
    addEvent("onMapStarting", true) 
    addEventHandler("onMapStarting", getRootElement(), 
        function() 
            for i,v in ipairs(getElementsByType('player')) do 
                setElementData(v, "Hunter", false) 
            end 
        end) 
    

    So far i made that player cannot take a hunter again, but there's problem, some maps has "stacked" hunter pickups, and it gives me bonus many times.. is there any way to fix it ?

  5. Thanks Tasty!

    I've did it in my way, tested,working fine:

    addEvent("15s",true) 
    addEventHandler("15s",getRootElement(), 
    function () 
    for i, sound in ipairs(getElementsByType("sound")) do 
    setSoundVolume(sound, 0.1) 
    local sound1 = playSound("data/files/wreckingball.ogg") 
    setSoundVolume(sound1, 1) 
    local soundLength = getSoundLength(sound1) 
    setTimer(unmuteSounds, soundLength*1000, 1) 
    end 
    end) 
    ----- 
      
    function unmuteSounds () 
    for i, sound in ipairs(getElementsByType("sound")) do 
    setSoundVolume(sound, 1) 
    end 
    end 
      
    

  6. To mute radio:
     function makeRadioStayOff() 
      setRadioChannel(0) 
      cancelEvent() 
    end 
    addEventHandler("onClientPlayerVehicleEnter", getRootElement(), makeRadioStayOff) 
    addEventHandler("onClientPlayerRadioSwitch", getRootElement(), makeRadioStayOff) 
    

    Thanks for your help, but that's a radio made by .pls streams

    So, okay. Here's my sound (this should hear loudest)

    addEvent("15s",true) 
    addEventHandler("15s",getRootElement(), 
    function () 
    local sound1 = playSound("data/files/wreckingball.ogg") 
    setSoundVolume(sound1, 1) 
    end) 
    

    And theres way to make him loudest, set all other sounds volume to 0.5 and keep my sounds as 1.

    function muteSounds () 
    for i, sound in ipairs(getElementsByType("sound")) do 
    setSoundVolume(sound, 0.5) 
    if sound == sound1 then 
    setSoundVolume(sound1, 1) 
    end 
    end 
    end 
      
    addEventHandler("onClientResourceStart", root, 
    function () 
    setTimer(muteSounds, 50, 0) --To make sure that the sound is already playing 
    end) 
    

    It seems to be playing my sound at 0.5

  7. Can someone show me an example of destroyElement, i never used this so far.

    Thats what i got with setting LOD distance:

    function lager(thePlayer) 
    for i=600,800 do 
    engineSetModelLODDistance(i, 1)   
    end 
    end 
    addCommandHandler("antilag", lager) 
    

    600 - 800 ID's Threes, some plants.

    Setting Model Lods, isn't the best way.. Well its working fine, but i think i should better use destroyElement

  8. Since MTA Race maps became very "cluttered" with useless objects like hipoly trees and ect. That causes lag / FPS drops for some players. About the idea, is is posibble to hide specified obejcts for player ?

  9. I think it will make more badly..

    addCommandHandler('nextmap', 
        function( player, command, ... ) 
            local query = #{...}>0 and table.concat({...},' ') or nil 
            if not query then 
                if g_ForcedNextMap then 
                    outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) 
                else 
                    outputRace( 'Next map is not set', player ) 
                end 
                return 
            end 
            if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then 
                return 
            end 
            local map, errormsg = findMap( query ) 
            if not map then 
                outputRace( errormsg, player ) 
                return 
            end 
            if g_ForcedNextMap == map then 
                outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) 
                return 
            end 
            g_ForcedNextMap = map 
            outputChatBox('Next map set to ' .. getMapName( g_ForcedNextMap ) .. ' by ' .. getPlayerName( player ), g_Root, 0, 240, 0) 
        end 
    ) 
    

    g_Forced calls .. getMapName

  10. triggerEvent("onBoughtMap",getRootElement(),mapName) 
    

    This part works fine..

    And now im trying to set a map

    P.S Default Race.

    function SetNextMap ( mapName ) 
        g_ForcedNextMap = mapName 
    end 
    addEvent ( "onBoughtMap", true ) 
    addEventHandler ( "onBoughtMap", getRootElement(), SetNextMap ) 
    

    [2015-03-22 00:35:35] WARNING: [gamemodes]\[race]\race\racevoting_server.lua:773: Bad argument @ 'getResourceInfo' [Expected resource-data at argument 1, got string '[DM] Audio v4 - Dream Experience']

    [2015-03-22 00:35:35] WARNING: [gamemodes]\[race]\race\racevoting_server.lua:773: Bad argument @ 'getResourceName' [Expected resource-data at argument 1, got string '[DM] Audio v4 - Dream Experience']

    function getMapName( map ) 
        return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" Line 773 
    end 
      
    

    Need help so far.

  11. Hello. so today im facing a problem.. When i type /replace

    it changes mod to every server players, not only for me, where did i made a fail ?

    Server:

    function ReplaceCommand (thePlayer) 
        local account = getPlayerAccount(thePlayer) 
        inf1 = getElementData(thePlayer,"inf1") 
        if inf1 > 0 then 
        outputChatBox("#ff6464[infernusShop]:#FFFFFF Enjoy!",thePlayer,255,255,255,true)     
        triggerClientEvent( "replaceVeh", getRootElement(), replaceVeh ) else 
        outputChatBox("#ff6464[infernusShop]:#FFFFFF You don't own this mod!",thePlayer,255,255,255,true) 
    end 
    end 
    addCommandHandler( "replace", ReplaceCommand ) 
    

    Client:

    function ReplaceVehicle ( ) 
    outputChatBox ( "" ) 
      
    txd = engineLoadTXD ( "data/model/inf1.txd" ) 
    engineImportTXD ( txd, 411 ) 
    dff = engineLoadDFF ( "data/model/inf1.dff", 0 ) 
    engineReplaceModel ( dff, 411 ) 
    end 
      
    addEvent ( "replaceVeh", true ) 
    addEventHandler ( "replaceVeh", getRootElement(), ReplaceVehicle ) 
    

×
×
  • Create New...