Jump to content

MitnickP56

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by MitnickP56

  1. Hello I tried to make script : if player ping >= 100 then show on chat: NamePlayer has big ping : (ping (101,111,478,5837) smth like this just show on chatbox. Please help with it. function detektor() for i, player in ipairs(getElementsByType("player")) do if (getPlayerPing(player) >= 100) then outputChatBox(player, "Lagging ping:"getPlayerPing) end end end setTimer(detektor, 2000, 0)
  2. Hi, I tried do autoban script: seriale = { [ 'Podszywka Mitnicka' ] = '8FA762ECCF76593B06B1482201801C52' } addEventHandler ( 'onPlayerJoin', getRootElement ( ), function ( _, theCurrentPlayers ) local Serial = seriale[getPlayerName(theCurrentPlayers)] if ( Serial ) then if Serial ~= getPlayerSerial ( source ) then banPlayer ( source, false, false, true, getRootElement ( ), 'Wypierdalaj kurwo !' ) end end end ) debugscript: http://imgur.com/mMzLeYy
  3. Hi, I have big problem. I can't add hex on the rankingboard. RankingBoard = {} RankingBoard.__index = RankingBoard RankingBoard.instances = {} local screenWidth, screenHeight = guiGetScreenSize() local topDistance = 250 local bottomDistance = 0.23*screenHeight local posLeftDistance = 30 local nameLeftDistance = 60 local labelHeight = 20 local maxPositions = math.floor((screenHeight - topDistance - bottomDistance)/labelHeight) function RankingBoard.create(id) RankingBoard.instances[id] = setmetatable({ id = id, direction = 'down', labels = {}, position = 0 }, RankingBoard) end function RankingBoard.call(id, fn, ...) RankingBoard[fn](RankingBoard.instances[id], ...) end function RankingBoard:setDirection(direction,plrcount) self.direction = direction if direction == 'up' then self.highestPos = plrcount self.position = self.highestPos + 1 end end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function RankingBoard:add(name, time) local position local y local doBoardScroll = false if self.direction == 'down' then self.position = self.position + 1 if self.position > maxPositions then return end y = topDistance + (self.position-1)*labelHeight elseif self.direction == 'up' then self.position = self.position - 1 local labelPosition = self.position if self.highestPos > maxPositions then labelPosition = labelPosition - (self.highestPos - maxPositions) if labelPosition < 1 then labelPosition = 0 doBoardScroll = true end elseif labelPosition < 1 then return end y = topDistance + (labelPosition-1)*labelHeight end local posLabel, posLabelShadow = createShadowedLabelFromSpare(posLeftDistance, y, 20, labelHeight, tostring(self.position) .. ')', 'right') if time then if not self.firsttime then self.firsttime = time time = ': ' .. msToTimeStr(time) else time = ': +' .. msToTimeStr(time - self.firsttime) end else time = '' end killerss = getPlayerName(getElementData(getPlayerFromPartialName(name),"lasthit")) or "" alivePlayers = 0 for i ,v in ipairs (getElementsByType("player")) do if getElementData(v,"state") == "alive" then alivePlayers = alivePlayers + 1 end end if alivePlayers == 1 then setElementData(getPlayerFromPartialName(name),"lasthit",nil) end local playerLabel, playerLabelShadow = createShadowedLabelFromSpare(nameLeftDistance, y, 250, labelHeight, name .. " ("..killerss..")") table.insert(self.labels, posLabel) table.insert(self.labels, posLabelShadow) table.insert(self.labels, playerLabel) table.insert(self.labels, playerLabelShadow) playSoundFrontEnd(7) if doBoardScroll then guiSetAlpha(posLabel, 0) guiSetAlpha(posLabelShadow, 0) guiSetAlpha(playerLabel, 0) guiSetAlpha(playerLabelShadow, 0) local anim = Animation.createNamed('race.boardscroll', self) anim:addPhase({ from = 0, to = 1, time = 700, fn = RankingBoard.scroll, firstLabel = posLabel }) anim:addPhase({ fn = RankingBoard.destroyLastLabel, firstLabel = posLabel }) anim:play() end end function RankingBoard:scroll(param, phase) local firstLabelIndex = table.find(self.labels, phase.firstLabel) for i=firstLabelIndex,firstLabelIndex+3 do guiSetAlpha(self.labels[i], param) end local x, y for i=0,#self.labels/4-1 do for j=1,4 do x = (j <= 2 and posLeftDistance or nameLeftDistance) y = topDistance + ((maxPositions - i - 1) + param)*labelHeight if j % 2 == 0 then x = x + 1 y = y + 1 end guiSetPosition(self.labels[i*4+j], x, y, false) end end for i=1,4 do guiSetAlpha(self.labels[i], 1 - param) end end function RankingBoard:destroyLastLabel(phase) for i=1,4 do destroyElementToSpare(self.labels[1]) table.remove(self.labels, 1) end local firstLabelIndex = table.find(self.labels, phase.firstLabel) for i=firstLabelIndex,firstLabelIndex+3 do guiSetAlpha(self.labels[i], 1) end end function RankingBoard:addMultiple(items) for i,item in ipairs(items) do self:add(item.name, item.time) end end function RankingBoard:clear() table.each(self.labels, destroyElementToSpare) self.labels = {} end function RankingBoard:destroy() self:clear() RankingBoard.instances[self.id] = nil end -- -- Label cache -- local spareElems = {} local donePrecreate = false function RankingBoard.precreateLabels(count) donePrecreate = false while #spareElems/4 < count do local label, shadow = createShadowedLabel(10, 1, 20, 10, 'a' ) destroyElementToSpare(label) destroyElementToSpare(shadow) end donePrecreate = true end function destroyElementToSpare(elem) table.insertUnique( spareElems, elem ) guiSetVisible(elem, false) end function createShadowedLabelFromSpare(x, y, width, height, text, align) if #spareElems < 2 then if not donePrecreate then outputDebug( 'OPTIMIZATION', 'createShadowedLabel' ) end return createShadowedLabel(x, y, width, height, text, align) else local shadow = table.popLast( spareElems ) guiSetSize(shadow, width, height, false) guiSetText(shadow, text) --guiLabelSetColor(shadow, 0, 0, 0) guiSetPosition(shadow, x + 1, y + 1, false) guiSetVisible(shadow, true) local label = table.popLast( spareElems ) guiSetSize(label, width, height, false) guiSetText(label, text) --guiLabelSetColor(label, 255, 255, 255) guiSetPosition(label, x, y, false) guiSetVisible(label, true) if align then guiLabelSetHorizontalAlign(shadow, align) guiLabelSetHorizontalAlign(label, align) else guiLabelSetHorizontalAlign(shadow, 'left') guiLabelSetHorizontalAlign(label, 'left') end return label, shadow end end addEventHandler("onClientVehicleCollision",root, function(hitElement) if source == getPedOccupiedVehicle(localPlayer) then if hitElement and getElementType(hitElement) == 'vehicle' then local driver = getVehicleController(source) local hDriver = getVehicleController(hitElement) if hDriver and driver then setElementData(driver,"lasthit",hDriver) if isTimer(timer) then killTimer(timer) end timer = setTimer(setElementData,5000,1,driver,"lasthit",nil) end end end end )
  4. this gay addCommandHandler("sg", function(sourcePlayer, command, value) setGameSpeed(tonumber(value)) outputChatBox('GameSpeed = '.. tonumber(value)..' by ' .. getPlayerName(sourcePlayer),root, 0, 240, 0 ) end ) Really Thanks, all working :]
  5. How edit it: 1. outputChatBox see only this gay, who using /sg All players must see in on chat. And I wanna add here GameSpeed = tnumer by ..Nick..
  6. Hi, can someone tell me what is wrong and show me how complete it ? addCommandHandler("sg", function(sourcePlayer, command, value) setGameSpeed(tonumber(value)) outputChatBox('GameSpeed = '... (tonumber(value))...' . ' , 0, 240, 0 ) end ) Server-side.
  7. Working, really thanks.
  8. Dont understand what you talking bout Player cant press enter ( died ) when map continues.
  9. Hello, I trying to make script "Off Enter" Not this in keyboard just block function (command) Enter/Exit from Esc-> settings ->binds. Construction: addCommandHandler("trickent", off-1 outputChatBox(OFF by getPlayerName) else on-2 outputChatBox(ON by getPlayerName) Command -> Blocking this from all players. I have no idea how to making it, with handbrake and freeze is easy but here rly I don't know.
  10. Script working, really thanks Master
  11. Yes I using race gamemode, but. Debug script: imgur.com/U6VmGSH I fixed this 19 lines but in 20 idk what is bad.
  12. Command working, I need function : 5 sec after loading map write /addupgrade . Idk how do it.
  13. Hi, I tried to making spoiler after loading map (5 sec ). Here is my function: -- define the handler function for our command function consoleAddUpgrade ( thePlayer, addupgrade, 1139 ) -- make sure the player is in a vehicle if ( isPedInVehicle ( thePlayer ) ) then -- convert the given ID from a string to a number local id = tonumber ( 1139 ) -- get the player's vehicle local theVehicle = getPedOccupiedVehicle ( thePlayer ) -- add the requested upgrade to the vehicle local success = addVehicleUpgrade ( theVehicle, 1139 ) -- inform the player of whether the upgrade was added successfully if ( success ) then -- outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) else -- outputConsole ( "Failed to add upgrade.", thePlayer ) end else --outputConsole ( "You must be in a vehicle!", thePlayer ) end end -- add the function as a handler for the "addupgrade" command addCommandHandler ( "addupgrade", consoleAddUpgrade ) Please help me with that.
×
×
  • Create New...