Hello. I am trying to make a LUA version of auto accept vest if the vest is equal to 35 or less than. I have my code here but I cannot make it work and I am stuck on it. I'd appreciate some help, I am new to coding LUA so I am kind of limited on the knowledge too .
What I am trying to do with this is that if you do /av it enabled/disables the mod. Only accept vest if it is $200 and if you have 35 armor or less than 35 armor.
bump
bump
What I am trying to do with this is that if you do /av it enabled/disables the mod. Only accept vest if it is $200 and if you have 35 armor or less than 35 armor.
auto accept vest (lua):
require "lib.sampfuncs"
function main()
sampAddChatMessage("{FFFFFF}AutoAccept - {0085ff}[Credit: Y2K]", -1)
local isModActive = true -- Script is active by default
while true do
wait(0)
if isModActive then
for i = 98, 99 do
local text, prefix, color, prefixColor = sampGetChatString(i)
if text:find("wants to protect you for $200, type /accept bodyguard to accept.") then -- If the message is found
sampSendChat("/accept bodyguard")
wait(1000) -- Waits for a second
end
end
end
end
end
function toggleMod() -- Function to toggle mod on/off
isModActive = not isModActive -- Toggles the boolean value of isModActive
if isModActive then
sampAddChatMessage("~y~Auto AcceptVest: ~g~on", -1) -- Displays message when mod is activated
else
sampAddChatMessage("~y~Auto AcceptVest: ~r~off", -1) -- Displays message when mod is deactivated
end
end
sampRegisterChatCommand("av", toggleMod) -- Registers "/av" command to toggle mod on/off
bump
bump
Последнее редактирование: