Jump to content

DrPhoX

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by DrPhoX

  1. i copied.. this is code what i have: local restriction = {} function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end addCommandHandler("likeu", function(player, cmd, players) if restriction[player] then return outputChatBox("-LaB-: #ffffffYou must wait 5 seconds to write this command again.", player, 255, 165, 0, true) end if players then local name = getPlayerName(player) local playerss = getPlayerFromNamePart(players) if playerss then outputChatBox("#FFFFFF".. name ..": #ffa500I like you #ffffff" .. getPlayerName(playerss) .. "", root, 255, 165, 0, true) end else outputChatBox("".. name .."#ffa500: I like you", player, 255, 165, 0, true) end restriction[player] = true setTimer(function () restriction[player] = false end, 5000, 1) end ) When i write /likeu ... 2x So antispam don't work.. but antispam work for /likeu PS: I looked to debugscript and it have error.. "ERROR: commands.lua:26 attempt to concatenate global 'name'
  2. I edited message: Edit: When i wrote /likeu PhoFe it said to chatbox "Player: I like you Player" but, when i wrote it again, so it wrote that I have to wait 5 seconds and now don't work .... Now it's solved, but antispam still don't work for command /likeu
  3. Yea! Thank you.. one problem solved /likeu PhoFe now working but, /likeu antispam don't work Edit: When i wrote /likeu PhoFe it said to chatbox "Player: I like you Player" but, when i wrote it again, so it wrote that I have to wait 5 seconds and now don't work
  4. Next problem When i write /likeu so antispam don't work and when i write /likeu PhoFe it write (You must wait 5 seconds.....)
  5. Ye, now we are on good way... but, when i write /likeu PhoFe ... so nothing will happen.. And it work's for other player's? i'm testing it on my localhost server PS: But antispam don't work
  6. I want when player write /likeu it write to chatbox "I like you!" When he write /likeu PhoFe It write to chatbox "I like you -LaB-#HEXHEXPhoFe" do you understand? and I also want that when I write /likeu PhoFe so it will apply to me.
  7. Thank you so much, but it work's only for "I like you PLAYER". I want too "I like you". PS: and it doesn't work for my nick
  8. I tried /likeu and /likeu .... And all of these option's don't work. Or, it work's but it say: "Could not find player with name: false" PS: In-game i have nick: "-LaB-#HEXHEXPhoFe" and when i write /likeu PhoFe it say's: "Could not find player with name: false"
  9. It work but it didn't write "I like you" or "I like you with my name". When i write /likeu it say: "Could not find player with name: false" PS: For all player's, not only for person. And example: Player: I like you Player PS2: and you removed my antispam protection can you create the script with that?
  10. Blazy, don't work --- Alpha... working! Thank you so much
  11. Hey, i created VERY simple script but don't work -.- ... I'm beginner on Lua scripting. Can someone help me please? addEventHandler ("onPlayerJoin", getRootElement(), function(decoration) local decoration = "================================================" outputChatBox(" .. decoration .. ", thePlayer, 38, 98, 188, true) outputChatBox("#ffffffWelcome to #2662bc=(RfC)= #ffffffserver", thePlayer, 38, 98, 188, true) outputChatBox("#ffffffDon't forgot to visit our webiste!", thePlayer, 38, 98, 188, true) outputChatBox("#848484www.website.eu", thePlayer, 38, 98, 188, true) outputChatBox(" .. decoration .. ", thePlayer, 38, 98, 188, true) end end)
  12. SolidSnake14 Thanks you so much SOLVED! it was folder bug... when i replace lua script, server cant update data...even after refresh
  13. I copied and dont work.... setTimer message is displayed for all players... but not only for me :// HELP! pleasee
  14. settimmer message show for all players... not for him who used the command. please help I DONT KNOW ://
  15. And "setTimer" message will show only for him? Who wrote command /fck
  16. Ye its work but... "You must wait 5 seconeds to write this command again." need, whether it will write only the players who wrote the command... and let's write the player who wrote the command. Example: (.. player .. I hate this map! (Type: /hatemap) Will you help me please?
  17. Hey again... i have problem function fck(command) addCommandHandler("fck", getRootElement()) outputChatBox("#FFFFFFFck You! #abcdef(type: /fu)", getRootElement(), fck, 255, 255, 255, true) end setTimer(fck,5000,1,true) outputChatBox("#FF0000You must wait 5 seconds to write this command again.", getRootElement, setTimer, hateMap, 255, 255, 255, true) function hateMap(command) addCommandHandler("hatemap", getRootElement()) outputChatBox("#FFFFFFI hate this map! #abcdef(type: /hatemap)", getRootElement(), hateMap, 255, 255, 255, true) end setTimer(hateMap,5000,1,true) outputChatBox("#FF0000You must wait 5 seconds to write this command again.", getRootElement, setTimer, hateMap, 255, 255, 255, true) function loveYou(command) addCommandHandler("ilu", getRootElement()) outputChatBox("#FFFFFFI love you :-* #abcdef(type: /ilu)", getRootElement(), ilu, 255, 255, 255, true) end setTimer(ilu,5000,1,true) outputChatBox("#FF0000You must wait 5 seconds to write this command again.", getRootElement, setTimer, hateMap, 255, 255, 255, true) Why dont works colors and settimer? Thx for help
  18. DrPhoX

    HELP :/

    Hey.. i can fix this script please... local ROOT = getRootElement() local ME = getLocalPlayer() local Timer = nil addEvent("ghost_off", true) addEventHandler("ghost_off", ROOT, function() exports.race:nametaglock(false) Timer = setTimer(turn_off, 200, 0) end) function turn_off() local myvehicle = getPedOccupiedVehicle(ME) local x, y, z = getElementPosition(ME) for _, vehicle in ipairs(getElementsByType("vehicle")) do local c = isElementCollidableWith(myvehicle, vehicle) local cp = getElementData(getVehicleController(vehicle), "race.checkpoint") if vehicle ~= myvehicle and c == false and cp >= 6 then local vx, vy, vz = getElementPosition(vehicle) local distance = getDistanceBetweenPoints3D(vx, vy, vz, x, y, z) - getElementRadius(vehicle) - getElementRadius(myvehicle) if (distance > 5) then setElementCollidableWith ( myvehicle, vehicle, true ) setElementAlpha ( vehicle, 255 ) setElementAlpha ( getVehicleController( vehicle ), 255 ) else setElementCollidableWith ( myvehicle, vehicle, false ) setElementAlpha ( vehicle, 160) setElementAlpha ( getVehicleController( vehicle ), 160 ) end end end end addEventHandler("onClientMapStopping", ROOT, function() killTimer(Timer) end) addEventHandler("onClientMapStarting", ROOT, function() exports.race:nametaglock(true) end) When a player passes checkpoint (cca 6 cp) so ghostmode will automatically off... but idk where is problem. please help PS: Its only for race mod.
  19. Hello, i need help with script.... give money only for 2nd, 3rd, 4th, etc. .. but not for the 1st place ... I do not know why ... I do not know where the problem is so I send you two scripts. One will be "destructionderby.lua - default" script and place for money Place money: -------------- -- Race winner -------------- addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winner) if getPlayerCount() >= 3 then local cashToWin = moneyEarnPart*getPlayerCount() if (tonumber(loadPlayerData(winner,"level")) >= 26) then cashToWin = cashToWin*1.1 end local playerCash = loadPlayerData(winner,"cash") savePlayerData(winner,"cash",playerCash +cashToWin) local playerCash = loadPlayerData(winner,"cash") outputChatBox ("#FF6600* #FFFFFF" .. getPlayerName(winner) .." #FFFFFFhas won! He/She gets $" .. tostring(cashToWin) .."#FF6600!",getRootElement(),255,255,255,true) return else outputChatBox("#FF6600* #FFFFFFNot enough players to earn money - #ABCDEF3 #FFFFFFrequired.",winner,255,255,255,true) end callClientFunction(winner,"deathReset") callClientFunction(winner,"playWinSound") local thePlayer = winner local newAmount = cashToWin totalMoneyEarnedAdd(thePlayer,cashToWin) scoreboardRefresh(thePlayer) refreshStats(thePlayer) progressBarUpdate(thePlayer) totalMoneyAchievements(thePlayer) end) and Destructionderby DestructionDerby = setmetatable({}, RaceMode) DestructionDerby.__index = DestructionDerby DestructionDerby:register('Destruction derby') function DestructionDerby:isApplicable() return not RaceMode.checkpointsExist() and Mode.getMapOption('respawn') == 'none' end function DestructionDerby:getPlayerRank(player) return #getActivePlayers() end -- Copy of old updateRank function DestructionDerby:updateRanks() for i,player in ipairs(g_Players) do if not isPlayerFinished(player) then local rank = self:getPlayerRank(player) if not rank or rank > 0 then setElementData(player, 'race rank', rank) end end end -- Make text look good at the start if not self.running then for i,player in ipairs(g_Players) do setElementData(player, 'race rank', '' ) setElementData(player, 'checkpoint', '' ) end end end function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 1 then RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end function DestructionDerby:onPlayerQuit(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 1 then RaceMode.endMap() end end end function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) end end ------------------------------------------------------------ -- activePlayerList stuff -- function isActivePlayer( player ) return table.find( g_CurrentRaceMode.activePlayerList, player ) end function addActivePlayer( player ) table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) end function removeActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) end function finishActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) end function getFinishedPlayerCount() return #g_CurrentRaceMode.finishedPlayerList end function getActivePlayerCount() return #g_CurrentRaceMode.activePlayerList end function getActivePlayers() return g_CurrentRaceMode.activePlayerList end Please help
×
×
  • Create New...