designer
Member
Hey there! I am trying to make a auto accept vest but my code doesn’t seem to work. Here is my code, I’d appreciate it if you guys could help me.
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