-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
Я думаю можно,Александр ведь реализовал как-то http://alexander.sannybuilder.com/?cate ... t_adjuster
-
Я думаю , что никто отвечать бесплатно не будет. Лучше изучи эту тему viewtopic.php?f=141&t=32458
-
addEvent( "GUIEditor_Button[1]",true ) addEventHandler( "GUIEditor_Button[1]",root, function( ) local acc = getPlayerAccount( source ) if acc then local accName = getAccountName( acc ) local PlayerMoney = getPlayerMoney( source ) if ( PlayerMoney >= 0 ) then elseif isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then takePlayerMoney( source,0 ) setGameSpeed( 10.0 ) outputChatBox ( "#FFCC00[" ..getPlayerName( source ) .. "]:#FF0000 Has killing by {shop}",root, 255, 0, 0, true ) else outputChatBox( "ERRoR Shop!", source, 255, 0, 0 ) end end end ) P.S You can tabulate your code in next time? P.S update code
-
Юзай событие https://wiki.multitheftauto.com/wiki/OnResourceStop
-
It's created only in plugin mysql.
-
Для начала https://wiki.multitheftauto.com/wiki/RU/ ... 1.82.D0.B0
-
better use getControlState
-
mysql (писал в первом посте). https://wiki.multitheftauto.com/wiki/Mysql 1.2-release-3677 XP -> 7 P.S Проблема решена , обновил модуль более новой версии. P.S Так и не понял почему старый модуль работал на xp а на 7 нет.
-
До переустановки ос модуль мускул( mysql ) функционировал, но после переустановки когда сервер запускается модуль просто не находится. P.S Пробывал переименовывать модуль и в конфиге сервера всё тоже самое не находит и всё. Помогите пожалуйста.
-
viewtopic.php?f=108&t=33342 ?
-
Steps: 1.You need register in community center. 2.Login in bug tracker. 3.Search right top corner title "Project" and select "New Issues" 4.Search center button "Report Issue". 5.Report
-
You not know how report in bug tracker?
-
Request this in bug tracker
-
Your code syntax is wrong. http://www.lua.org/manual/5.1/ Learn lua.
-
Your code is wrong variable sourcePlayer is nil and distance too. http://www.lua.org/manual/5.1/ https://wiki.multitheftauto.com/wiki/Event https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/OnPlayerChat
-
Your syntax is wrong function giveMeVehicles(vehicles) if type(vehicles) == 'number' then vehicles = { vehicles } end local px, py, pz, prot local radius = 3 local playerVehicle = getPedOccupiedVehicle(source) if playerVehicle and isElement(playerVehicle) then px, py, pz = getElementPosition(playerVehicle) prot, prot, prot = getVehicleRotation(playerVehicle) else px, py, pz = getElementPosition(source) prot = getPedRotation(source) end local offsetRot = math.rad(prot) local vx = px + radius * math.cos(offsetRot) local vy = py + radius * math.sin(offsetRot) local vz = pz + 2 local vrot = prot local vehicleList = g_PlayerData[source].vehicles local vehicle if ( not vehicles ) then return end for i,vehID in ipairs(vehicles) do if vehID < 400 or vehID > 611 then errMsg(vehID ..' is incorrect vehicle model', source) elseif not table.find(getOption('vehicles.disallowed'), vehID) then if #vehicleList >= getOption('vehicles.maxperplayer') then unloadVehicle(vehicleList[1]) end vehicle = createVehicle(vehID, vx, vy, vz, 0, 0, vrot) if (not isElement(vehicle)) then return end setElementInterior(vehicle, getElementInterior(source)) setElementDimension(vehicle, getElementDimension(source)) table.insert(vehicleList, vehicle) g_VehicleData[vehicle] = { creator = source, timers = {} } warpPedIntoVehicle(source, vehicle) if not g_Trailers[vehID] then if getOption('vehicles.idleexplode') then g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) end g_VehicleData[vehicle].timers.destroy = setTimer(unloadVehicle, getOption('vehicles.maxidletime') + (getOption('vehicles.idleexplode') and 10000 or 0), 1, vehicle) end vx = vx + 4 vz = vz + 4 else errMsg(getVehicleNameFromModel(vehID):gsub('y$', 'ie') .. 's are not allowed', source) end end end Use mta script editor or luaEdit
-
addEventHandler("onClientResourceStart", getRootElement(), setWheels) Будет заменять при старте любого ресурса , по этому надо юазть resourceRoot вместо getRootElement( )
-
local spawnpoint function spawn( player ) local player = player or source if get( getResourceName( getThisResource( ) )..".spawnreset" ) == "onSpawn" then spawnpoint = getRandomSpawnPoint( ) end exports.spawnmanager:spawnPlayerAtSpawnpoint ( player,spawnpoint,false ) setElementModel( player, tonumber( getElementData( player,"tempSkin" ) or 0 ) ) fadeCamera( player, true ) setCameraTarget( player, player ) showChat( player, true ) end addEventHandler("onResourceStart", resourceRoot, function() spawnpoint = getRandomSpawnPoint( ) --resetMapInfo() is triggered in mapmanager for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function joinHandler ( ) --spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, skin, 0) spawnPlayer (source, -1969.2669677734, 137.71185302734, 30, 0, 0, 0) fadeCamera (source, true) setCameraTarget ( source, source ) end addEventHandler ( "onPlayerJoin" , root , joinHandler ) --[[ function spawnWasted(player, skin) repeat until spawnPlayer ( player, -2655.02, 625.30, 14.45, 180, skin, 0) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source, tonumber(getElementData(source,"tempSkin"))) end ) --]] function greetPlayer ( ) outputChatBox ( "Welcome to Zer0w's server" , source, 0, 159, 255 ) end addEventHandler ( "onPlayerLogin", root, greetPlayer ) function onPlayerQuit() local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = getPlayerMoney( source ) local playerSkin = getElementModel( source ) setAccountData( playerAccount, "money", playerMoney ) setAccountData( playerAccount, "skin", playerSkin ) end end addEventHandler( "onPlayerQuit", root, onPlayerQuit ) function onPlayerLogin( ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = tonumber( getAccountData( playerAccount, "money" ) ) local playerSkin = tonumber( getAccountData( playerAccount, "skin" ) ) if playerMoney and playerSkin then setPlayerMoney( source, playerMoney ) setElementModel( source, playerSkin ) end end end addEventHandler( "onPlayerLogin", root, onPlayerLogin ) function getRandomSpawnPoint( ) local spawnpoints = getElementsByType( "spawnpoint" ) return spawnpoints[ math.random( 1,#spawnpoints ) ] end addEventHandler( "onPlayerJoin", root, function() spawn( source ) end ) addEventHandler( "onPlayerQuit",root, function ( ) if getPlayerCount( ) == 1 and get( getResourceName( getThisResource( ) )..".spawnreset" ) == "onServerEmpty" then spawnpoint = getRandomSpawnPoint( ) end end ) addEventHandler("onPlayerWasted", root, function( ) setElementData( source,"tempSkin",getElementModel( source ) ) setTimer( spawn, 1800, 1, source ) end )
-
www.google.ru
-
You need create infinite timer( for update ) https://wiki.multitheftauto.com/wiki/SetTimer See in arguments local timers = { } function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Wins",tostring( getAccountData( account,"Race Wins" ) or 0 ) +1 ) end local playername = getPlayerName( alivePlayers[1] ) outputChatBox ( "#FFA824The player " .. playername .. " won!", root, 255, 255, 255, true ) end end addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Loses",tostring( getAccountData( account,"Race Loses" ) or 0 )+1 ) end end ) function ratioCalculator( player ) local KDR_DECIMAL_PLACES = 2 local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local raceLoses = getAccountData( account,"Race Loses" ) if raceLoses == 0 then setAccountData( account, "Ratio", "-") else local kdr = round( getAccountData( account, "Race Wins" ) / raceLoses, KDR_DECIMAL_PLACES ) setAccountData( account, "Ratio", tostring(kdr)) end end end addEventHandler( "onPlayerQuit",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local timePlayed = getElementData( source, "Time played" ) if not timePlayed then setAccountData( account, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) setAccountData( account, "Time played", tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ) ) end if isTimer( timers[ source ] ) then killTimer( timers[ source ] ) timers[ source ] = nil end end ) addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local raceWins = getAccountData( account,"Race Wins" ) or 0 local raceLoses = getAccountData( account,"Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 setElementData( source,"Race Wins",tostring( raceWins ) ) setElementData( source,"Race Loses",tostring( raceLoses ) ) setElementData( source,"Ratio",tostring( ratio ) ) end timers[ source ] = setTimer( function( player ) local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local timePlayed = getAccountData( account, "Time played" ) if not timePlayed then setElementData( player, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) local hours = tonumber( hours ) or 0 local mins = tonumber( mins ) or 0 local secs = tonumber( secs ) or 0 local newsec if hours and mins and secs then newsec = secs + 1 if ( newsec >= 60 ) then newsec = 0 mins = mins + 1 end if ( mins >= 60 ) then mins = 0 hours = hours + 1 end setElementData ( player, "Time played", tostring( hours ) ..":".. tostring( mins ) ..":".. tostring( newsec ) ) end end end ,1000,0, source ) end ) function publicstatsinfo( ) if isElement( source ) then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 local timePlayed = getAccountData( account, "Time played" ) local hours, mins, secs = unpack( split( timePlayed, ":" ) ) if loses and wins then outputChatBox("#FFA824*" .. tostring( askdname ) .. " won " .. tostring( wins ) .. " times and he/she lost " ..tostring( loses ).. " times, his/her ratio is " .. tostring( ratio ) .. " and the total time played he/she is: " .. tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ), root, 255, 12, 15, true) else outputChatBox("*You don't losed or won" , root, 255, 12, 15, true) end end else outputChatBox( "Eror source is not player" ) end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then triggerEvent( "stats", source ) cancelEvent( ) end end end addEventHandler( "onPlayerChat", root, checkCommand )
-
Because source is nil and not output in chat Check it and write in next post what output function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Wins",tostring( getAccountData( account,"Race Wins" ) or 0 ) +1 ) end local playername = getPlayerName( alivePlayers[1] ) outputChatBox ( "#FFA824The player " .. playername .. " won!", root, 255, 255, 255, true ) end end addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Loses",tostring( getAccountData( account,"Race Loses" ) or 0 )+1 ) end end ) function ratioCalculator( player ) local KDR_DECIMAL_PLACES = 2 local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local raceLoses = getAccountData( account,"Race Loses" ) if raceLoses == 0 then setAccountData( account, "Ratio", "-") else local kdr = round( getAccountData( account, "Race Wins" ) / raceLoses, KDR_DECIMAL_PLACES ) setAccountData( account, "Ratio", tostring(kdr)) end end end addEventHandler( "onPlayerQuit",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local timePlayed = getElementData( source, "Time played" ) if not timePlayed then setAccountData( account, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) setAccountData( account, "Time played", tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ) ) end end ) addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local raceWins = getAccountData( account,"Race Wins" ) or 0 local raceLoses = getAccountData( account,"Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 setElementData( source,"Race Wins",tostring( raceWins ) ) setElementData( source,"Race Loses",tostring( raceLoses ) ) setElementData( source,"Ratio",tostring( ratio ) ) end setTimer( function( player ) local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local timePlayed = getAccountData( account, "Time played" ) if not timePlayed then setElementData( player, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) local hours = tonumber( hours ) or 0 local mins = tonumber( mins ) or 0 local secs = tonumber( secs ) or 0 local newsec if hours and mins and secs then newsec = secs + 1 if ( newsec >= 60 ) then newsec = 0 mins = mins + 1 end if ( mins >= 60 ) then mins = 0 hours = hours + 1 end setElementData ( player, "Time played", tostring( hours ) ..":".. tostring( mins ) ..":".. tostring( newsec ) ) end end end ,1000,1, source ) end ) function publicstatsinfo( ) if isElement( source ) then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 local timePlayed = getAccountData( account, "Time played" ) local hours, mins, secs = unpack( split( timePlayed, ":" ) ) if loses and wins then outputChatBox("#FFA824*" .. tostring( askdname ) .. " won " .. tostring( wins ) .. " times and he/she lost " ..tostring( loses ).. " times, his/her ratio is " .. tostring( ratio ) .. " and the total time played he/she is: " .. tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ), root, 255, 12, 15, true) else outputChatBox("*You don't losed or won" , root, 255, 12, 15, true) end end else outputChatBox( "Eror source is not player" ) end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then triggerEvent( "stats", source ) cancelEvent( ) end end end addEventHandler( "onPlayerChat", root, checkCommand )
-
Check return value variable urfont
-
Try function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Wins",tostring( getAccountData( account,"Race Wins" ) or 0 ) +1 ) end local playername = getPlayerName( alivePlayers[1] ) outputChatBox ( "#FFA824The player " .. playername .. " won!", root, 255, 255, 255, true ) end end addEventHandler( "onPlayerWasted", root, function( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Race Loses",tostring( getAccountData( account,"Race Loses" ) or 0 )+1 ) end end ) function ratioCalculator( player ) local KDR_DECIMAL_PLACES = 2 local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local raceLoses = getAccountData( account,"Race Loses" ) if raceLoses == 0 then setAccountData( account, "Ratio", "-") else local kdr = round( getAccountData( account, "Race Wins" ) / raceLoses, KDR_DECIMAL_PLACES ) setAccountData( account, "Ratio", tostring(kdr)) end end end addEventHandler( "onPlayerQuit",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local timePlayed = getElementData( source, "Time played" ) if not timePlayed then setAccountData( account, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) setAccountData( account, "Time played", tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ) ) end end ) addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local raceWins = getAccountData( account,"Race Wins" ) or 0 local raceLoses = getAccountData( account,"Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 setElementData( source,"Race Wins",tostring( raceWins ) ) setElementData( source,"Race Loses",tostring( raceLoses ) ) setElementData( source,"Ratio",tostring( ratio ) ) end setTimer( function( player ) local account = getPlayerAccount( player ) if account then if isGuestAccount( account ) then return end local timePlayed = getAccountData( account, "Time played" ) if not timePlayed then setElementData( player, "Time played","0:0:0" ) end local hours, mins, secs = unpack( split( timePlayed, ":" ) ) local hours = tonumber( hours ) or 0 local mins = tonumber( mins ) or 0 local secs = tonumber( secs ) or 0 local newsec if hours and mins and secs then newsec = secs + 1 if ( newsec >= 60 ) then newsec = 0 mins = mins + 1 end if ( mins >= 60 ) then mins = 0 hours = hours + 1 end setElementData ( player, "Time played", tostring( hours ) ..":".. tostring( mins ) ..":".. tostring( newsec ) ) end end end ,1000,1, source ) end ) function publicstatsinfo( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Race Wins" ) or 0 local loses = getAccountData( account, "Race Loses" ) or 0 local ratio = getAccountData( account, "Ratio" ) or 0 local timePlayed = getAccountData( account, "Time played" ) local hours, mins, secs = unpack( split( timePlayed, ":" ) ) if loses and wins then outputChatBox("#FFA824*" .. tostring( askdname ) .. " won " .. tostring( wins ) .. " times and he/she lost " ..tostring( loses ).. " times, his/her ratio is " .. tostring( ratio ) .. " and the total time played he/she is: " .. tostring( hours or 0 ) ..":".. tostring( mins or 0 ) ..":".. tostring( secs or 0 ), root, 255, 12, 15, true) else outputChatBox("*You don't losed or won" , root, 255, 12, 15, true) end end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then cancelEvent( ) triggerEvent( "stats", source ) end end end addEventHandler( "onPlayerChat", root, checkCommand )