Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Мб ты это имеешь ввиду https://wiki.multitheftauto.com/wiki/Set ... wnPosition ?
  2. local function OnHit( pElement ) if getElementType( pElement ) == 'player' then local pTeam = getPlayerTeam( pElement ) if pTeam and isElement( pTeam ) and getTeamName( pTeam ) ~= 'Police' then if getPlayerWantedLevel( pElement ) > 0 then setElementInterior( pElement, 6 ) setElementPosition( pElement, 264.74969, 77.49036, 1001.03906 ) end end end end addEventHandler( 'onPlayerDamage', root, function( pAttacker, nWeapon ) local pTeam = getPlayerTeam( source ) if pTeam and isElement( pTeam ) and getTeamName( pTeam ) == 'Police' then if getPlayerWantedLevel( pAttacker ) > 0 and nWeapon == 3 then local pArrestMarker = createMarker( 1119, 1034, 10, 'cylinder', 2.5, 255, 255, 0, 150, source ) addEventHandler( 'onMarkerHit', pArrestMarker, OnHit ) toggleAllControls( pAttacker, false ) local fX, fY, fZ = getElementPosition( pAttacker ) local fX2, fY2, fZ2 = getElementPosition( source ) if getDistanceBetweenPoints3D( fX, fY, fZ, fX2, fY2, fZ2 ) > 10 then setElementPosition( pAttacker, fX2 - 5, fY2, fZ2 ) end end end end )
  3. Kenix

    setPlayerTeam

    setPlayerTeam ( hitElement, FBI ) hitElement not defined. In this case you should use variable hitPlayer. P.S Tabulate your code!
  4. Hehe no problem. dbPoll return table like { { colname1 = value1, colname2 = value2, ... }; { colname1 = value3, colname2 = value4, ... }; ... }
  5. local aQuery = dbPoll( dbQuery( SQLconnect, 'SELECT * FROM players' ), - 1 ) if aQuery and type( aQuery ) == 'table' then for sIndex, sValue in pairs( aQuery[ 1 ] ) do outputChatBox( tostring( sIndex ) .. ' = ' .. tostring( sValue ) ) end end Maybe you mean this? I not understand what you want. Or you mean this? function table.size( a ) if type( a ) ~= 'table' then return false end local n = 0 for _ in pairs( a ) do n = n + 1 end return n end local aQuery = dbPoll( dbQuery( SQLconnect, 'SELECT * FROM players' ), - 1 ) if aQuery and type( aQuery ) == 'table' then outputChatBox( table.size( aQuery[ 1 ] ) ) end
  6. He not know lua and doing nonsense .. I written to him. I guess he not want learn. @teteomar: Well it's you choice. You can not know lua and something in mta scripting and you will ask 1000+ posts to help you with your code. Listen to me. It's not empty words. If you use /debugscript 3 it's said to you about syntax error.
  7. The best gamemode! Anything not substitute this. Well done Lex128.
  8. Kenix

    [!!HELP!!]

    Learn LUA! I gave you links.. Why you not read?
  9. outputChatBox Already converted number to string.
  10. You should call function getPlayerMoney and in arguments use element player. Also getPlayerMoney return number value (integer) not string. setPlayerName (getRootElement, Cheater) First argument should be element player but not function value. I guess variables Cheater, source not defined. Learn https://forum.multitheftauto.com/viewtop ... 7cb5717055 https://wiki.multitheftauto.com/wiki/Scr ... troduction
  11. Read again all tutorials if you not understand.
  12. Learn lua. https://forum.multitheftauto.com/viewtop ... 118b8f866b
  13. local nChatRange = 100 local function isPlayerInRangeOfPoint( pPlayer, fX, fY, fZ, nRange ) local fPx, fPy, fPz = getElementPosition( pPlayer ) return ( ( fX - fPx ) ^ 2 + ( fY - fPy ) ^ 2 + ( fZ - fPz ) ^ 2 ) ^ 0.5 <= nRange end local function onChat( pPlayer, _, ... ) local fPx, fPy, fPz = getElementPosition( pPlayer ) local sMsg = table.concat( { ... }, ' ' ) local sNick = getPlayerName( pPlayer ) local nR, nG, nB = 255, 255, 255 local pTeam = getPlayerTeam( pPlayer ) if pTeam and isElement( pTeam ) then nR, nG, nB = getTeamColor( pTeam ) end for _, pPlayer in ipairs( getElementsByType 'player' ) do if isPlayerInRangeOfPoint( pPlayer, fPx, fPy, fPz, nChatRange ) then outputChatBox( '(LocalChat)' .. sNick .. ': #ffffff' .. sMsg, pPlayer, nR, nG, nB, true ) end end end local function LocalChatBindManager( ) if eventName == 'onPlayerJoin' then bindKey( source, 'u', 'down', 'chatbox', 'LocalChat' ) else for _, pPlayer in ipairs( getElementsByType 'player' ) do bindKey( pPlayer, 'u', 'down', 'chatbox', 'LocalChat' ) end end end addEventHandler( 'onPlayerJoin', root, LocalChatBindManager ) addEventHandler( 'onResourceStart', resourceRoot, LocalChatBindManager ) addCommandHandler( 'LocalChat', onChat )
  14. If you create object on server side - synced for all players. If you create on client side - synced only for local player.
  15. You need a risk? I think no. Anyway use this with timer.
  16. Always. While not fixed If you not use this function warpPedIntoVehicle with timer, this function not warped ped /player into vehicle. http://bugs.mtasa.com/view.php?id=6909
  17. local pVehicleMarker = createMarker ( 938.79998779297, -1053.1999511719, 30.60000038147, 'cylinder', 2.0, 16, 16, 16, 255 ) local aPlayerVehicles = { } local function OnMarkerHit ( pHitElement ) if getElementType ( pHitElement ) == 'player' and not isPedInVehicle ( pHitElement ) then local pTeam = getPlayerTeam ( pHitElement ) if pTeam and getTeamName ( pTeam ) == 'FBI' then if isElement ( aPlayerVehicles [ pHitElement ] ) then destroyElement ( aPlayerVehicles [ pHitElement ] ) end aPlayerVehicles [ pHitElement ] = createVehicle ( 490, 938.79998779297, -1050.5, 31.89999961853, 0, 0, 0 ) setTimer( warpPedIntoVehicle, 200, 1, pHitElement, aPlayerVehicles [ pHitElement ] ) else outputChatBox( 'You must be on the FBI to use this.', pHitElement, 255, 0, 0 ) end end end addEventHandler ( 'onMarkerHit', pVehicleMarker , OnMarkerHit ) You should use warpPedIntoVehicle with timer.
×
×
  • Create New...