Jump to content

komal

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by komal

  1. what about if you destroy the player can you try the code for me, if working ? addEventHandler( "onPlayerWasted", getRootElement( ), function() setCameraMatrix(source,vector3(getElementPosition(source)),vector3(getElementPosition(source))) destroyElement(source) end )
  2. that because the camera follow the Vehicle you need unfollow the camera try the code if this work ... addEventHandler( "onPlayerWasted", getRootElement( ), function() setCameraMatrix(source,vector3(getElementPosition(source)),vector3(getElementPosition(source))) end )
  3. you need applie the shader to the txd , i know you dont understand in shader so i build simple script how this work . https://community.multitheftauto.com/index.php?p=resources&s=details&id=16502
  4. use smoke_flare sa-mp https://community.multitheftauto.com/index.php?p=resources&s=details&id=1292
  5. your problem here local players = getElementsByType("players") replace it to: local players = getElementsByType ( "player" )
  6. because mta debug use the Lua debug librarya so Lua only write file line + function error without resource name you can fix your debugscript view with the script addEventHandler ("onClientDebugMessage",getRootElement(), function(message,level,file,line) outputDebugString ("\n ==============================================") outputDebugString (message) outputDebugString ("file :" .. file) outputDebugString ("line :" .. line) end)
  7. why you dont use player join event in server side ? function playerjoinToserver() addEventHandler ( "onPlayerJoin", getRootElement(),playerjoinToserver) https://wiki.multitheftauto.com/wiki/OnPlayerJoin ==== this is your full code client function text() dxDrawText("Alive Players[#334455"..home_alive.."#ffffff/"..tagColor..enemy_team.."#ffffff]",sX,sY*0.03,sX*0.2,sY*0,tocolor(255,255,255,generalAlpha),clanwar_data_fontSize*1.2,clanwar_data_font,"center","center",false,false,false,true) end addEventHandler("onClientRender", root, text) server teams = {} colour = {} colour.r = 255 colour.g = 85 colour.b = 85 enemyName = "enemyName" local tagColor function updateTeamSettings(playerSource,cmd,R,G,B) local playerName = getPlayerName(playerSource) local account = getPlayerAccount (playerSource) local account_name = getAccountName(account) if isObjectInACLGroup ( "user." .. account_name, aclGetGroup ( "Admin" )) then if not tonumber(R) or not tonumber(G) or not tonumber(B) then outputChatBox("#313131こコBOT#ffffff| #ffffffWrong Syntax #abcdef/color R G B",playerSource,255,255,255,true) return end R,G,B = tonumber(R),tonumber(G),tonumber(B) outputChatBox("#313131こコBOT#ffffff| #ffffffTeam Colour successfully changed",playerSource,255,255,255,true) local enemyTeam = getTeamFromName(enemyName) if enemyTeam then teams[2] = enemyTeam setTeamColor (enemyTeam,R,G,B) else teams[2] = createTeam ( enemyName,R,G,B) if teams[2] then setTeamColor (teams[2],R,G,B) end end end end addCommandHandler("color",updateTeamSettings) function updateTeamColour(team,r,g,b) setTeamColor (team,r,g,b) end function joinplr() setTeamColor (getTeamFromName(enemyName),math.random(1,255),math.random(1,255),math.random(1,255)) end addEventHandler("onPlayerJoin", getRootElement(), joinplr)
  8. your worng is in client side here if enemyTeam then <<<<<<<<<<<<<<<<<< your should write your team name with getTeamFromName("write your team here") your full codes shoud be like that Client side : local colour = {} local tagColor local teams = {} colour.r = 128 colour.g = 128 colour.b = 128 function updateTeamSettings(cmd,R,G,B) if not tonumber(R) or not tonumber(G) or not tonumber(B) then return end R,G,B = tonumber(R),tonumber(G),tonumber(B) if getTeamFromName("enemyName") then teams[2] = getTeamFromName("enemyName") triggerServerEvent ( "updateTeamColour", resourceRoot,getTeamFromName("enemyName"),R,G,B) end end addCommandHandler("color",updateTeamSettings) function tryRandomClr() triggerServerEvent ( "updateTeamColour", resourceRoot,getTeamFromName("enemyName"), math.random(1,255),math.random(1,255),math.random(1,255)) end addEventHandler("onClientPlayerJoin", getRootElement(),tryRandomClr) function text() dxDrawText("Alive Players[#334455"..home_alive.."#ffffff/"..tagColor..enemy_team.."#ffffff]",sX,sY*0.03,sX*0.2,sY*0,tocolor(255,255,255,generalAlpha),clanwar_data_fontSize*1.2,clanwar_data_font,"center","center",false,false,false,true) end addEventHandler("onClientRender", root, text) server side : teams = {} colour = {} colour.r = 255 colour.g = 85 colour.b = 85 enemyName = "enemyName" local tagColor function updateTeamSettings(playerSource,cmd,R,G,B) local playerName = getPlayerName(playerSource) local account = getPlayerAccount (playerSource) local account_name = getAccountName(account) if isObjectInACLGroup ( "user." .. account_name, aclGetGroup ( "Admin" )) then if not tonumber(R) or not tonumber(G) or not tonumber(B) then outputChatBox("#313131こコBOT#ffffff| #ffffffWrong Syntax #abcdef/color R G B",playerSource,255,255,255,true) return end R,G,B = tonumber(R),tonumber(G),tonumber(B) outputChatBox("#313131こコBOT#ffffff| #ffffffTeam Colour successfully changed",playerSource,255,255,255,true) local enemyTeam = getTeamFromName(enemyName) if enemyTeam then teams[2] = enemyTeam setTeamColor (enemyTeam,R,G,B) else teams[2] = createTeam ( enemyName,R,G,B) if teams[2] then setTeamColor (teams[2],R,G,B) end end end end addCommandHandler("color",updateTeamSettings) function updateTeamColour(team,r,g,b) setTeamColor (team,r,g,b) end addEvent("updateTeamColour", true) addEventHandler("updateTeamColour", resourceRoot, updateTeamColour)
  9. you can use MTA NPC Traffic or this https://www.mta-resource.ru/load/resource/id/853
  10. you cant use return pulsa try with the code --server: function getPulsa(phone) local phoneSettings = mysql:query_fetch_assoc("SELECT * FROM `phones` WHERE `phonenumber`='"..mysql:escape_string(tostring(phone)).."' LIMIT 1") local pulsa = 0 if not phoneSettings then outputChatBox("ERROR", source, 255, 0, 0) else pulsa = tonumber(phoneSettings["pulsa"]) or 0 triggerEvent ( "printData", root, pulsa ) end end addEvent("getPulsa", true) addEventHandler("getPulsa", root, getPulsa) --client: function getPulsa(nomor) triggerServerEvent("getPulsa", localPlayer, tonumber(nomor)) end function testPulsa(commandName, nomoer) local pulsa = getPulsa(nomoer) end addCommandHandler("getpulsa", testPulsa, false, false) function printData(data) outputChatBox(data) end addEvent("printData", true) addEventHandler("printData", root,printData)
  11. setTeamColor Server-only function https://wiki.multitheftauto.com/wiki/SetTeamColor to fix it use https://wiki.multitheftauto.com/wiki/TriggerServerEvent server file function changeclr ( tesm,r,g,b ) setTeamColor ( team,r,g,b )end addEvent( "changeclr", true ) addEventHandler( "changeclr", resourceRoot,changeclr ) client your full code + function updateTeamColour() triggerServerEvent ( "changeclr", resourceRoot,team[2], colour.r, colour.g, colour.b ) end addEventHandler("onClientPlayerJoin", getRootElement(), updateTeamColour)
  12. good work , i ill build bf1 with your horse
  13. your create new MTA with all the codes , thank you using System; namespace Vehicle { public void createVehicle(VehicleModel model, Vector3 position) } createVehicle(311,111,222,12); } To Lua local system = {} system.Vehicle=function() createVehicle(311,111,222,12); end system.Vehicle()
  14. just remove it any building around the town and build your prison
  15. make new script to fix the problem spawnPositions={ {1300,200,11}, {800,100,11}, } function respwan(plr) if ( isPedDead (plr ) ) then local x,y,z = unpack(spawnPositions[math.random(#spawnPositions)]); spawnPlayer ( plr, x,y,z) end end addEventHandler( "onPlayerWasted", getRootElement( ), function() setTimer(respwan,10000, 1, source) end )
  16. try your new code here https://www.Lua.org/cgi-bin/demo table = {"1","2","3"} function insertt() table[#table+1]="4" table[#table+1]="5" table[#table+1]="6" table[#table+1]="hello" table[#table+1]=7 table[#table+1]=8 for k,v in pairs(table) do print(v) end end insertt()
  17. Lod always bug in mta nobody carry about LODElements
  18. local table = { {"1", "2", "3", "4"}, } function startInsert() for k=5,8 do table.insert(table,tostring(k)) end end startInsert()
  19. try with setElementData() and getElementData() team getTeamFromName ( string teamName ) createTeam("streamersTeam") setElementData(getTeamFromName("streamersTeam"),"lock",true) if getElementData(getTeamFromName("streamersTeam"),"lock") then outputChatBox("you cant join the team right now ", root, 255, 255, 255, true) end
  20. you should fix the insert data , you cant insert number vaule inside string value in db try fix your script with tostring() and tonumber() or use fromJSON () and toJSON()
×
×
  • Create New...