Search the Community

Showing results for tags 'player'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • Open Source Contributors
    • Suggestions
  • General MTA
    • News
    • Media
    • Site/Forum/IRC/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • community.mtasa.com
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash
  • Private Bugtracker

Found 35 results

  1. Hello there. Me and my friend tried to make a script that makes a spoiler on a vehicle moving. If the vehicle is going above 100km/h the spoiler will change its position. We are using setVehicleComponentPosition. The problem is that only the player who's driving the car can see it moving. Is there any way that it will be visible for everybody on the server?
  2. [help] Display Player Account data

    local level = 0 function render (player, level) level = getElementData player, "LEVEL") or 0 dxDrawText("level ".. level, 110 - 1, 717 - 1, 381 - 1, 754 - 1, tocolor(0, 0, 0, 255), 1.30, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("level ".. level, 110 + 1, 717 - 1, 381 + 1, 754 - 1, tocolor(0, 0, 0, 255), 1.30, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("level ".. level, 110 - 1, 717 + 1, 381 - 1, 754 + 1, tocolor(0, 0, 0, 255), 1.30, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("level ".. level, 110 + 1, 717 + 1, 381 + 1, 754 + 1, tocolor(0, 0, 0, 255), 1.30, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("level ".. level, 110, 717, 381, 754, tocolor(255, 255, 255, 255), 1.30, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, render) can someone pls tell me whats wrong with this script pls and yes i am a bit new to scripting in lua
  3. function check(source) local recipient = getPlayerFromName(source) local accName = getAccountName ( getPlayerAccount ( recipient ) ) -- get his account name local r,g,b if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Forever" ) ) then setPlayerTeam ( recipient, FO ) r, g, b = getTeamColor ( FO ) setPlayerNametagColor ( recipient, r, g, b ) end end addEventHandler ( "onPlayerLogin", getRootElement(), check ) ================================================================ i made a lil script to add clans but it seems that when u reconnect or login again , u are removed from player, the clan members are added into an ACL group marked Forever , i made this piece of code, to add player back into team if the player is in the acl group on login. but it doesnt work. I am not really good at this but , i dont know how to get player from server side , can someone pls explain to me what is wrong in this piece of code and also tell me how to get player from server side thanks
  4. this is my code: function onQuit(thePlayer) for i,v in pairs(getElementsByType("vehicle",resourceRoot)) do if getElementData(v,"oveie") == getPlayerName(thePlayer) then destroyElement(v) end end end addEventHandler ( "onPlayerQuit", root, onQuit ) but this does not working.. why? how to fix it?
  5. How to freeze my player?

    I don't understand this Error = [Expected bool at argument 2, got none]... how to use function clientSide setElementFrozen ? --client side script function FPlayer () setElementFrozen (this, true) --This is how this method? end
  6. I want make a script, which plays sound from youtube.. But.. there is no one converter which would work.. How to use a converter as sound player? Anyone can help?? Sorry for my bad english..
  7. When i press the F11, just the local player blip displayed, and the other players are not.. How to fix this?
  8. setPlayerPosition

    I was creating a new game mode after I do all GUI I did this script but when I click on "ENTER1" key it didn't respond.
  9. [HELP] Player Damage

    Hello! I have a problem with the damage script. I can't kill other players just if they got headshot.. but I don't know why. local playerInjuries = {} -- create a table to save the injuries function copy( t ) local r = {} if type(t) == 'table' then for k, v in pairs( t ) do r[k] = v end end return r end function isMelee( weapon ) return weapon and weapon <= 15 end function killknockedout(source) setElementHealth(source, 0) end function stabilize() if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source]['knockout'] then exports['global']:changeProtectedElementDataEx(source, "injuriedanimation") if isTimer(playerInjuries[source]['knockout']) then killTimer(playerInjuries[source]['knockout']) playerInjuries[source]['knockout'] = nil fadeCamera(source, true, 2) setPedAnimation(source) exports.ls_core:removeAnimation(source) toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) setElementHealth(source, math.max( 20, getElementHealth(source) ) ) end end if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) end end end addEvent( "onPlayerStabilize", false ) addEventHandler( "onPlayerStabilize", getRootElement(), stabilize ) addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then if not getElementData(attacker, "sokkolokezeben") == true then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless(source, true) end end end end ) function healInjuries(healed) if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source]['knockout'] then exports['global']:changeProtectedElementDataEx(source, "injuriedanimation") if isTimer(playerInjuries[source]['knockout']) then killTimer(playerInjuries[source]['knockout']) playerInjuries[source]['knockout'] = nil if healed then fadeCamera(source, true, 2) setPedAnimation(source) exports.global:removeAnimation(source) end end toggleAllControls(source, true, true, false) else if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) toggleControl(source, 'enter_exit', true) end if playerInjuries[source][7] or playerInjuries[source][8] then toggleControl(source, 'sprint', true) toggleControl(source, 'jump', true) end if playerInjuries[source][5] and playerInjuries[source][6] then toggleControl(source, 'fire', true) end if playerInjuries[source][5] or playerInjuries[source][6] then toggleControl(source, 'aim_weapon', true) toggleControl(source, 'jump', true) end end playerInjuries[source] = nil end end addEvent( "onPlayerHeal", false ) addEventHandler( "onPlayerHeal", getRootElement(), healInjuries) function restoreInjuries( ) if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', false) toggleControl(source, 'left', false) toggleControl(source, 'right', false) toggleControl(source, 'backwards', false) toggleControl(source, 'enter_passenger', false) toggleControl(source, 'enter_exit', false) end if playerInjuries[source][7] or playerInjuries[source][8] then toggleControl(source, 'sprint', false) toggleControl(source, 'jump', false) end if playerInjuries[source][5] and playerInjuries[source][6] then toggleControl(source, 'fire', false) end if playerInjuries[source][5] or playerInjuries[source][6] then toggleControl(source, 'aim_weapon', false) toggleControl(source, 'jump', false) end end end addEventHandler( "onPlayerStopAnimation", getRootElement(), restoreInjuries ) function resetInjuries() setPedHeadless(source, false) if playerInjuries[source] then healInjuries() end end addEventHandler( "onPlayerSpawn", getRootElement(), resetInjuries) addEventHandler( "onPlayerQuit", getRootElement(), resetInjuries)
  10. function quitPlayer() if (tostring(getPlayerSerial(source)) == "120689AA5EC3EB83F3D3F73FC15F14A1") then triggerClientEvent(source,"fotulajasd2",source) elseif (tostring(getPlayerSerial(source)) == "EDA7D96FE5A8C37529D99E01C81BC6A1") then triggerClientEvent(source,"foadminasd2",source) elseif (tostring(getPlayerSerial(source)) == "3E3B40B9F9F4DA4BA6B4F6505C2A1B44") then triggerClientEvent(source,"erick2",source) elseif (tostring(getPlayerSerial(source)) == "8674343FC62E6535F63FAF8695C75082") then triggerClientEvent(source,"peniscream2",source) elseif (tostring(getPlayerSerial(source)) == "5FC66297F3E7C7846E35093CB79FDB54") then triggerClientEvent(source,"zuki2",source) elseif (tostring(getPlayerSerial(source)) == "372A821D7D14B31B95B79D8ED09536F2") then triggerClientEvent(source,"boss2",source) elseif (tostring(getPlayerSerial(source)) == "028E4305095AADFB9FA9547A9D36BB12") then triggerClientEvent(source,"posi2",source) elseif (tostring(getPlayerSerial(source)) == "B3FEF7D2F9417CDE42B08950A130BB12") then triggerClientEvent(source,"doki2",source) end end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) What wrong?
  11. Help with game mode

    I'm making a game mode. but could you help me when the person dies return it to the lobby? Thank you
  12. --Client local shader = dxCreateShader("tex.fx",0, 0, true, 'ped') addEvent("broadcastEnableShader", true) -- allow remotely triggered (from server) addEventHandler("broadcastEnableShader", root, function(some_data) -- receive broadcast from the server local img = dxCreateTexture(""..math.random(1,3)..".png") dxSetShaderValue(shader, "tex", img) engineApplyShaderToWorldTexture(shader, "Hoodie_green_co",some_data) end ) addEventHandler( 'onClientResourceStart', resourceRoot, function() for _, p in ipairs(getElementsByType('ped')) do if isElementStreamedIn(p) then local clothing = getElementData(p, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, p) end end end for _, p in ipairs(getElementsByType('player')) do if isElementStreamedIn(p) then local clothing = getElementData(p, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, p) end end end end) addEventHandler( 'onClientElementStreamIn', root, function() if getElementType(source) == 'player' or getElementType(source) == 'ped' then local clothing = getElementData(source, 'blood') if clothing then triggerServerEvent("announceEnableShader", localPlayer, source) end end end) addEventHandler( 'onClientElementDataChange', root, function(name) if (getElementType(source) == 'player' or getElementType(source) == 'ped') and isElementStreamedIn(source) and name == 'blood' then if getElementData(source, 'blood') then triggerServerEvent("announceEnableShader", localPlayer, source) end end end) --SERVER addEvent("announceEnableShader", true) addEventHandler("announceEnableShader", root, function (some_data) -- triggerClientEvent(root, "broadcastEnableShader", source, some_data) end ) Ita not Synchronization((
  13. function test() setElementPosition ( mark, pos.x,pos.y,pos.z ) end addEventHandler("onMarkerHit", mark, test) this is the code. if i hit the marker, the element position change for all players.. how to fix this? sorry for my bad english.
  14. Hello. I want create a dx timer which when the player disconnect, and connect again to the server then not reset the timer. Sorry for my bad english :c
  15. GET account ID

    Boton8 = guiCreateLabel(137, 142, 111, 25, "LEGAJO2", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", "FF27F512") addCommandHandler("p", function() local team = getPlayerTeam(localPlayer) if team then local teamName = getTeamName(team) if teamName == "MOBSA" then local getGui = guiGetVisible(Ventana) if not getGui then guiSetVisible(Ventana, true) guiSetText(Boton10, getPlayerMoney(localplayer)) guiSetText(Boton2, teamName) guiSetText(Boton4, getPlayerName(localPlayer)) guiSetText(Boton8, ID ) --<<Aca necesitaria poner la id del jugador, digamos que aparesca su id showCursor(true) else guiSetVisible(Ventana, false) showCursor(false) print ("Tu trabajas de chofer actualmente") end else print ("Tu trabajas de chofer actualmente") end end end ) Buenas, mi duda es como sacar la id de los jugadores? Veo cual son porque quedan guardadas pero como hago para volcar esos datos en estos textos? Gracias!
  16. Hello, guys. It is possible to create effect and attach it to player/ped? This code doesn't works, may be I doing something wrong? addCommandHandler('eff1', function() local eff local x, y, z = getElementPosition(localPlayer) eff = createEffect('fire', x, y, z, 0.0, 0.0, 0.0) setElementInterior(eff, getElementInterior(localPlayer)) attachElements(eff, localPlayer) end) Please help
  17. Hello! I've made a login panel. After the player logs in, he'll need to select which character he wanna play with. At this point, the player see the selected character in gta world (interior: 0) and a window with his characters. Because if it's interior 0, I want to make only the local player see that character in the world, how is that possible if I can't set the camera's dimension?
  18. [QUESTION] Movement replay

    Hello. Is it possible to make a script that records your movement and then makes a ped do it after you? The exact same thing? Because I tried to do that, with 3 or 4 methods, but the closest I got was like a 5 meters miss at the end of the replay.
  19. set ped rotation to player rotation

    hi guys i have a problem to set ped rotation like player rotation always i mean if you change yor rotation the ped change his rotation too sorry for bad English here is the code local pylonid = 2662 local pylon_x, pylon_y = 0, 0.5 local pylon_c, pylon_v = 0, 0 local pylonheight = 0 local pylonscale = 1.3 local function pylonHead(player, command) if not pylon or pylon == nil then local px, py, pz = getElementPosition( player ) pylon = createObject( pylonid, px, py, pz) attachElements(pylon, player, pylon_x-1, pylon_y, pylonheight, 0, 0, 180) setObjectScale( pylon, pylonscale ) setElementCollisionsEnabled( pylon, true ) myBlip = createBlipAttachedTo ( player, 19 ) ped = createPed( 105, px, py, pz) attachElements( ped, player, pylon_c-2, pylon_v, pylonheight) setPedAnimation(ped, "wuzi", "wuzi_walk") peda = createPed( 33, px, py, pz) attachElements( peda, player, pylon_c-1, pylon_v-1, pylonheight) setPedAnimation(peda, "wuzi", "wuzi_walk") pedb = createPed( 33, px, py, pz) attachElements( pedb, player, pylon_c, pylon_v-1, pylonheight) setPedAnimation(pedb, "wuzi", "wuzi_walk") pedc = createPed( 105, px, py, pz) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk") else detachElements( pylon, player ) detachElements( ped, player ) detachElements( peda, player ) detachElements( pedb, player ) detachElements( pedc, player ) destroyElement( pylon ) setPedAnimation(ped, "riot", "riot_angry") setPedAnimation(peda, "riot", "riot_chant") setPedAnimation(pedb, "riot", "riot_punches") setPedAnimation(pedc, "riot", "riot_shout") destroyElement( myBlip ) pylon = nil end end addCommandHandler("bnr", pylonHead) i want the peds (ped , peda , pedb and pedc) moveing with me i need only to set rotation changing with me thank you ... mta server write like this [00:53:36] WARNING: banner\pylonhead.lua:28: Bad argument @ 'setElementRotation' [Expected element at argument 1, got number '0']
  20. السلام عليكم المشكلة باختصار انه انا اريد اسوي بيد (ped) واخلي الروتيشن حقه مثل الروتيشن حق اللاعب يعي يتغير باستمرار قصدي من يفتر اللاعب يفتر معاه البيد يعني من يغير اللاعب الروتيشن حقه ابي يسوي البيد setElementRotation(thePed, (getPlayerRotation (thePlayer) ) ) بس حاليا المشكلة اني ما اعرف كيف اجيب كود انه اذا تغير روتيشن اللاعب ولعلمكم انا مخلي ped attached with player pedc = createPed( 105, px, py, pz) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk")
  21. i have this script: exports.scoreboard:addScoreboardColumn('Játszott idő') local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hours' ] = tonumber( t[ source ][ 'hours' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hours"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hours = tonumber( t[ v ][ 'hours' ] or 0 ) setElementData( v, "Játszott idő", tostring( hours )..' óra '..tostring( min )..' perc' ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'Játszott idő' ) local hours = tonumber( t[ source ][ 'hours' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "Játszott idő-hours", tostring(hours) ) setAccountData ( playeraccount, "Játszott idő-min", tostring(min) ) setAccountData ( playeraccount, "Játszott idő-sec", tostring(sec) ) setAccountData ( playeraccount, "Játszott idő", tostring(sValue) ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "Játszott idő" ) local hou = getAccountData ( playeraccount, "Játszott idő-hours") local min = getAccountData ( playeraccount, "Játszott idő-min") local sec = getAccountData ( playeraccount, "Játszott idő-sec") if ( time ) then setElementData ( source, "Játszott idő", time ) t[ source ]["hours"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "Játszott idő",0 ) setAccountData ( playeraccount, "Játszott idő",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) and i want add a function, what get players played time, and when reach xy played time (for example 30), then do something (for example output a text to chat box) How is it possible?
  22. i downloaded this script https://community.mtasa.com/index.php?p=resources&s=details&id=10944 but this doesn't save the player coint to account, how to ad this function?
  23. function someName(killer,weapon,bodypart) if(killer == getLocalPlayer()) then return end if bodypart == 9 then local sound = playSound("headshot.mp3",false) end end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), someName ) fileDelete("client.lua") what wrong?
  24. Why not working isPlayerMuted?

    function privateMessage(thePlayer,commandName,sendToName,...) local pmWords = { ... } local pmMessage = table.concat( pmWords, " " ) if sendToName then if (getPlayerFromParticalName (sendToName)) then toPlayer = (getPlayerFromParticalName (sendToName)) if isPlayerMuted ( thePlayer ) then outputChatBox ( "You Cannot Send Pm Message, Because You Are Muted" thePlayer, r, g, b, true ) else if not (toPlayer == thePlayer) then if not (pmMessage == "") then outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Üzenet neki: #FFFFFF" .. getPlayerName(toPlayer) .. "#FF0000: " .. pmMessage, thePlayer, 255, 255, 255, true) outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Üzenet tőle: #FFFFFF" .. getPlayerName(thePlayer) .. "#00FF00: " .. pmMessage, toPlayer, 255, 255, 255, true) else outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Helytelen használat! Helyes:#FFFFFF /pm <név> <üzenet>", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Magaddal nem tudsz csevegni#FFFFFF!", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Játékos nem található! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) return false end else outputChatBox("#0088FF[#c8c8c8Privát]#FFFFFF Helytelen használat! Helyes:#FFFFFF /pm <név> <üzenet>", thePlayer, 255, 255, 255, true) return false end end addCommandHandler("pm", privateMessage) i want, when a player muted, he cannot send pm to other player, why not working this? sorry for my very bad English:c
  25. function fvalt( prevSlot, newSlot ) if getElementData (target, "greenzone") then setPedWeaponSlot(source,0) end end addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, fvalt ) i added this to a greenzones script, but this doesn't working, why?