English Free for all script request

10 replies
Goto Page
To the start Previous 1 Next To the start
02.01.17 11:32:47 pm
Up
Kevindurant
User
Offline Off
Hi I was wondering if u guys can make a script for me.

If i say !ffa

it makes the rcon go
sv_gamemode 1 / mp_radar 0 / mp_respawndelay 5

and then when i say !ffa . a 2nd time
it'll make all the settings go back to normal like it'll be standard gamemode with radar back to being enabled and no respawn delay

----------------------------------------
Also to accompany this script (A SEPERATE ONE) I want it so that if you were to take damage and after 2 seconds of not taking damage you heal an "x" amount of hp per second

so basically if u do
!heal5 >> you will heal 5 seconds per second if you weren't damaged in the past 2 seconds

Also i want to be able to change the amount of health u heal per second from like !heal0 (disabled) ranging to !heal100 (heal 100 health per second)

so the command

!heal(x)

(x) being any number from 1-100 healing per second and "0" disabling the script

--------
Thank you for anyone able to complete this request for me, and if u are confused as to what I'm asking reply to this topic or pm me.

-KEVINDURANT THE BEST NBA PLAYER
03.01.17 12:55:44 am
Up
NotActiveAcc
User
Offline Off
Here is the code:
Spoiler >


I know you're using a server hosted by another person, and you havent the vps for config the admin file, so, just implement / approach this in the main code and test it, i already tested it with TopNoch's Admin, Idk what's admin script are you usign so... this is all i can do...
03.01.17 03:05:58 am
Up
Kevindurant
User
Offline Off
idk what u said but i want the thing hand fed to me so i give it to the hoster and he has no problems with it and uploads the script in 5 minutes plus are u able to do the 2nd script i requested?
03.01.17 03:22:57 am
Up
NotActiveAcc
User
Offline Off
@user Kevindurant: So... it works fine?, btw, the second script its a bit hard for me, because my knowledges in these scripts is low, maybe other scripter can help you with that script
03.01.17 03:36:33 am
Up
Rainoth
Moderator
Online On
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function string.split(str,pat) -- Splitting strings (sentences) into separate words
    local t = {}
    for word in string.gmatch(str,pat or "[^%s]+") do
        t[#t+1] = word
    end
    return t
end

heal = {}

addhook("join","_sp")
function _sp(id)
     heal[id] = {}
     heal[id].timer = 2
     heal[id].regen = 0
end

addhook("say","_s")
function _s(id,txt)
     local arg = txt:split()
     if arg[1] == "!heal" then
          for _, id in pairs (player(0,"table")) do
               heal[id].regen = tonumber(arg[2])
          end
          return 1
     end
end

addhook("second","_sec")
function _sec()
     for _,id in pairs (player(0,"tableliving")) do
          if heal[id] then
               if heal[id].timer == 0 then
                    parse("sethealth "..id.." "..player(id,"health")+heal[id].regen)
               elseif heal[id].timer > 0 then
                    heal[id].timer = heal[id].timer - 1
               end
          end
     end
end

addhook("hit","_h")
function _h(id, s)
     if heal[id] then
          heal[id].timer = 2
     end
end
edited 2×, last 04.01.17 01:54:58 am
03.01.17 04:06:53 am
Up
Kevindurant
User
Offline Off
ty for ur help guys

EDIT: its not working idk what im doing, but im using this Hajt's Admin script

http://www.unrealsoftware.de/files_show.php?file=17245

If the code is different format or w.e , idk help me implement the code into this script pls idk how helpp
edited 2×, last 03.01.17 06:17:11 am
03.01.17 03:19:48 pm
Up
Fraizeraust
Moderator
Offline Off
@user Kevindurant: I ran the script just to check it out and this is what I've got:
Code:
[14:20:37] Fraizeraust: !heal 5
[14:20:37] LUA ERROR: sys/lua/test.lua:25: attempt to index field '?' (a nil value)
[14:20:37] -> sys/lua/test.lua:25: in function <sys/lua/test.lua:22>

That means you're trying to access the table key which it doesn't exist or has no value what-so-ever. From 22 to 32 line replace the part of the code with this one. It should work now.
Code:
1
2
3
4
5
6
7
8
9
10
11
function _sec()
     for k,v in pairs (player(0,"tableliving")) do
          if heal[v] then
               if heal[v].timer == 0 then
                    parse("sethealth "..v.." "..player(v,"health")+heal[v].regen)
               elseif heal[v].timer > 0 then
                    heal[v].timer = heal[v].timer - 1
               end
          end
     end
end

In any case if a script doesn't work or stops working, you must check the Console for Lua errors marked in red. These outputs are necessary for troubleshoot.
03.01.17 04:29:22 pm
Up
Rainoth
Moderator
Online On
@user Kevindurant: Whoops, I did a very dumb mistake and used 'id' when in reality I should have used 'v' (cause my loop was 'k, v' not '_, id' like I usually write). I fixed the code so it should throw no errors there now.
03.01.17 10:52:09 pm
Up
NotActiveAcc
User
Offline Off
@Kevindurant: Its cos that the script not works, i already test it, and the cmds of Admins Script make interference with the !heal cmd, just tell to hoster approach into the main code
04.01.17 07:40:40 am
Up
Kevindurant
User
Offline Off
Panyko I tried the script alone in the Lua but it wouldn't work, as you said it depends on topnoch's admin script do you or someone else pls mind turning it into a standalone script one that I can use just on its own by itself. Thank you very much if u or someone can do this for me
04.01.17 04:35:48 pm
Up
Rainoth
Moderator
Online On
@user Kevindurant: Take my code and after line 25, add
Code:
1
2
3
4
5
6
elseif arg[1] == "!ffa" then
     if game("sv_gm")==1 then
          -- parse your settings to bring back everything to normal
     else
          -- parse your settings to set everything up for deathmatch
     end
To the start Previous 1 Next To the start