Не работает выдача денег

local allowedpromo = true


hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, args, text)
    if text == "/rangelorgrp" then
	if !allowedpromo then return end
	if ply:GetPlayTime( ) < 1 * 3600 then
        ply:ChatPrint("Вы не наиграли 1 час!")
        return ""
    end
	if !tobool( ply:GetPData( "fundamentt", false ) ) then
		ply:SetPData( "fundamentt", os.time( ) )
		ply:AddIGSFunds(500, "promocode rangelorgrp")
		ply:ChatPrint("Вы успешно получили бонус 500 руб!")
		return "" 
	else
		ply:ChatPrint("Вы уже получали бонус!")
		return ""
	end
end)

timer.Create("Ssadasdasda", 10, 0, function()
	for k, v in pairs(player.GetAll()) do
		if tobool(string.find(v:GetName(), "\n")) then
			v:Kick("Поменяй Ник!")
		end
	end
end)

Не работает выдача донат рублей ошибок нету, сообщение в чате о том что я не отыграл 1час нету
Если что установил в: /garrysmod/lua/autorun/promocode.lua

попробуй установить в lua/autorun/server

Не помогло

local allowedpromo = true

hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, args, text)
	if !allowedpromo then return end
    if text ~= "/rangelorgrp" then return end
	
	if ply:GetPlayTime( ) < 3600 then
        ply:ChatPrint("Вы не наиграли 1 час!")
        return ""
    end
	if !tobool( ply:GetPData( "fundamentt", false ) ) then
		ply:SetPData( "fundamentt", os.time( ) )
		ply:AddIGSFunds(500, "promocode rangelorgrp")
		ply:ChatPrint("Вы успешно получили бонус 500 руб!")
		return "" 
	else
		ply:ChatPrint("Вы уже получали бонус!")
		return ""
	end
end)

не работает ошибки опять же нету

странно что у тебя изначальный код ошибку не выдавал, там end нет, а значит код просто не запускается.

что делать? может перенести в /addons/main/lua/autorun/ ?

Мне кажется что в этой строке if !tobool( ply:GetPData( "fundamentt", false ) ) then опечатка. Опечатка наверное в том что нужно использовать не tobool, а isbool. То есть так: if !isbool( ply:GetPData( "fundamentt", false ) ) then
И возможно нужно было сделать такую проверку:

if text:lower() ~= "/rangelorgrp" then return end

Уже что-то пошло появилась ошибка в консоле:
[[visual] chat] lua/autorun/promocode.lua:5: attempt to index local ‘text’ (a boolean value)

А как ты команду в чат вводишь?

/rangelorgrp

Смотри в чем “ТРАБЛ”, функция хука возвращает 3-й аргумент как bool, потому что он спрашивает, это командный чат или нет? И вот ты получается сравниваешь bool с текстом.
Тебе надо вместо text вписать переменную args. Примерно так это должно быть:

hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, text, isComChat)
	if !allowedpromo then return end
		if text:lower() ~= "/rangelorgrp" then return end

	if ply:GetPlayTime( ) < 3600 then
			ply:ChatPrint("Вы не наиграли 1 час!")
			return ""
		end
	if !isbool( ply:GetPData( "fundamentt", false ) ) then
		ply:SetPData( "fundamentt", os.time( ) )
		ply:AddIGSFunds(500, "promocode rangelorgrp")
		ply:ChatPrint("Вы успешно получили бонус 500 руб!")
		return "" 
	else
		ply:ChatPrint("Вы уже получали бонус!")
		return ""
	end
end)

Попробуй этот код

[[visual] chat] lua/autorun/promocode.lua:9: attempt to call method ‘GetPlayTime’ (a nil value)

  1. f - lua/autorun/promocode.lua:9
  2. callHooks - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:153
    3. callPlayerSayHooks - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:173
    4. Run - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:244
    5. SendGlobalMessage - addons/[visual] chat/lua/easychat/networking.lua:73
    6. ReceiveGlobalMessage - addons/[visual] chat/lua/easychat/networking.lua:215
    7. func - addons/[visual] chat/lua/easychat/networking.lua:236
    8. unknown - lua/includes/extensions/net.lua:38
    … как же тежело

Что это за метод? ply:GetPlayTime() Вернее где ты его взял?

Он должен получать он отыграл 1час в игре? не выходя из игры
а взял мне челик из другого форума подсказал

Так он у тебя ничего не возвращает - nil. Это метод из IGS? Если нет то этого метода у тебя банально не существует, тебе его надо предопределить и чтобы он возвращал результат. Либо он принимает данные и возвращает результат типа такого:

if (not ply:GetPlayTime(3600)) then 

может мне вообще использовать это?:

rp.AddCommand('rangelorgrp', function(ply, args, text)
    ply:ConCommand("Refs_OpenMenu")
    return ""
end)

rp.AddCommand('rangelorgrp', function(ply, args, text)
	if !tobool(ply:GetPData( "newupdatepromo", false ) ) and !tobool(ply:GetPData( "fundament", false ) ) then
		ply:SetPData( "newupdatepromo" , os.time( ) )
		ply:AddCredits(500, 'Rangelorgrp')
		ply:ChatPrint("Вы успешно получили начальный бонус!")
	else
		ply:ChatPrint("Вы уже получали начальный бонус!")
	end
end)

Не знаю. Смотри сам, как тебе надо

ну я пытаюсь сделать команду но не работает не знаю почему хоть должно

Для теста команды ты можешь вырезать условие на время и проверить код так:

local allowedpromo = true

hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, text, isComChat)
	if !allowedpromo then return end
		if text:lower() ~= "/rangelorgrp" then return end

	--if ply:GetPlayTime( ) < 3600 then
		--ply:ChatPrint("Вы не наиграли 1 час!")
		--return ""
	--end
	if !tobool( ply:GetPData( "fundamentt", false ) ) then
		ply:SetPData( "fundamentt", os.time( ) )
		ply:AddIGSFunds(500, "promocode rangelorgrp")
		ply:ChatPrint("Вы успешно получили бонус 500 руб!")
		return "" 
	else
		ply:ChatPrint("Вы уже получали бонус!")
		return ""
	end
end)

И еще почему тут ply:GetPData( "fundamentt", false ) у тебя оно как бы возвращает false, а потом
ты задаешь ему время? ply:SetPData( "fundamentt", os.time())
Я бы немного поменял код:

local allowedpromo = true

hook.Add( "PlayerSay", "promocoderangelorgrp", function(ply, text, isComChat)
   if !allowedpromo then return end
      if text:lower() ~= "/rangelorgrp" then return end

   --if ply:GetPlayTime( ) < 3600 then
      --ply:ChatPrint("Вы не наиграли 1 час!")
   --end

   if (ply:GetPData( "fundamentt") == nil) then
      ply:SetPData( "fundamentt", os.time() )
      ply:AddIGSFunds(500, "promocode rangelorgrp")
      ply:ChatPrint("Вы успешно получили бонус 500 руб!")
   else
      ply:ChatPrint("Вы уже получали бонус!")
   end

   return ""
end)