Jump to content

dima3367

Members
  • Posts

    67
  • Joined

  • Last visited

Posts posted by dima3367

  1. Hi all, tell me why I insert a function for that would not work when entering text binds, but they still work. Here's a piece of code.

    local window = guiCreateWindow(0.36,0.2, 0.3,0.35, '', true)
    guiSetVisible(window,false)
    guiWindowSetSizable(window,false)
    
    local grid = guiCreateGridList(0,0.1, 0.6,1, true, window)
    local column = guiGridListAddColumn(grid, 'Никнейм', 0.9)
    
    guiCreateLabel(0.685,0.1, 1,0.1, 'Поиск по нику:',true,window)
    local edit_nickname = guiCreateEdit(0.63,0.17, 1,0.1, '',true,window)
    guiSetInputMode("no_binds_when_editing")
    
    guiCreateLabel(0.685,0.3, 1, 0.1, 'Срок (в минутах):', true, window)
    
    local edit = guiCreateEdit(0.63,0.37, 1,0.1, '', true,window)
    
    local button = guiCreateButton(0.63,0.48, 1,0.1, 'Посадить',true,window)
    addEventHandler('onClientGUIClick',button,function()
    	if source ~= button then return end
    	local detention = tonumber(guiGetText(edit))
    	if not detention then return end
    
    	local nick = guiGridListGetSelectedText(grid,1)
    	triggerServerEvent('server:arrest',localPlayer,nick,detention)
    end)

     

  2. Hello everybody! Please tell me how to make the team work through the server console? I need to make the /givemoney team work through the server console .  I made an export to meta to the function where the command is written, but this did not help. I would be grateful for your help.

     

  3. Hi all! 
    Tell me how to do or maybe someone has a script to restart the server at a certain time?

    That is, I need to have the server restart automatically at a certain time once a day, for example at 5.00 am. 

    I would really appreciate your help.

  4. Hello! I have a resource responsible for the teleportation of the player to his garage where he gets to choose his car. 
    But there is a small bug that appears very rarely, but nevertheless it appears the players, namely that of the player after entering the garage and exiting beams are not the same direction from which he came, and under the texture in the field. 
    It is accompanied by this error:

    jpeg&tknv=v2&size=1280x660

    Here is the send part of the code, tell me, what could be and how to fix it, I would be very grateful.

    addEvent("tws-serverGarageEnter", true)
    addEvent("tws-serverGarageExit", true)
    
    addEventHandler("tws-serverGarageEnter", resourceRoot,
    	function(garagePosition)
    		local playerAccount = getPlayerAccount(client)
    		if isGuestAccount(playerAccount) then
    			triggerClientEvent(player, "tws-clientGarageEnter", resourceRoot, false, "Вы не залогинены")
    			return
    		end
    		-- Массив машин игрока
    		local playerVehiclesJSON = getAccountData(playerAccount, "vehicles")
    		if not playerVehiclesJSON then
    			triggerClientEvent(player, "tws-clientGarageEnter", resourceRoot, false, "Не удалось получить список ваших автомобилей")
    			return
    		end
    
    		-- Координаты игрока перед входом в гараж
    		local garageEnterInfo = {
    			position = client.position,
    			rotation = client.rotation
    		}
    
    		local vehicleToShow = 1
    
    		if isElement(client.vehicle) then
    			-- Если игрок в машине, запоминаем координаты машины
    			garageEnterInfo.position = client.vehicle.position
    			garageEnterInfo.rotation = client.vehicle.rotation
    
    			-- Если игрок в машине, принадлежащей ему, отправляем её в гараж
    			if exports["tws-vehicles"]:isVehicleOwnedByPlayer(client.vehicle, client) then
    				vehicleToShow = exports["tws-vehicles"]:getVehicleGarageID(client.vehicle)
    				exports["tws-vehicles"]:returnVehicleToGarage(client.vehicle)
    				removePedFromVehicle(client)
    			end
    		end
    
    		local playerVehiclesTable = fromJSON(playerVehiclesJSON)
    		if playerVehiclesTable then
    			local spawnedVehicles = exports["tws-vehicles"]:getPlayerSpawnedVehicles(client)
    			for k,v in pairs(spawnedVehicles) do
    				playerVehiclesTable[k].spawned = true
    			end
    		else
    			triggerClientEvent(player, "tws-clientGarageEnter", resourceRoot, false, "Ошибка получения списка ваших автомобилей")
    			return
    		end
    
    		-- Кладём координаты в дату
    		client:setData("tws-garageEnterInfo", garageEnterInfo)
    
    		client:setData("tws-inGarage", true)
    		client.interior = 0
    		client.dimension = exports["tws-main"]:getPlayerID(client)
    		client:setPosition(unpack(garagePosition))
    		client.position = client.position + Vector3(0, 0, 10)
    
    		triggerClientEvent(client, "tws-clientGarageEnter", resourceRoot, true, toJSON(playerVehiclesTable), vehicleToShow)
    	end
    )
    
    addEventHandler("tws-serverGarageExit", resourceRoot,
    	function(selectedVehicleID)
    		if client:getData("tws-inGarage") == false then
    			return
    		end
    
    		client:setData("tws-inGarage", false)
    		client.dimension = 0
    		client.interior = 0
    
    		if selectedVehicleID then
    			local vehicle = exports["tws-vehicles"]:spawnPlayerVehicle(client, selectedVehicleID, 0, 0, 0)
    			removePedFromVehicle(client)
    			warpPedIntoVehicle(client, vehicle)
    			setCameraTarget(client)
    		end
    
    		local garageEnterInfo = client:getData("tws-garageEnterInfo")
    	 	if not garageEnterInfo then
    		 	garageEnterInfo = {position: Vector3(0, 0, 0), rotation: Vector3(0, 0, 0)}
    	    end
     
    		if isElement(client.vehicle) then
    			client.vehicle.position = garageEnterInfo.position
    		 	client.vehicle.position = garageEnterInfo.position
    	 	else
    		 	client.position = garageEnterInfo.position
                client.position = garageEnterInfo.position
    	 	end
    
    	 	triggerClientEvent(client, "tws-clientGarageExit", resourceRoot)
     	end
    )

     

  5. Hello! I have such a problem, it's impossible to check the player's money.

    I have a game mod that uses its own money system. And for example, that the player would give the money to the resource, I have to use the export.
    Example:

    exports["tws-main"]:givePlayerMoney

    I need to do something by analogy to check the player's amount of money.

    For example, in this function:

    function StartStudyBtn ()
        if source == StartLessonBtn then
    		local playerLesson = guiGridListGetItemData ( VehicleLessons, guiGridListGetSelectedItem ( VehicleLessons ), 2 )
    		local Money = guiGridListGetItemText ( VehicleLessons, guiGridListGetSelectedItem ( VehicleLessons ), 3 )
    		local StudyLevel = getElementData(localPlayer, "VehLevel")+1
    			if playerLesson and guiGetEnabled(StartLessonBtn) == true then
    				if getPlayerMoney () < tonumber(Money) then
    					outputChatBox("У вас недостаточно денег")
    				else
    					if tonumber(playerLesson) > tonumber(StudyLevel) then
    						outputChatBox("Вы не прошли предыдуший курс")
    					elseif tonumber(playerLesson) < tonumber(StudyLevel) then
    						outputChatBox("Вы уже прошли этот курс")
    					else 
    						if (getElementData ( localPlayer, "working") == "1") then
    							setElementModel ( localPlayer, tonumber(getElementData ( localPlayer, "skinback")))
    							setElementData ( localPlayer, "working", "0" )
    						end
    						guiSetVisible(LicensePanel,false)
    						showCursor(false)
    						removeEventHandler ( "onClientGUIClick", getRootElement(), ByLicense ,false )
    						removeEventHandler ( "onClientGUIClick", getRootElement(), StartStudyBtn ,false )
    						triggerServerEvent("TakePlayerMoney", getRootElement(), localPlayer,Money)
    						setLesson(playerLesson)
    					end
    				end
    			end
    	end
    end

    In line 7 there is a check whether the player has enough money. I need to make an appeal to my system of money tws-money. 
    I tried to do so:

    if localPlayer:getData("tws-money") < tonumber(Money) then

    But I get an error. How can I do this here? Please tell me.
    I apologize for the bad english.

  6. Hello everybody! Just sorry for bad english.
    Such a problem on my server for some reason the player appears on the mini map on the floor or the entire screen.
    I tried to replace the mini card script, but the problem has not disappeared from this, only some players. And that's exactly what the image is spreading from the border with the minimap.
    What could be and how it is possible to fix?

    Here is a screenshot of the problem

    Advance would be very grateful for the answer!

     

  7. Not much I can understand how it can be implemented immediately.
    This is the server part of the script:
     

    createBlip(1904.80798, -1875.38660, 13.56194,46)
    local sweeperki = {
    
    {1904.80798, -1875.38660, 13.56194, 270},
    {1904.80798, -1870.38660, 13.56194, 270},
    {1904.80798, -1865.38660, 13.56194, 270},
    {1904.80798, -1860.38660, 13.56194, 270},
    {1904.80798, -1855.38660, 13.56194, 270},
    {1904.80798, -1850.38660, 13.56194, 270},
    {1917.8698, -1862.37256 , 13.56194, 90},
    {1921.8698, -1862.37256 , 13.56194, 90},
    {1925.8698, -1862.37256 , 13.56194, 90},
    }
    
    for i,v in ipairs(sweeperki) do
        v.sweeper = createVehicle(574, v[1], v[2], v[3], 0, 0, v[4])
        setElementData(v.sweeper, "sweeper:dopracy", 1) 
        setElementFrozen(v.sweeper, true)
        setVehicleLocked(v.sweeper, false)
        setVehicleDamageProof(v.sweeper, true )
    end
    
    local punkty = {
    [1] = {1954.08594, -1874.65625, 13.54688},
    [2] = {1954.26794, -1886.18250, 13.54688},
    [3] = {1954.13489, -1897.88843, 13.54688},
    [4] = {1954.27319, -1909.31433, 13.54688},
    [5] = {1951.84375, -1924.82556, 13.54688},
    [6] = {1941.38416, -1924.69043, 13.54688},
    [7] = {1926.11865, -1924.13684, 13.54688},
    [8] = {1911.16296, -1924.30396, 13.54688},
    [9] = {1896.21094, -1924.20935, 13.54688},
    [10] = {1873.53076, -1924.54944, 13.54688},
    [11] = {1858.87756, -1924.69458, 13.54688},
    [12] = {1848.70020, -1924.64734, 13.54688},
    [13] = {1833.95801, -1924.28638, 13.54688},
    [14] = {1829.27258, -1920.93982, 13.54875},
    [15] = {1829.00964, -1908.74426, 13.51301},
    [16] = {1829.18213, -1898.01489, 13.47368},
    [17] = {1829.21655, -1887.19006, 13.47277},
    [18] = {1829.34045, -1855.69873, 13.57813},
    [19] = {1829.15881, -1835.55383, 13.77813},
    [20] = {1829.06641, -1817.33350, 13.57336},
    [21] = {1828.96204, -1800.64502, 13.55298},
    [22] = {1829.54895, -1787.36963, 13.54688},
    [23] = {1829.43481, -1773.53503, 13.54688},
    [24] = {1833.90747, -1760.08167, 13.54688},
    [25] = {1845.34924, -1760.04407, 13.54688},
    [26] = {1860.09766, -1759.97449, 13.54688},
    [27] = {1870.29443, -1759.97632, 13.54688},
    [28] = {1889.15906, -1759.92346, 13.54688},
    [29] = {1922.46289, -1759.83020, 13.54688},
    [30] = {1953.61145, -1771.04236, 13.54688},
    [31] = {1953.99561, -1807.84521, 13.54688},
    [32] = {1954.12012, -1817.94287, 13.54688},
    [33] = {1954.80115, -1837.05542, 13.53908},
    [34] = {1954.49500, -1856.19482, 13.54688}
    }
    
    function nextPunkt(plr, id)
        local x,y,z = punkty[id][1], punkty[id][2], punkty[id][3]
        triggerClientEvent(plr, "postawSweeperMarker", plr, x, y, z)
    end
    
    
    function startSweeperki(veh, seat)
        if getElementData(veh, "sweeper:dopracy") == 1 and seat == 0 then
        outputChatBox("Диспетчер Анна: Добро пожаловать на работу уборщика улиц.", source)
        outputChatBox("Диспетчер Анна: Продолжайте  движение по синим маркерам!", source)
        outputChatBox("Диспетчер Анна: За каждый круг тебе заплатят 500$", source)
        nextPunkt(source, 1)
        setElementFrozen(veh, false)
    	setVehicleLocked(veh, true)
        setVehicleDamageProof(veh, true )
        setElementData(source, "sweeper:smiec", 1)
        setElementData(source, "sweeper:zebrane", 0)
        if veh then
    		fixVehicle(veh)
    	end
        end
    end
    addEventHandler("onPlayerVehicleEnter", getRootElement(), startSweeperki)
    
    function stopSweeperki(veh, seat)
        if getElementData(veh, "sweeper:dopracy") == 1 and seat == 0 then
            respawnVehicle(veh)
            setElementFrozen(veh, true)
    	    setVehicleLocked(veh, false)
            setVehicleDamageProof(veh, true )
            triggerClientEvent(source, "usunSweeperMarker", source)
        end
    end
    addEventHandler("onPlayerVehicleExit", getRootElement(), stopSweeperki)
    
    function serverSweeperHit(plr)
        if (getElementData(plr, "sweeper:smiec")+1) == #punkty then
            setElementData(plr, "sweeper:smiec", 1)
            nextPunkt(plr, 1)
            exports["tws-main"]:givePlayerMoney(plr, 500)
    		outputChatBox("Диспетчер Анна: Вы получили 500$, можете продолжить или закончить, оставив машину.", source)
        else
            setElementData(plr, "sweeper:smiec", getElementData(plr, "sweeper:smiec")+1)
            nextPunkt(plr, getElementData(plr, "sweeper:smiec"))
        end
    end
    addEvent("sweeperkiHitFunction", true)
    addEventHandler("sweeperkiHitFunction", getRootElement(), serverSweeperHit)

    Could you show an example?

  8. Hello, please tell me, how do I do so that the players could not in any way to open the doors for players to drgua car.
    My script works works as a player gets in the car, then I used the function:

    bool setVehicleLocked ( vehicle theVehicle, bool locked )

    The doors are closed and it is impossible to sit down. But there is a bug, if the player in advance would open the door and quickly gone, the door will be shown as open. The player sits in the car through the other (closed) door, the machine once again uses setVehicleLocked However, another player can steal a car if he sits through the door, which was opened in advance. Meanwhile sama he could steal his car.

     

    How can I fix it?

    I apologize in advance for the bad english.

  9. Hey guys! Immediately I apologize for bad English.
    But I'm looking for someone who can make the script either for free or for a fee.
    I want to implement Donat online system.
    How will this happen?
    Have ready a site through which players can add funds to your account with real money. This site will be entered into the database in the name of the account data such as the amount of donate. 
    I wish that would be the player can enter at the server command in the chat, or press and opened a small window in front of him. In what would have been written by its current balance Donati, just below the exchange rate, and below the input field in which he could exchange Donat in introducing the right amount of play money.
    If for example he did not quite Donati, its alert system, and that he did not.

    If there are willing to help, then write in the subject.
    I will be very grateful.

  10.  

    gRoot    = getRootElement()
    gResRoot = getResourceRootElement( getThisResource() )
    
    addEventHandler( "onClientRender", root, gResRoot, true, "low",
    addEventHandler( "onClientResourceStart", gResRoot,
    	function ()
    		serverlogo = guiCreateStaticImage ( 0.87, 0.015, 0.15, 0.13, "logocris.png", true )
    	end
    ))

    I put this addEventHandler logo in the server resource code, but for some reason he still breaks.

     

  11. 1 minute ago, myonlake said:

    Right.

    
    addEventHandler( "onClientRender", root, myFunction, true, "low" ) -- For your logo
    

     

    This, I must add the resource to the cleaning or in the logo resource?

  12. 48 minutes ago, myonlake said:

    Use addEventHandler's priority parameter on your onClientRender events. That way you'll be able to render the images from different resources in the right order.

    you could make an example could not?

  13. Hello! Since my server players often make photos they need to quickly remove all the excess from the screen. For this I use here is the script:

    local x, y = guiGetScreenSize()
    
    function PlayerNameTags()
    	local players = getElementsByType("player")
    		for k,v in ipairs(players) do
    			if v == getLocalPlayer() then else
    				setPlayerNametagShowing ( v, false )
    				local r, g, b = getPlayerNametagColor(v)
    				
    				local x1,y1,z1 = getElementPosition (getLocalPlayer())
    				local x2,y2,z2 = getElementPosition (v)
    				local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2)
    				if visibleto > 75 then else
    				local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.05 )
    				if not sx and not sy then else
    				dxDrawText ( getPlayerName ( v ), sx,sy-15,sx,sy, tocolor(r,g,b,255), 1.1-visibleto/50, "default-bold", "center","top",false, false, false, true, false )
    				end
    			end
    		end
    	end
    end
    addEventHandler("onClientRender",getRootElement(),PlayerNameTags)
    
    
    local screenWidth,screenHeight = guiGetScreenSize()
    addEventHandler("onClientResourceStart", resourceRoot,
        function()
            myScreenSource = dxCreateScreenSource ( screenWidth, screenHeight )         
        end
    )
    	
     
    function cleanmyscreen()
    	if myScreenSource then
    		dxUpdateScreenSource( myScreenSource )                  
    		dxDrawImage( screenWidth - screenWidth,  screenHeight - screenHeight,  screenWidth, screenHeight, myScreenSource, 0, 0, 0, tocolor (255, 255, 255, 255), true)      
    	end
    end
    
    
    function tooglecleanmyscreen ()
    enabled = not enabled
    if enabled then
    	addEventHandler( "onClientRender", root, cleanmyscreen)
    	else
    	removeEventHandler( "onClientRender", root, cleanmyscreen)
    end
    end
    bindKey ("i", "down", tooglecleanmyscreen)

    It hides absolutely everything: chat, hud, nicks.
    But I would like that to the screenshots players could see my server's logo, which is in my top right corner (There is a separate resource).
    How can I possibly do this in my life clean the screen?
    Thanks in advance for your reply and sorry for my bad english! 

  14. Hello again. Why does not want to run the script.
    He always says "Not enough money Cost is:! 25", although enough money that can be?
    Perhaps my client of the need to finish that?

    function guiClick()
        if (source == button1) then
            local kunde = getLocalPlayer()
    		triggerServerEvent ( "rentroller", getLocalPlayer(), kunde )
    		guiSetInputEnabled ( false )
    		guiSetVisible ( Window, false )
    		showCursor ( false )
    	end
    end
    addEventHandler("onClientGUIClick", getRootElement(), guiClick)

     

  15. function rentCarFuntion ( player ) 
        if getDistanceBetweenPoints3D ( -1981.5, 128.5, 27.6875, getElementPosition(player) ) <2 and getPlayerMoney >=25 then 
           rentCar[player] = createVehicle( 462, -1982.959, 122.84863, 27.6875, 0, 0, 90, "Rent" ) 
           warpPedIntoVehicle( player, rentCar[player] )
           takePlayerMoney(player, 25)
    	   outputChatBox ( "You rent car!", getRootElement(), 0, 255, 0, true )
           setTimer( 
           function ()
              destroyElement(rentCar[player])
    		   outputChatBox ( "Transport's rent over", getRootElement(), 255, 0, 0, true )
           end
           ,600000,1 
           )
        end
    end 
    addEvent( "rentroller", true )
    addEventHandler( "rentroller", getRootElement(),rentCarFuntion )
    addCommandHandler("rentroller",rentCarFuntion ) 

    right?
    if I want to make a notification to a player that he doesn't have enough money to chat, I must, after line 15 insert function outputChatBox? 
    or how?

  16. rentCar = {}
    
    function rentCarFuntion ( player ) 
        if getDistanceBetweenPoints3D ( -1981.5, 128.5, 27.6875, getElementPosition(player) ) <2 then 
           rentCar[player] = createVehicle( 462, -1982.959, 122.84863, 27.6875, 0, 0, 90, "Rent" ) 
           warpPedIntoVehicle( player, rentCar[player] )
           takePlayerMoney(player, 25)
    	   outputChatBox ( "You rent car!", getRootElement(), 0, 255, 0, true )
           setTimer( 
           function ()
              destroyElement(rentCar[player])
    		   outputChatBox ( "Transport's rent over", getRootElement(), 255, 0, 0, true )
           end
           ,600000,1 
           )
        end
    end 
    addEvent( "rentroller", true )
    addEventHandler( "rentroller", getRootElement(),rentCarFuntion )
    addCommandHandler("rentroller",rentCarFuntion ) 

     

    Hello. I have a script transport rentals. Please tell me how to do a background check on the availability of money from the player? Who can please an example in the above code with comments, thank you in advance!

×
×
  • Create New...