-[IFwsI]-
You need an account to view all sections/topics

Join the forum, it's quick and easy

-[IFwsI]-
You need an account to view all sections/topics
-[IFwsI]-
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Help with a script?

5 posters

Page 1 of 2 1, 2  Next

Go down

Help with a script? Empty Help with a script?

Post by Se7en Mon Oct 05, 2015 10:11 am

Hi, I'm a newbie in lua and if you came here you aren't.
Code:
         elseif cmd == "!spawn" then
            if rp_Adminlevel[id] >= 3 then
               local iid = tonumber(p[2])
               if iid ~= nil then
                  parse("spawnplayer "..iid)
                  parse("setpos "..iid.." "..player(id,"x").." "..player(id,"y"))
                  msg2(id,"\169255255000[Server]: \169000255000You have spawned "..player(iid,"name")..".")
               else
                  gmsg2(id,"255255000","[Server]: \169255000000This player does not exist.")
               end
            else
               gmsg2(id,"255255000","[Server]: \169255000000You don't have permission.")   
            end

This should spawn a player, (30% made by me lol) but when I type a wrong ID it will send this on console:
ERROR: spawnplayer - player #3 does not exist!
LUA ERROR: sys/lua/IF/sys/functions.lua:576: attempt to concatenate a boolean value
 -> sys/lua/IF/sys/functions.lua:576: in function 'ParseCommand'
 -> sys/lua/IF/sys/hooks.lua:192: in function
 -> in Lua hook 'say', params: 1, '!spawn 3'


Edit: no im not making a new jail!! xdddd
Edit2: pls dont be med at meh
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Mon Oct 05, 2015 10:40 am

Copy/paste the functions.lua at pastie or some online code hosting and post it here.
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Mon Oct 05, 2015 10:55 am

i sent in pm because script is private o.o
pls


Nevermind TheBoss 
fixed it for me Very Happy


Code:
         elseif cmd =="!transfer" then
               local pl = tonumber(p[2])
               local mny = tonumber(p[3])
               if pl ~= nil and mny ~= nil then
                  if player(pl,"exists") then
                  if rp_money[id] >= mny then
                     rp_money[id]=rp_money[id]-mny
                     rp_money[pl]=rp_money[pl]+mny
                     gmsg2(pl,"255255000","[Server]: \169000255000"..player(id,"name").." gave you "..mny.."$")
                     gmsg2(id,"255255000","[Server]: \169000255000You gave "..mny.."$ to "..player(pl,"name"))
                     updatehud(pl)
                     updatehud(id)
                  end
            else
               gmsg2(id,"255255000","[Server]: \169255000000You don't have permission.")
            end

Also this code, it meant to be used to send money but I only want positive numbers (you can steal money by doing !transfer -99999)...
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Mon Oct 05, 2015 4:07 pm

Code:
 elseif cmd =="!transfer" then
 local pl = tonumber(p[2])
 local mny = tonumber(p[3])
 if pl ~= nil and mny ~= nil and mny > 0 then
 if player(pl,"exists") then
 if rp_money[id] >= mny then
 rp_money[id]=rp_money[id]-mny
 rp_money[pl]=rp_money[pl]+mny
 gmsg2(pl,"255255000","[Server]: \169000255000"..player(id,"name").." gave you "..mny.."$")
 gmsg2(id,"255255000","[Server]: \169000255000You gave "..mny.."$ to "..player(pl,"name"))
 updatehud(pl)
 updatehud(id)
 end
 else
 gmsg2(id,"255255000","[Server]: \169255000000You don't have permission.")
 end
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Mon Oct 05, 2015 4:39 pm

Nighthawk wrote:
Code:
 elseif cmd =="!transfer" then
 local pl = tonumber(p[2])
 local mny = tonumber(p[3])
 if pl ~= nil and mny ~= nil and mny > 0 then
 if player(pl,"exists") then
 if rp_money[id] >= mny then
 rp_money[id]=rp_money[id]-mny
 rp_money[pl]=rp_money[pl]+mny
 gmsg2(pl,"255255000","[Server]: \169000255000"..player(id,"name").." gave you "..mny.."$")
 gmsg2(id,"255255000","[Server]: \169000255000You gave "..mny.."$ to "..player(pl,"name"))
 updatehud(pl)
 updatehud(id)
 end
 else
 gmsg2(id,"255255000","[Server]: \169255000000You don't have permission.")
 end
Yay it worked Very Happy
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Mon Oct 05, 2015 4:40 pm

If you require further assistance, don't make new threads. Do yer posts here. o.O
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Mon Oct 05, 2015 4:56 pm

Yay ok mr. nuggethwak
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Mon Oct 05, 2015 5:03 pm

can be useful (for me since i have lots of broken scripts lol)
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Soushiant.iR Mon Oct 05, 2015 6:45 pm

Stick to the topic, thanks.
Soushiant.iR
Soushiant.iR
Moderator
Moderator

Gender : Male Posts : 1266
Points : 1419
Join date : 2011-12-21
Age : 26
Location : Earthend

http://project-extract.site50.net/Download/gui.html

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Mon Oct 05, 2015 6:56 pm

Elisabeth. wrote:..Someone with Script Experiencie (Better call it S.E) ..
#copyright ;0

Anyways, you people can post your scripts here and any good willed or bored individual may seek to help you out.
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Tue Oct 06, 2015 2:51 pm

Code:
function tptojail(id)
math.random(1,3)
if math.random == 1 then
msg("1")
   parse("setpos "..id.." 500 500")
end
if math.random == 2 then
msg("2")
end
if math.random == 3 then
msg("3")
end
end

This thing should calculate from 1 to 3, if 1 is selected it will say 1 if 2 is selected it will say 2 and if 3 is selected it will say 3.

Any help will be greeted Very Happy
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by TheBoss Tue Oct 06, 2015 2:53 pm

Please be more clear .. I didn't understand ..
TheBoss
TheBoss
Site user
Site user

Gender : Male Posts : 278
Points : 601
Join date : 2011-11-02
Age : 74

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Tue Oct 06, 2015 3:08 pm

The script is this:
If you are a police you get Elite on spawn, if you shoot someone with the Elite and he has rp_killer=true it will teleport him to a random cell (3 cells total)

The script above is calculating a number from 1 to 3 (random) and if 1 comes out it will teleport to cell 1 (so on for cell 2 and 3)

The message is just debug to know if it works. (that's how I do most of my scripts)
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by alaa Tue Oct 06, 2015 4:28 pm

Se7en wrote:The script is this:
If you are a police you get Elite on spawn, if you shoot someone with the Elite and he has rp_killer=true it will teleport him to a random cell (3 cells total)

The script above is calculating a number from 1 to 3 (random) and if 1 comes out it will teleport to cell 1 (so on for cell 2 and 3)

The message is just debug to know if it works. (that's how I do most of my scripts)

do u mean same BFOP Roleplay server ? the jail mode if he killed some1 and a police shoted him he will get moved to jail (a cell for 1 min)?
alaa
alaa
Site user
Site user

Gender : Male Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Tue Oct 06, 2015 4:54 pm

Yeah that's similar but I want it to select a random cell instead.
I already have the actual script I just need it to select a random cell.
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Wed Oct 07, 2015 6:39 am


Okay, look. math.random is a function. You need to assign a value to a variable and pass it on. For example, I'll assign the variable 'tp_random' a function 'math.random(1,3)'. 'math.random(1,3)' will return any number between 1-3 to the variable 'tp_random' now. So it's going to be like this:

Code:

function tptojail(id)
tp_random = math.random(1,3)
if tp_random == 1 then
msg("1")
 parse("setpos "..id.." 500 500")
end
if tp_random == 2 then
msg("2")
end
if tp_random == 3 then
msg("3")
end
end
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by alaa Wed Oct 07, 2015 12:54 pm

please help me with this lua im getting bored fixing it.. and can any1 help me in making those?
1- MVP Script
2- !lockteams and !unlockteams
3- !makect and !maket and !makespec
4- !bc
5-!map
6-!knife
7-!restart
8- !info

0.0:
and i will be really thanked to you if u helped me cuz im newbie in lua Very Happy
alaa
alaa
Site user
Site user

Gender : Male Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Wed Oct 07, 2015 4:46 pm

Nighthawk wrote:
Okay, look. math.random is a function. You need to assign a value to a variable and pass it on. For example, I'll assign the variable 'tp_random' a function 'math.random(1,3)'. 'math.random(1,3)' will return any number between 1-3 to the variable 'tp_random' now. So it's going to be like this:

Code:

function tptojail(id)
tp_random = math.random(1,3)
if tp_random == 1 then
msg("1")
 parse("setpos "..id.." 500 500")
end
if tp_random == 2 then
msg("2")
end
if tp_random == 3 then
msg("3")
end
end
Thanks nuggethawk it worked =D

I have another minor problem,

Code:
addhook("spawn","jobspawn")
addhook("join","job_join")
addhook("leave","job_leave")
rp_killer = Array(32,false)

function jobspawn(id)
   tpjob(id)
   rp_killer[id]=false
end

function job_leave(id)
   rp_killer[id]=false
   rp_police[id]=false
   rp_doctor[id]=false
   rp_criminal[id]=false
end

function jobjoin(id)
   rp_killer[id]=false
   end

function tptojail(id)
tp_random = math.random(1,3)
if rp_killer[id]==true then
if tp_random == 1 then
--msg("1")
 parse("setpos "..id.." 179 2188")
jailtime(id)
end
if tp_random == 2 then
--msg("2")
 parse("setpos "..id.." 339 2188")
jailtime(id)
end
if tp_random == 3 then
--msg("3")
 parse("setpos "..id.." 499 2188")
jailtime(id)
end
end
end

function jailtime(id)
timer("6000","jailover")
end

function jailover(id)
msg("debug - jailover")
   rp_killer[id]=false
end

when the time run out the rp_killer[id]=false wont be activated so he will never be free...
the message and everything else works fine though
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Wed Oct 07, 2015 7:55 pm

@Se7en, replace this your timer function with this:
Code:

function jailover()
local playerslist = player(0, "table")
msg("debug - jailover")
for _,id in ipairs(playerslist) do
 rp_killer[id]=false
end
end


alaa wrote:please help me with this lua im getting bored fixing it.. and can any1 help me in making those?
1- MVP Script
2- !lockteams and !unlockteams
3- !makect and !maket and !makespec
4- !bc
5-!map
6-!knife
7-!restart
8- !info

0.0:
and i will be really thanked to you if u helped me cuz im newbie in lua :D
lelu, plis.


Last edited by Nighthawk on Wed Oct 07, 2015 7:57 pm; edited 2 times in total
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by alaa Wed Oct 07, 2015 8:54 pm

Nighthawk wrote:@Se7en, replace this your timer function with this:
Code:

function jailover()
local playerslist = player(0, "table")
msg("debug - jailover")
for _,id in ipairs(playerslist) do
 rp_killer[id]=false
end
end


alaa wrote:please help me with this lua im getting bored fixing it.. and can any1 help me in making those?
1- MVP Script
2- !lockteams and !unlockteams
3- !makect and !maket and !makespec
4- !bc
5-!map
6-!knife
7-!restart
8- !info

0.0:
and i will be really thanked to you if u helped me cuz im newbie in lua Very Happy
lelu, plis.

im newbie in lua Sad
pl0x hlp me
alaa
alaa
Site user
Site user

Gender : Male Posts : 1072
Points : 1209
Join date : 2015-01-24
Age : 23
Location : ramallah

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Wed Oct 07, 2015 9:26 pm

help me too =D
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by TheBoss Wed Oct 07, 2015 9:59 pm

Lelu, I'd say use another script .. There are many admin scripts which are much functional than yours. Yours can be barely understood. You didn't use the 'tab' button so it's hard to read. You're literally asking us to create a new script for you.
TheBoss
TheBoss
Site user
Site user

Gender : Male Posts : 278
Points : 601
Join date : 2011-11-02
Age : 74

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Thu Oct 08, 2015 10:50 pm

Okay so I couldn't solve the problem, (unrealsoftware couldnt either http://unrealsoftware.de/forum_posts.php?post=395261&l#jl )
So I got a idea, whenever you are no longer in the cell your rp_killer will become false! Pls help idk how
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Se7en Mon Oct 12, 2015 6:04 pm

Code:
clanmate = {1,2,3,4,5}

function clansArray(m)
   local array = {}
   for i = 1, m do
      array[i]=0
   end
   return array
end

stillwaiting = clansArray(32)

clanname = "vC"
numbers = 2
advers = 0

addhook("second","clans_removeb") function clans_removeb()
   for id = 1,32 do
      if (player(id,"exists")) then
         stillwaiting[id]=stillwaiting[id]+1
      end
   end
end

addhook("join","clans_fakingsw") function clans_fakingsw(id)
   stillwaiting[id]=0
end

addhook("leave","clans_fakinglsw") function clans_fakinglsw(id)
   stillwaiting[id]=0
end

addhook("minute","clans_minad") function clans_minad()
   if advers==1 then
      msg("©000255000This server uses anti faking script")
   end
end

addhook("ms100","clans_fakingms")
function clans_fakingms()
   for id = 1,32 do
      if (player(id,"exists")) then
         if player(id,"usgn") ~= clanmate then
            if stillwaiting[id]<3 then
            else
               msg(player(id,"name").." faked the clan tag.")
               parse("kick "..id.." ")
            end
         end
      end
   end
end

Hello, this is anti faking (tag in name) script, it doesn't work.. it will kick everyone :c (only if having tag)
Se7en
Se7en
Site user
Site user

Gender : Male Posts : 1163
Points : 1342
Join date : 2013-12-07
Age : 23
Location : Israel

http://slowpoke101.forum.st/

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Nighthawk Tue Oct 13, 2015 1:32 am

You've got unnecessary stuff in there which will hog resources.

Code:

members = {116310,1} -- add your usgn here
tag = "vC"

addhook("join", "antifaker_join")
function antifaker_join(id)
   local is_member = false
   if string.match(player(id, "name"), "^"..tag.."%s") or string.match(player(id, "name"), "%s"..tag.."$") then
      for k,v in ipairs(members)
         if tonumber(player(id, "usgn")) == v then
            is_member = true
            break
         end
      end
   end
   if is_member ~= true then parse('kick '..id..' no fake k ty') end
end

Oh and, I haven't tested the script.
Nighthawk
Nighthawk
-[IFwsI]- Co-Leader
-[IFwsI]- Co-Leader

Gender : Male Posts : 2426
Points : 2902
Join date : 2014-01-02
Age : 25
Location : Outside The Gates Of Your Mind

http://bit.ly/irfandahir

Back to top Go down

Help with a script? Empty Re: Help with a script?

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum