Jump to content

NickScripter

Members
  • Posts

    43
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by NickScripter

  1. I'm current number 1 in the waiting list, but i changed my server IP adress. Is there any way of change the IP adress on the waiting list instead of going back to the last position? Thanks!!
  2. I disabled every vehicle mod and still crashing =/
  3. I will try to remove some mods to see if it stops crashing, thanks for your reply
  4. After 5 minutes playing on my server, the players are crashing.. No clue about what is doing it, can someone help me? On clientscript says: [2019-10-15 17:58:11] ERROR: not enough memory [2019-10-15 17:58:16] ERROR: not enough memory [DUP x562] [2019-10-15 17:58:17] ERROR: not enough memory [2019-10-15 17:58:23] ERROR: not enough memory [DUP x546] [2019-10-15 17:58:23] ERROR: not enough memory MTA Diag: https://pastebin.mtasa.com/889301804 Thanks!!
  5. Hello!! I want to change the shooting style to some that dont need to shoot steady like the original GTA. How can i do it? Any idea? Actual shooting style:
  6. I'm making a create faction command, but it return's WARNING into console. (example of the command that should work but returns error/criarfaccao 2 1 Test) "dbPoll failed; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups SET Name='Test', balance='0', type1='2', type2='1'' at line 1" I tryed everything to fix it but without success. Any idea of what is wrong? (#Line 1) local connection = exports.sas_mysql:getConnection() Server-side function createGroup(playerSource, commandName, typ1, typ2, ...) if getElementData(playerSource,"adminlevel") >= 8 then if typ1 and typ2 and ... then typ1 = tonumber(typ1) typ2 = tonumber(typ2) groupName = table.concat({...}, " ") local theTeam = createTeam(tostring(groupName)) if theTeam then local query, _, id = dbPoll ( dbQuery( connection, "INSERT INTO groups SET Name=?, balance='0', type1='?', type2='?'", groupName, typ1, typ2), -1 ) if query then outputChatBox("#7cc576[TLRP V2 - Grupo]: #4aabd0"..groupName.." #fffffffacção criada com sucesso! #7cc576(ID: ".. id .. " - Tipo 1: ".. typ1 .." - Tipo 2: ".. typ2 ..")", playerSource, 124, 197, 118, true) else outputChatBox("#7cc576[TLRP V2 - erro]: Falha na criação SQL.", playerSource, 255, 0, 0,true) end else outputChatBox("#7cc576[TLRP V2 - erro]: Este grupo já existe. #4aabd0(" .. tostring(groupName) .. ")", playerSource, 255, 0, 0,true) end else outputChatBox("#7cc576[TLRP V2 - Uso]: #ffffff/" .. commandName .. " [Tipo 1] [Tipo 2] [Nome]", playerSource, 124, 197, 118, true) outputChatBox("#7cc576[Tipo 1]: #ffffffGang/Mafia = 2, Outro tipo = 1", playerSource, 124, 197, 118, true) outputChatBox("#7cc576[Tipo 2]: #ffffffPolicial = 1, Bombeiro = 2, SAMU = 3, Conselho = 4, Mafia = 5, Gang = 6, Organização = 7", playerSource, 124, 197, 118, true) end end end addCommandHandler("criarfaccao", createGroup)
  7. Is there any way of a player walk while he is with hands up?
  8. I'm using a script that changes the original sound of GTA vehicles. However, I can't destroy the sound when the vehicle is destroyed. Can anybody help me? Client-side local sound = {} addEventHandler("onClientWorldSound", root, function() if getElementType(source) == "vehicle" then cancelEvent() end end) addEventHandler("onClientElementDestroy", getRootElement(), function () if getElementType(source) == "vehicle" and getPedOccupiedVehicle(getLocalPlayer()) == source then if isElement(sound[veh]) then destroyElement(sound[veh]) end end end) function updateEngineSound() local allVehicles = getElementsByType("vehicle") for index, veh in ipairs (allVehicles) do local model = getElementModel(veh) if model == 411 then if getVehicleEngineState(veh) then if isElement(sound[veh]) then local gear = getVehicleCurrentGear ( veh ) or 1 local velocityX, velocityY, velocityZ = getElementVelocity(veh) local actualspeed = ((velocityX^2 + velocityY^2 + velocityZ^2)^(0.5)) * ((11 - gear) /10) local mph = actualspeed * 70 * 111.847 local minSoundSpeed = 0.15 local soundSpeed = mph/(1000+1000/minSoundSpeed) + minSoundSpeed setSoundSpeed (sound[veh], soundSpeed) else local x, y, z = getElementPosition(veh) sound[veh] = playSound3D("sounds/engine.wav", x, y, z, true) setSoundVolume(sound[veh], 0.2) attachElements(sound[veh], veh) end else if isElement(sound[veh]) then destroyElement(sound[veh]) end end end end end addEventHandler("onClientPreRender", root, updateEngineSound)
  9. That was as close as I could get to making it work =/ do you have any recommendation? Maybe local vehicleTrunkItems = {} function saveItemInVehicleTrunk (vehicle, item) local trunk = vehicleTrunkItems[vehicle] if not trunk then trunk = {} vehicleTrunkItems[vehicle] = trunk end for i=0,12 do local weapon = getPedWeapon(source, i) local ammo = getPedTotalAmmo(source, i) trunk[#trunk + 1] = weapon trunk[#trunk + 1] = ammo --setAccountData(account,"w"..tonumber(i), weapon) --setAccountData(account,"a"..tonumber(i), ammo) end trunk[#trunk + 1] = item takeAllWeapons(source) end ??
  10. Thanks for the asnwer!! I made it ? thanks.. but now i need to find a way to a cop see the weapons stored at the players car. Can you help me? There is my script function getNearestVehicle( player ) local x, y, z = getElementPosition( player ) local prevDistance local nearestVehicle for i, v in ipairs( getElementsByType( "vehicle" ) ) do local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = v end end return nearestVehicle or false end local playerWeapons = { } function doSomethingWithTheNearestVeh( player ) local vehicle = getNearestVehicle( player ) local x1, y1, z1 = getElementPosition ( vehicle ) local x2, y2, z2 = getElementPosition ( player ) if vehicle then if not getPedOccupiedVehicle( player ) then local accName = getAccountName ( getPlayerAccount ( player ) ) if getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) < 5 then local Guardou = getElementData(player, "GuardouArmas") if Guardou == false then for slot = 0, 12 do local weapon = getPedWeapon ( player, slot ) local ammo = getPedTotalAmmo ( player, slot ) if weapon > 0 then if ammo > 0 then if ( not playerWeapons [ player ] ) then playerWeapons [ player ] = { } end outputDxBox(player, 'Você está guardando a(s) arma(s) no porta-malas.', "info") setTimer( outputDxBox, 5000, 1, player, 'Você guardou a(s) arma(s) no porta-malas.', "success") playerWeapons [ player ] [ weapon ] = ammo weapon_nome = getWeaponNameFromID ( weapon ) setTimer(outputChatBox, 5000, 1, "#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffff"..weapon_nome.." com "..ammo.." Bala(s) guardado!", player, 255, 255, 255, true ) --takeAllWeapons(player) setTimer(takeAllWeapons, 5000, 1, player) setPedAnimation( player, "FLAME", "FLAME_fire" ) setTimer( setPedAnimation, 5000, 1, player ) setElementData(player, "GuardouArmas", true) end end end else outputDxBox(player, 'Você já guardou suas armas. /pegararmas para pega-las.', "warning") end else outputDxBox(player, 'Não existem veículos próximos.', "error") end else outputDxBox(player, 'Não existem veículos próximos.', "error") end end end addCommandHandler( "guardararmas", doSomethingWithTheNearestVeh ) addEventHandler("onResourceStart", resourceRoot, function() setElementData(root, "GuardouArmas", false) end) addEventHandler( "onResourceStop", root, function( resource ) setElementData(root, "GuardouArmas", false) end ) function PegarArmas(player) local vehicle = getNearestVehicle( player ) local x1, y1, z1 = getElementPosition ( vehicle ) local x2, y2, z2 = getElementPosition ( player ) if vehicle then if not getPedOccupiedVehicle( player ) then local accName = getAccountName ( getPlayerAccount ( player ) ) if getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) < 5 then local Guardou = getElementData(player, "GuardouArmas") if Guardou == true then if ( playerWeapons [ player ] ) then outputDxBox(player, 'Você está retirando a(s) arma(s) do porta-malas!', "info") setTimer( outputDxBox, 5000, 1, player, 'Você pegou suas armas no porta-malas.', "success") for weapon, ammo in pairs ( playerWeapons [ player ] ) do giveWeapon ( player, tonumber ( weapon ), tonumber ( ammo ) ) setPedAnimation( player, "FLAME", "FLAME_fire" ) setTimer( setPedAnimation, 5000, 1, player ) setTimer(outputChatBox, 5000, 1, "#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffff"..weapon_nome.." com "..ammo.." Bala(s) retirado!", player, 255, 255, 255, true ) setElementData(player, "GuardouArmas", false) end end else outputDxBox(player, 'Você não possui armas guardadas.', "warning") end else outputDxBox(player, 'Não existem veículos próximos.', "error") end else outputDxBox(player, 'Não existem veículos próximos.', "error") end end playerWeapons [ player ] = nil end addCommandHandler( "pegararmas", PegarArmas ) function saveWeapons(player, account) if player and account then for i=0,12 do local weapon = getPedWeapon(player, i) local ammo = getPedTotalAmmo(player, i) setAccountData(account,"w"..tonumber(i), weapon) setAccountData(account,"a"..tonumber(i), ammo) end takeAllWeapons(player) end end addEventHandler("onPlayerQuit",root,function () saveWeapons(source, getPlayerAccount(source)) end) addEventHandler("onPlayerLogout",root,function(prev) saveWeapons(source, prev) end) addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if not account or isGuestAccount(account) then return end for i=0,12 do local weapon = getAccountData(account,"w"..tonumber(i)) local ammo = getAccountData(account,"a"..tonumber(i)) if weapon and ammo then setTimer(giveWeapon, 1000, 1, source, tonumber(weapon), tonumber(ammo), true) end end end) function outputDxBox(thePlayer, text, type) exports.Scripts_Dxmessages:outputDx(thePlayer, text, type) end
  11. I am developing a system of storing the player's weapons in the trunk of his vehicle. I would like some help on how I should make the stored weapon variables. Here is the server: function getNearestVehicle( player ) local x, y, z = getElementPosition( player ) local prevDistance local nearestVehicle for i, v in ipairs( getElementsByType( "vehicle" ) ) do local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = v end end return nearestVehicle or false end function doSomethingWithTheNearestVeh( player ) local vehicle = getNearestVehicle( player ) local x1, y1, z1 = getElementPosition ( vehicle ) local x2, y2, z2 = getElementPosition ( player ) if vehicle then if not getPedOccupiedVehicle( player ) then --local accName = getAccountName ( getPlayerAccount ( player ) ) if getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) < 5 then for slot = 0, 12 do local Armas = getPedWeapon ( player, slot ) local Municao = getPedTotalAmmo ( player, slot ) if Armas > 0 then if Municao > 0 then weapon_nome = getWeaponNameFromID ( Armas ) outputChatBox ("#FF0000✘ #ffffffINFO #FF0000✘➺ #ffffff"..weapon_nome.." com "..Municao.." Bala(s) !", player, 255, 255, 255, true ) else outputChatBox ( "Você não possui armas para serem guardadas.", player, 125, 0, 0 ) end end end else outputChatBox ( "Não existem veículos próximos.", player, 125, 0, 0 ) end else outputChatBox ( "Não existem veículos próximos.", player, 125, 0, 0 ) end end end addCommandHandler( "portamalas", doSomethingWithTheNearestVeh )
  12. It worked! How did I not realize that ?! hahaha Thank you so much!
  13. Hello! I made a speedometer to show some vehicle parameters. however, it is lagging players when enabled. I can not find a solution. can anybody help me? This is my Client-side local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) --local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) getElementHealth ( vehicle ) dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 65, tocolor(0, 0, 0, 180), true) dxDrawText ( "#1e90ffVelocidade: #FFFFFF"..tostring(kphSpeed).." Kmh / "..tostring(mphSpeed).." Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#1e90ffDurabilidade: #FFFFFF"..tostring(currenthealth).."/100", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#1e90ffLocalidade: #FFFFFF" .. getZoneName(x, y, z), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) end addEventHandler ( "onClientRender", root, vehiclestatus )
  14. I am having trouble with my scoreboard. When a player connect as N / A (before logging in), the scoreboard does not appear. and when the player logs in, he appears again. Client: local scx,scy = guiGetScreenSize() local renderTarget = dxCreateRenderTarget( 480, 480,true); local scroll = 0 function DrawText (text, xc,yc, w, h, color,Size,Size1,fonts,alignX,alignY) return dxDrawText(text,xc, yc, w + xc, h + yc, color,Size,Size1,fonts,alignX,alignY, true, false, false, true) end local viss = false function tabs () if getKeyState("tab") then viss = true dxSetRenderTarget(renderTarget,true) --dxSetBlendMode("overwrite") dxSetBlendMode("modulate_add") dxDrawRectangle(0, 20, 480, 460,tocolor(0,0,0,160)) dxDrawRectangle(0, 20, 20, 460,tocolor(0,0,0,255)) local y = 0 for i,v in pairs(getElementsByType('player')) do if getLocalPlayer() == v then dxDrawRectangle(20, 40+y-scroll, 460, 20,tocolor(200,0,0,180)) end DrawText(""..getElementData(v,"ID") or 0,0,40+y,20,20,tocolor(255,255,255,255),1,1,"sans","center","center") if getElementData(v, 'gruppaADM')then dxDrawImage(24,46+y-scroll,12,12,"img/a.png") end DrawText(getPlayerName(v),40,40+y-scroll,20,20,tocolor(255,255,255,255),1,1,"sans","left","center") DrawText("Logado",190,40+y-scroll,50,20,tocolor(255,255,255,255),1,1,"sans","center","center") DrawText(""..getElementData(v,"Country") ,260,40+y-scroll,50,20,tocolor(255,255,255,255),1,1,"sans","center","center") DrawText(""..getElementData(v,"На сервере") or "0с 0м",320,40+y-scroll,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText(" "..getPlayerPing(v),420,40+y-scroll,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") y = y + 22 end DrawText(#getElementsByType('player')..'/30 ',0, 0, 480,20,tocolor(255,255,255,240),1.1,1.1,"sans","right","center") dxDrawRectangle(0, 20, 480, 20,tocolor(0,0,0,255)) DrawText("ID",0,20,20,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText("Nick",20,20,170,20,tocolor(255,255,255,240),1,1,"sans","center","center") --dxDrawRectangle(220,20,80,20,tocolor(255,255,255,255))getElementsByType('player') DrawText("Status",190,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText("País",260,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText("Tempo",320,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText("Clã",370,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") DrawText(" Ping",420,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center") --dxSetBlendMode("blend") dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImage(scx/2-240, scy/2-225, 480, 480, renderTarget) else viss = false end end addEventHandler("onClientRender",root,tabs) function scrollUP (key) if not viss then return end if #getElementsByType('player') > 20 then if key == "mouse_wheel_up" then scroll = math.max( scroll - 35, 0 ) elseif key == "mouse_wheel_down" then scroll = math.min( scroll + 35, (#getElementsByType('player')*22.5) - 460 ) end end end bindKey('mouse_wheel_up', 'down', scrollUP) bindKey('mouse_wheel_down', 'down', scrollUP) Thanks!!
  15. Okay... It is a client only that through this function identifies nearby players and lists them.
  16. I have no idea how i can do it =/ tryed everything..
  17. I want to show on the list only the close ranged players, not everyone
  18. Hello!! I'm having a little trouble showing the names of the near players on the weapon sales list. I am trying to do it this way: function putPlayers() guiGridListClear(players_grid) if (source and isElement(source) and getElementType(source) == "player") and localPlayer ~= source then local sX, sY, sZ = getElementPosition(localPlayer) local rX, rY, rZ = getElementPosition(source) local distance = getDistanceBetweenPoints3D(sX, sY, sZ, rX, rY, rZ) if distance <= range then for _,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(players_grid) guiGridListSetItemText(players_grid,row,1,getPlayerName(source),false,false) end else guiGridListClear(players_grid) end end end I have no idea how i can do it XD
×
×
  • Create New...