Burak5312

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Burak5312

  • Rank
    Civilian

Recent Profile Visitors

299 profile views
  1. emin değilim ama isimle ilgili olan bölüme 2 nokta arasını hesaplayan bir if ekle böylece istediğine varabilirsin aynı şekilde ne kadar mesafede görüneceğini ayarlamak için tekrar 5 i arttır veya azalt kodda doğru yeri yapmamış olabilirim ama isim bölümünü if içine alcaksın if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) <= 5 or getPedTarget(localPlayer) == v) then end örnek: local x,y,z = getElementPosition(localPlayer); for _,v in ipairs(getElementsByType("player")) do setPlayerNametagShowing(v, false); if (v ~= localPlayer) then local px,py,pz = getElementPosition(v); if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) <= 5 or getPedTarget(localPlayer) == v) then local sx,sy = getScreenFromWorldPosition(px, py, pz+0.50, 0.06); if (sx and sy) then local tHumanity = getElementData(v,"humanity"); local text = (getPlayerName(v):gsub("#%x%x%x%x%x%x", "")); local w = dxGetTextWidth(text, 1, "default-bold"); if (getElementData(v,"gang") == getElementData(localPlayer,"gang")) then dxDrawImage(sx-50, sy-75, 100, 100, "images/tag.png"); end if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) <= 5 or getPedTarget(localPlayer) == v) then --BURASI dxDrawImage(sx-(w/2+22),sy-3,20,20,"images/network.png",0,0,0,getPlayerPingColor(getPlayerPing(v))) dxDrawText(text, sx-(w/2)+1, sy+1, sx-(w/2)+1, sy+1, tocolor(0, 0, 0, 255), 1, "default-bold"); end if (tHumanity <= 0) then dxDrawText(text, sx-(w/2), sy, sx-(w/2), sy, tocolor(150, 50, 50, 255), 1, "default-bold"); elseif (tHumanity >= 1) then dxDrawText(text, sx-(w/2), sy, sx-(w/2), sy, tocolor(50, 150, 50, 255), 1, "default-bold"); elseif (tHumanity >= 5000) then dxDrawText(text, sx-(w/2), sy, sx-(w/2), sy, tocolor(50, 50, 150, 255), 1, "default-bold"); end end end end end @IIYAMA yes its correct sub section thank you
  2. if (getDistanceBetweenPoints3D(x, y, z, px, py, pz) <= 5 or getPedTarget(localPlayer) == v) then try increase 5
  3. maybe this work function FORCE_PLAYER_WALK( player, condition ) if( condition == true ) then bindKey(player, "w", "down", function() setControlState(player, "walk", true) setControlState(player, "forwards", true) end) bindKey(player, "w", "up", function() setControlState(player, "walk", false) setControlState(player, "forwards", false) end) toggleControl( player, "sprint", false ) toggleControl( player, "forwards", false ) toggleControl( player, "backwards", false ) toggleControl( player, "left", false ) toggleControl( player, "right", false ) elseif( condition == false ) then toggleControl( player, "sprint", true ) toggleControl( player, "forwards", true ) toggleControl( player, "backwards", true ) toggleControl( player, "left", true ) toggleControl( player, "right", true ) unbindKey( player, "w", "down" ) unbindKey( player, "w", "up" ) else return nil end end addCommandHandler("force", function( player ) FORCE_PLAYER_WALK( player, true ) end ) addCommandHandler("forceend", function( player ) FORCE_PLAYER_WALK( player, false ) end )
  4. hello how can i detect when serverside ped damaged by player my purpose is ped turn face player and run if player not inside range function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function createTank( x, y, z ) if not (x) or not (y) or not (z) then return false end local THE_TANK = createPed( 0, x, y, z ) local tankX, tankY, tankZ = getElementPosition( THE_TANK ) local DETECT_RANGE = createColSphere( tankX, tankY, tankZ, 50 ) local BLIP = createBlipAttachedTo ( THE_TANK, 23 ) setBlipVisibleDistance( BLIP, 130 ) attachElements( DETECT_RANGE, THE_TANK ) local DETECT_TIMER = nil local TARGET_PLAYER = nil local FINDWAY_TIMER = nil if ( TARGET_PLAYER == nil ) then setTimer(function() setPedAnimation( THE_TANK, "ped", "idle_hbhb", -1, true, false, false, false ) end, 50, 1) end local function findWay() local tankX, tankY,_ = getElementPosition( THE_TANK ) local playerX, playerY,_ = getElementPosition( TARGET_PLAYER ) setElementRotation( THE_TANK, 0, 0, findRotation(tankX, tankY, playerX, playerY), "default", true ) end local function checkAround() if ( FINDWAY_TIMER == nil ) and ( TARGET_PLAYER == nil ) then local players = getElementsByType("player") for key, player in ipairs(players) do if( isElementWithinColShape(player, DETECT_RANGE ) ) then TARGET_PLAYER = player FINDWAY_TIMER = setTimer( findWay, 200, 0 ) return true end end end end DETECT_TIMER = setTimer(checkAround, 2000, 0) -- HERE!!! addEventHandler("onPedDamage", THE_TANK, function( attacker, attackerweapon, bodypart, loss ) if( attacker ) and ( getElementType(attacker) == "player" ) and ( TARGET_PLAYER == nil ) and ( FINDWAY_TIMER ==nil ) then TARGET_PLAYER = attacker FINDWAY_TIMER = setTimer(findWay, 200, 0) end end ) end createTank( 1942.90063, -1706.56201, 13.38281 )
  5. hello there a way to show a client side ped to another player? or is this just done as server side? my purpose show one player around zombies other player thank you
  6. thanks man worked! actually i write getter setters client version will be better thank you
  7. hello im trying call text with triggerClientEvent but saying ERROR: server triggered clientside event showHUD but event not is not added clientside and my client side code draw nil on the screen im trying to 58.line in server side my purpose is transfer server side data to client side client local screenW, screenH = guiGetScreenSize() function EXP_HUD(exp) dxDrawText( tostring( exp ), screenW/2, screenH/2, screenW/2, screenH/2, tocolor( 255,255,255,255 ), 1, "bankgothic", "center", "center" ) end addEventHandler("onClientRender", root, EXP_HUD) addEvent( "showHUD", true ) addEventHandler( "showHUD", localPlayer, EXP_HUD ) server function math.round( number ) return number - number % 1 end --====================================================================+ --INFO: Setter Getter Functions EXP AND LEVEL --====================================================================+ function getRequiredEXP( level ) if not ( level ) then return false end return math.round( math.pow( level, 2 ) * 300 ) end function getPlayerEXP( player ) if not ( player ) then return false end return getElementData( player, "ZR_EXP" ) end function setPlayerEXP( player, value ) if not ( player or value ) then return false end return setElementData( player, "ZR_EXP", tonumber( value ) ) end function getPlayerLevel( player ) if not ( player ) then return false end return getElementData( player, "ZR_LEVEL" ) end function setPlayerLevel( player, newlevel ) if not ( player or newlevel ) then return false end return setElementData( player, "ZR_LEVEL", tonumber( newlevel ) ) end function level_UP( player ) if not (player) then return false end local mylevel = getPlayerLevel( player ) local myexp = getPlayerEXP( player ) local required = getRequiredEXP( mylevel ) if myexp >= required then while myexp >= required do setPlayerLevel( player, mylevel + 1 ) outputChatBox( getPlayerLevel( player ) ) required = getRequiredEXP( mylevel + 1 ) outputChatBox( required ) end end end function addEXP( player, value ) if not ( player or value ) then return false end local myexp = getPlayerEXP( player ) setPlayerEXP( player, myexp + tonumber( value ) ) level_UP( player ) end function callHUD() local myexp = getPlayerEXP( source ) triggerClientEvent( source, "showHUD", source, myexp ) end -- initiliaze exp/level stuff addEventHandler( "onPlayerJoin", getRootElement(), function() setElementData(source, "ZR_LEVEL", 1) setElementData(source, "ZR_EXP", 0) callHUD( source ) end ) addCommandHandler( "getlevelexp", function( player ) local mylevel = getPlayerLevel( player ) local myexp = getPlayerEXP( player ) local required = getRequiredEXP( mylevel ) outputChatBox( "You Level: "..tostring( mylevel ) ) outputChatBox( "You EXP: "..tostring( myexp ) ) outputChatBox( "Need EXP: "..tostring( required ) ) end ) addCommandHandler("giveexp", function( player ) addEXP( player, 100 ) end )
  8. this time not be full exp bar when level up
  9. yes goes below 0 but i dont know how to fix this i spend my all day :d problem calculate formule? i tryed other methods but when level up exp bar staying half i need zero bar
  10. hello i need calculate between totalexp and requiredexp but i need reset exp bar when level up this bar disturb and backward like that 3 or 4 level help me please function math.round(number) return number - number % 1 end function getRequiredEXP(level) return math.round(math.pow(level, 2) * 300) end local level = 1 local currentEXP = 0 local totalEXP = 0 local requiredLevel = 0 local requiredEXP = getRequiredEXP(requiredLevel + 1) function DRAW_HUD() local percentageEXP = (currentEXP / requiredEXP) * 369 ---- formule dxDrawRectangle(1539, 914, 369, 5, tocolor(0, 0, 0, 255)) dxDrawRectangle(1539, 914, percentageEXP, 5, tocolor(255, 255, 255, 255)) dxDrawBorderedText(2, "LEVEL:", 1539, 942, 0, 0, tocolor(255,255,255,255), 1.50, "bankgothic") dxDrawBorderedText(2.5, level, 1722, 920, 0, 0, tocolor(255,255,255,255), 2.5, "bankgothic") dxDrawBorderedText(1.5, "EXP:", 1538, 860, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") dxDrawBorderedText(1.5, totalEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") if requiredEXP <= 999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") elseif requiredEXP <= 9999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") elseif requiredEXP <= 99999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") elseif requiredEXP <= 999999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") elseif requiredEXP <= 9999999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") elseif requiredEXP <= 99999999 then dxDrawBorderedText(1.5, " "..requiredEXP, 1538, 885, 0, 0, tocolor(255,255,255,255), 1, "bankgothic") end end addEventHandler("onClientRender", root, DRAW_HUD) function dxDrawBorderedText (outline, text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) for oX = (outline * -1), outline do for oY = (outline * -1), outline do dxDrawText (text, left + oX, top + oY, right + oX, bottom + oY, tocolor(122, 122, 122, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) end end dxDrawText (text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) end function addEXP(amount) currentEXP = currentEXP + amount totalEXP = totalEXP + amount if totalEXP >= requiredEXP then currentEXP = currentEXP - requiredEXP level = level + 1 requiredLevel = requiredLevel + 1 requiredEXP = getRequiredEXP(requiredLevel + 1) end end addCommandHandler("giveexp", function() addEXP(80) end)
  11. hello when I logging in this script my hud is visible but reconnect and login after never see my hud help please if i restart this resource visible only one time i check with ZR:ShowMyHud visible setFPSLimit(60) function gInit_join() setCameraMatrix(source, 0, 0, 400, 90, 360, 180, 0) toggleControl(source, "radar", false) end addEventHandler("onPlayerJoin", getRootElement(), gInit_join) function gInit_login(_, theCurrentAccount) local playerEXP = getAccountData(theCurrentAccount, "ZR:EXP") local playerLevel = getAccountData(theCurrentAccount, "ZR:Level") setElementData(source, "ZR:EXP", playerEXP) setElementData(source, "ZR:Level", playerLevel) setElementData(source, "ZR:ShowMyHud", true) fadeCamera(source, true) showCursor(source, false) end addEventHandler("onPlayerLogin", getRootElement(), gInit_login) function gInit_saveaccount() local accounts = getPlayerAccount(source) if (accounts) then local EXP = getElementData(source, "ZR:EXP") local Level = getElementData(source, "ZR:Level") setAccountData(accounts, "ZR:EXP", EXP) setAccountData(accounts, "ZR:Level", Level) setElementData(source, "ZR:ShowMyHud", false) end end addEventHandler("onPlayerQuit", getRootElement(), gInit_saveaccount) function gInit_restart() local players = getElementsByType("player") for key, player in ipairs(players) do local account = getPlayerAccount(player) if (not isGuestAccount(account)) then logOut(player) end setElementData(player, "ZR:ShowMyHud", false) end end addEventHandler("onResourceStart", getResourceRootElement(), gInit_restart) function gInit_account(username, password) if (username and password) then local hashedPassword = passwordHash(password, "bcrypt", {}) if (hashedPassword) then local account = addAccount(username, hashedPassword) if (account) then setAccountData(account, "hash_password", hashedPassword) setAccountData(account, "ZR:Level", 5) setAccountData(account, "ZR:EXP", 3533) outputChatBox("REGISTER: Account successfuly created!", source, 0, 128, 0) else outputChatBox("REGISTER: Account already exists.", source, 255, 71, 61) end end end gInit_loginplayer(username, password) end addEvent("AcceptPlayer", true) addEventHandler("AcceptPlayer", root, gInit_account) function gInit_loginplayer(username, password) if (username and password) then local account = getAccount(username) if (account) then local hashedPassword = getAccountData(account, "hash_password") if (passwordVerify(password, hashedPassword)) then if logIn(source, account, hashedPassword) then triggerClientEvent(source, "removePanel", source) setElementData(source, "ZR:ShowMyHud", true) end else outputChatBox("REGISTER: Username or Password is incorrect.", source, 255, 71, 61) end end else outputChatBox("REGISTER: Account doesn't exists.", 255, 71, 61) end end addEvent("loginPlayer", true) addEventHandler("loginPlayer", root, gInit_loginplayer) function gInit_logoutplayer(_, theCurrentAccount) local exp = getElementData(source, "ZR:EXP") local level = getElementData(source, "ZR:Level") setAccountData(theCurrentAccount, "ZR:EXP", exp) setAccountData(theCurrentAccount, "ZR:Level", level) end addEventHandler("onPlayerLogout", root, gInit_logoutplayer)
  12. actually i scripting a kind zone game and i need make clean map and i need disable scale because distrupt text on the map
  13. yes i need to disable info text and scaling