Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2277 278 279338 339 Next To the start

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
addhook("minute","minsute")
function minsute(id)
if level[id] >= 7 then
ms.money[id]=ms.money[id]+5
ms.moneyshow(id)
end
end     

error = attemp to compare number with nil

pls help me

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@HaRe like this:
Player has 5% chance to "poison" victim (hit).
If player is poisoned, he has -2hp after second, if he has lose 12hp (6sec's.) there is nothing (he hasnt -2hp after second.)

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
addhook("join","asd")
function asd(id)


parse("msg Hello and Welcome at my Server")
parse("equip "..id.." 1")
parse("equip "..id.." 2")
parse("equip "..id.." 3")
parse("equip "..id.." 4")
parse("equip "..id.." 5")
parse("equip "..id.." 6")
parse("equip "..id.." 7")
parse("equip "..id.." 8")
parse("equip "..id.." 9")
parse("equip "..id.." 10")
parse("equip "..id.." 11")
parse("equip "..id.." 12")
parse("equip "..id.." 13")
parse("equip "..id.." 14")
parse("equip "..id.." 15")
parse("equip "..id.." 16")
parse("equip "..id.." 17")
parse("equip "..id.." 18")
parse("equip "..id.." 19")
parse("equip "..id.." 20")
parse("equip "..id.." 21")
parse("equip "..id.." 22")
parse("equip "..id.." 23")
parse("equip "..id.." 24")
parse("equip "..id.." 25")
parse("equip "..id.." 26")
parse("equip "..id.." 27")
parse("equip "..id.." 28")
parse("equip "..id.." 29")
parse("equip "..id.." 30")
end


try this *-*

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@head600
1
2
3
4
5
6
7
8
9
addhook("minute","minsute")
function minsute()
	for id = 1, 32 then
		if level[id] >= 7 then
			ms.money[id]=ms.money[id]+5
			ms.moneyshow(id)
		end
	end
end
P.S: Thank you for using my modes ;P

old Re: Lua Scripts/Questions/Help

Twisted
User Off Offline

Quote
Anyone know a way to stop this script subtracting all my money?
Spoiler >

old RREEEEEEEEEEEEEEEAAADD!

hyh2
COMMUNITY BANNED Off Offline

Quote
HEEEEEEEEELP!

Hello.

Can anyone code me little code?

Here's example how it need to work:

If ADMIN USGN id isint 123456 then
loop to center "MAP IS STOLED FROM HYH2!"


Ohh, and knockback too.
Make me that too if you're not lazy.
And if this works, i'll MAYBE give carmod script, remember MAYBE.

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
admin_usgn = {66847, 24395,}

addhook("team","adminteam")
function adminteam(id,team)
     if team == 1 then --if t
          for index,USGN in ipairs(admin_usgn) do
               if player(id,"usgn") == 66847 or player(id,"usgn") == 24395 then
                    return 0
               else
                    return 1
               end
          end
     end
end

Can some one create unrealsoftware ID for me please instead of a Usgn?

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
jaso55 has written
admin_usgn = {66847, 24395,}

addhook("team","adminteam")
function adminteam(id,team)
     if team == 1 then --if t
          for index,USGN in ipairs(admin_usgn) do
               if player(id,"usgn") == 66847 or player(id,"usgn") == 24395 then
                    return 0
               else
                    return 1
               end
          end
     end
end

Can some one create unrealsoftware ID for me please instead of a Usgn?

USGN changed to US but in the script, it's still "usgn", so there's nothing to change

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
how do i desable teleport?

is there a entities to desable teleport? if not can someone give me example if player at [x][y] or [x] or [y] then desable teleport

Thanks

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
function Array(size,value)
     local array = {}
     for i = 1, size do
          array[i]=value
     end
     return array
end

ct_man = Array(32,false)
adminnokill = Array(32,false)

adminList = {0}

function isAdmin(id)
for _, usgn in ipairs(adminList) do
if player(id,'usgn')==usgn then
return true
end
end
return false
end

addhook([[join]],[[thejoin]])
function thejoin(id)
if isAdmin(id) then
msg("©000000255Admin "..player(id,"name").." enters the server!")
end
end

addhook([[team]],[[theteam]])
function theteam(id,t)
if isAdmin(id) then
if t==2 then
adminnokill[id]=true
ct_man[id]=true
elseif t==1 then
ct_man[id]=true
           end
else
if t==2 then
parse("maket "..id)
return 1
end
end
end

addhook([[hit]],[[thehit]])
function thehit(id,source,weapon,hpdmg,apdmg)
if adminnokill[id]==true then
return 1
end
end

addhook([[serveraction]],[[servaction]])
function servaction(id,acti)
if ct_man[id]==true then
if acti == 3 then
local rot = player(id,[[rot]])
if rot < -90 then rot = rot + 360 end
local angle = math.rad(math.abs( rot + 90 )) - math.pi
local x = player(id,[[x]]) + math.cos(angle) * 25
local y = player(id,[[y]]) + math.sin(angle) * 25
if x > 0 and y > 0 and x < map([[xsize]]) * 32 and y < map([[ysize]]) * 32 then
parse([[setpos ]]..id..[[ ]]..x..[[ ]]..y)
end
end
end
end

This script works now for the ct,s can some one change it for me so it works for only t,s?

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
@ jasco55

here you go

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function Array(size,value) 
     local array = {}
     for i = 1, size do
          array[i]=value
     end
     return array
end

t_man = Array(32,false)
adminnokill = Array(32,false)

adminList = {0}

function isAdmin(id)
for _, usgn in ipairs(adminList) do
if player(id,'usgn')==usgn then
return true
end
end
return false
end

addhook([[join]],[[thejoin]])
function thejoin(id)
if isAdmin(id) then
msg("©000000255Admin "..player(id,"name").." enters the server!")
end
end

addhook([[team]],[[theteam]])
function theteam(id,t)
if isAdmin(id) then
if t==2 then
adminnokill[id]=true
t_man[id]=true
elseif t==1 then
t_man[id]=true
           end
else
if t==1 then
parse("maket "..id)
return 1
end
end
end

addhook([[hit]],[[thehit]])
funtion thehit(id,source,weapon,hpdmg,apdmg)
if adminnokill[id]==true then
return 1
end
end

addhook([[serveration]],[[servation]])
funtion servation(id,ati)
if t_man[id]==true then
if ati == 3 then
local rot = player(id,[[rot]])
if rot < -90 then rot = rot + 360 end
local angle = math.rad(math.abs( rot + 90 )) - math.pi
local x = player(id,[[x]]) + math.cos(angle) * 25
local y = player(id,[[y]]) + math.sin(angle) * 25
if x > 0 and y > 0 and x < map([[xsize]]) * 32 and y < map([[ysize]]) * 32 then
parse([[setpos ]]..id..[[ ]]..x..[[ ]]..y)
end
end
end

Edit : fixing some bugs

old Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Quote
@ Unknown Killer

Just trigger the teleport using "Trigger_move"
in your Map Editor.
Else try use a hook on movetile & trigger nameoftele

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Is it there any possible to make people can't spawn instead of using mp_respawndelay? I wonder if DC made return 1 for blocking people click and spawn on spawn hook?

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
@tafijun it`s rp server there is rp command that allow player if have license to teleport and save position i want to desallow them to save position at some places i know i need the [x] and [y] position but can u give me an example how to use [x] and [y] thats all

Thanks

old Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Quote
if u already got the teleport funtion just do:

1
2
3
4
5
6
7
8
9
10
11
12
-- Add this:
license = initArray(32)

-- & this inside of your Teleport function.

if license[id] == 1 then

	-- TELEPORT-FUNCTION HERE

else
	msg2(id,"©255000000You got no license!")
end

You have to tell the script when the player gets a license.

1
2
3
... then
	license[id] = 1
end


Hope i could help you.
Or maybe you should show us your script. O.o


P.S.: I haven't tested it.

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
@tafijun here`s the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pl_have_pos = Array(32,false)
tele_x = Array(32,0)
tele_y = Array(32,0)

if men == [[Teleport Menu]] then
		if sel == 1 then
			if pl_have_pos[id]==true then
			rp_msg2(id,[[000255000]],[[Position stored succesfully!]])
			rp_msg2(id,[[000255000]],[[X: ]]..player(id,[[x]])..[[ Y: ]]..player(id,[[y]]))
			tele_x[id] = player(id,[[x]])
			tele_y[id] = player(id,[[y]])
			pl_have_pos[id]=true
        end
	end
end
     

i want to make it like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
pl_have_pos = Array(32,false)
pl_desable_pos = Array(32,false)
tele_x = Array(32,0)
tele_y = Array(32,0)

if men == [[Teleport Menu]] then
		if sel == 1 then
			if pl_have_pos[id]==true then
			tele_x[id] = player(id,[[32]])
			tele_y[id] = player(id,[[32]])
			pl_have_pos[id]=false
			rp_msg2(id,[[000255000]],[[Position not Stored]])
			return 1
		end
			rp_msg2(id,[[000255000]],[[Position stored succesfully!]])
			rp_msg2(id,[[000255000]],[[X: ]]..player(id,[[x]])..[[ Y: ]]..player(id,[[y]]))
			tele_x[id] = player(id,[[x]])
			tele_y[id] = player(id,[[y]])
			pl_have_pos[id]=true
        end
	end
end

this didnt work it still saved position

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
@jaso55: ill help you with this cuz this is my code...xD

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function Array(size,value) 
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end

t_man = Array(32,false)
adminnokill = Array(32,false)

adminList = {16138}

function isAdmin(id)
     for _, usgn in ipairs(adminList) do
          if player(id,'usgn')==usgn then
               return true
          end
     end
     return false
end

addhook([[join]],[[thejoin]])
function thejoin(id)
     if isAdmin(id) then
          msg("©000000255Admin "..player(id,"name").." enters the server!")
     end
end

addhook([[team]],[[theteam]])
function theteam(id,t)
     if isAdmin(id) then
          if t==1 then
               adminnokill[id]=true
               t_man[id]=true
          elseif t==2 then
               t_man[id]=true
	       adminnokill[id]=fasle
		  end
     else
          if t==1 then
               parse("makect "..id)
               return 1
          end
     end
end

addhook([[hit]],[[thehit]])
function thehit(id,source,weapon,hpdmg,apdmg)
     if adminnokill[id]==true then
          return 1
     end
end

addhook([[serveraction]],[[servaction]])
function servaction(id,acti)
   if t_man[id]==true then
      if acti == 3 then
         local rot = player(id,[[rot]])
         if rot < -90 then rot = rot + 360 end
         local angle = math.rad(math.abs( rot + 90 )) - math.pi
         local x = player(id,[[x]]) + math.cos(angle) * 25
         local y = player(id,[[y]]) + math.sin(angle) * 25
         if x > 0 and y > 0 and x < map([[xsize]]) * 32 and y < map([[ysize]]) * 32 then
            parse([[setpos ]]..id..[[ ]]..x..[[ ]]..y)
         end
      end
   end
end

admin can join t and is unkillable but as ct he is killable

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
Hi all... I want to have 2 images on me:
file1: gfx/RyceR/hats/nike.png
file2: gfx/RyceR/armors/white.png

Plz, give me mode like this
EDIT: Fixed
edited 1×, last 12.10.10 02:47:50 pm

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
addhook('hit','hit.weap')


-- Check if the gun is a pistol
function hit.weap(id,sid,w)
if w > 0 and w < 7 then hit.team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function hit.team(id,sid)
if player(sid,'team') == 1 then hit.teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function hit.teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

When i try this script i get error can some one fix the wrong thing in the script?
To the start Previous 1 2277 278 279338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview