Forum

> > CS2D > Scripts > [request]need some code for my script
Forums overviewCS2D overview Scripts overviewLog in to reply

English [request]need some code for my script

19 replies
To the start Previous 1 Next To the start

old [request]need some code for my script

super123s
User Off Offline

Quote
hey every body it me noober scripter[Agent.N]
today i need some help for my main.lua
here is code of my main .lua
Spoiler >

this is my main.lua now all people look in this line:rp_say
Spoiler >

with it
ADmin level 3>>tag[admin]
admin level 2>>tag[admin]too
and admin level 1>>tag[mod]
i try to edit to
admin level 3>>admin
admin level 2>> tag Super mod
and admin level 1>> tag mod

i change this code but it not change

>change admin level/or add some code but some time[all time ]it does n't work and destroy the script
here is the link of mod i edit : http://unrealsoftware.de/files_show.php?file=4733

please help me to change tag name admin please

old Re: [request]need some code for my script

Apache uwu
User Off Offline

Quote
I'm in a helpful mood but I'm really sorry, I have no idea what you are saying.

You're trying to change the say return?

ex. An admin says hello.

Player [admin]: hello

ex. A Super mod says hello.

Player [Super mod]: hello

ex. A mod says hello.

Player [mod]: hello.

I think it's as easy as just changing this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
rp_msg("192192192",player(id,"name").."(Admin): "..txt)
               else
                    rp_msg("192192192",player(id,"name").."(Mod): "..txt)
               end               
               return 1
          end
     end
     
     if Mute_text==1 then
          rp_msg2(id,"255000000","You cant send message in mute mode, use team message")
          return 1
     end
     
     if rp_vipmsg[id]>0 then
          rp_msg("000255255",player(id,"name").."(VIP): "..txt)

to

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
rp_msg("192192192",player(id,"name").."(admin): "..txt)
               else
                    rp_msg("192192192",player(id,"name").."(Super mod): "..txt)
               end               
               return 1
          end
     end
     
     if Mute_text==1 then
          rp_msg2(id,"255000000","You cant send message in mute mode, use team message")
          return 1
     end
     
     if rp_vipmsg[id]>0 then
          rp_msg("000255255",player(id,"name").."(mod): "..txt)

If you have more problems list them, please try to list more details.

old Re: [request]need some code for my script

kalis
User Off Offline

Quote
i knew this lua
1
2
3
4
5
6
7
8
9
10
11
12
13
if rp_ct[id] == true then
		if txt~="rank" then
			if rp_Adminlevel[id] == 1 then
				rp_msg("192192192",player(id,"name").."(Mod): "..txt)
			elseif rp_Adminlevel[id] == 2 then
				rp_msg("192192192",player(id,"name").."(S-Mod): "..txt)
			elseif rp_Adminlevel[id] == 3 then
				rp_msg("192192192",player(id,"name").."(Admin): "..txt)

			end			
			return 1
		end
	end

@super you said you pro scripter
THEN dont ask any thing !

old Re: [request]need some code for my script

archmage
User Off Offline

Quote
user kalis has written
@super you said you pro scripter
THEN dont ask any thing !

Even intelligent experienced scripters/programmers need help at times. A scripter/programmer that does not ask for help is a foolish scripter/programmer.

--

I would help, but your code tl;dr and I cannot make any sense of you.

old thanks kalis and need more help

super123s
User Off Offline

Quote
now all helper look my addons.lua
Spoiler >

look this line
1
2
3
4
5
6
7
8
9
10
11
12
13
No = 8,
		FName 	= "F35-commodo",
		FPrice  = 2000000,
		r = 0, g = 0, b = 0,
		FIMGBlend=0, FIMGAlpha=0,
		FOnTop	= 200,
		FSpeed  = 80,
		health  = 100,
                wpn		= 41,
		FLic = Array(32, 0),
		FHave= Array(32, 0),
		FImage	= "gfx/Blocker Game/1.png",
                FVIPOnTop	= 200,
this is my best addons.Wpn=41 is Shield now i try to change it to Rpg /missle/grena laucher
this weapon id is 47 /48 /49
so edit this line to
1
2
3
4
5
6
7
8
9
10
11
12
13
No = 8,
		FName 	= "F35-commodo",
		FPrice  = 2000000,
		r = 0, g = 0, b = 0,
		FIMGBlend=0, FIMGAlpha=0,
		FOnTop	= 200,
		FSpeed  = 80,
		health  = 100,
                wpn		= 47,48,49,
		FLic = Array(32, 0),
		FHave= Array(32, 0),
		FImage	= "gfx/Blocker Game/1.png",
                FVIPOnTop	= 200,
but when i test it i use this addons i i just have weapon id 47 is Rpg laucher/and weapon id 48/49 i don't have

so can you help me edit it please
and i want to add ammor to addons but i don't know how please help me PLEASE /PLEASE/PLEASE

old Re: [request]need some code for my script

Lee
Moderator Off Offline

Quote
@super: do you want a random weapon from the pool 47, 48, and 49 or do you want all three of 47, 48, and 49?

If the latter is the case, then you're out of luck. The original author of the script constrained the system so that each element can only contain a single weapon. To get around this, and as far as skimming goes, this is the only cross reference that I can find, make the following replacements:

find
1
2
3
4
if Addons[sel].wpn > 0 then
	parse("equip "..id.." "..Addons[sel].wpn);
	parse("setweapon "..id.." "..Addons[sel].wpn)                         
end

and replace with

1
2
3
4
5
6
7
8
9
if type(Addons[sel].wpn)=="table" then
	for _,wpn in ipairs(Addons[sel].wpn) do
		parse("equip "..id.." "..wpn)
		parse("setweapon "..id.." "..wpn)
	end
elseif Addons[sel].wpn > 0 then
	parse("equip "..id.." "..Addons[sel].wpn)
	parse("setweapon "..id.." "..Addons[sel].wpn)  
end

and instead of

1
wpn          = 47,48,49,

which in turn sets wpn to 47 and then sets its 1st and 2nd index to 48 and 49 respectively, use

1
wpn		= {47, 48, 49}

Of course, since the rest of the script is omitted, I can't guarantee that this will work as the author implicitly assumes that .wpn is a numerical field. If you want to modify this code, at least get to know it a little better.

old Re: [request]need some code for my script

super123s
User Off Offline

Quote
not work
frist i change it to this
Spoiler >

but i when i use addon it just spawn with only weapon id 47 not 48 49
so i change it to this
Spoiler >

and>> my lua does n't work i must to reinstall mod + lua
[i have back up YAY )
>> 2 code u post not work

old Re: [request]need some code for my script

Lee
Moderator Off Offline

Quote
what's the error message?

Edit:

1
wpn = {47, 48, 49}

I don't know about you, but when every other line have a comma at the end of it, I get suspicious when I don't see one after this line...

old Re: [request]need some code for my script

super123s
User Off Offline

Quote
hey lee.

i try to change wpn>> wpn = {47, 48, 49}

but when i start server it say no lua script what you thinks about this

AND I HAVE SEE 1 ERROR / let fix it YAY YAY

1
LUA ERROR :sys/lua/addons.lua:147: '}' expected(to close '{' at line 137) near "FLic

old Re: [request]need some code for my script

Lee
Moderator Off Offline

Quote
my previous message implies that you need to change

1
wpn = {47, 48, 49}

to

1
wpn = {47, 48, 49} ,

Because wpn is a field of a table, and hence must be delimited by commas

old Re: [request]need some code for my script

super123s
User Off Offline

Quote
hi guys
when i change it to wpn = {47, 48, 49,} ,
it ok i test it with addon Wing power and it have 3 weapon id yay

BUT I CAN'T CHANGE ADDONS WHYYYYYYY?>

hey guys here is this reason:
1
LUA ERROR:sys/lua/addons.lua:169 :attempt to compare number with table
>>>> Oops it wrong

HELPPPPPPPPPPPP

but when i change
1
wpn = {47, 48, 49,} ,
to
1
wpn = 47, 48, 49, ,

now i can change add on YAY but when i use addon and spawn i just have weapon id 47 not 48,49
please help me








HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPpppp
edited 4×, last 23.07.11 01:22:26 pm

old Re: [request]need some code for my script

Lee
Moderator Off Offline

Quote
once again, when you change it to 47, 48, 49, it creates this table:

{[1] = 48, [2] = 49, wpn=47}

so don't do that, it doesn't work, and it won't work no matter how many times you try it in spite of me explaining that it wouldn't work.

This relates to

Quote
Of course, since the rest of the script is omitted, I can't guarantee that this will work as the author implicitly assumes that .wpn is a numerical field. If you want to modify this code, at least get to know it a little better.


in which I asked you to look through the rest of the script to check that .wpn isn't referenced anywhere else because if it is, you will get an error due to the fact that the original author assumed that .wpn is a number, not a table.

Here's the first bit of problem:

1
2
3
if (v.wpn > 0) and (checkwep(id,v.wpn)==1) then
                    	parse("strip "..id.." "..v.wpn)
               end

We need to take into account the possibility that wpn is a table.

1
2
3
4
5
6
7
if type(v.wpn)=="table" then
	for _,wpn in ipairs(v.wpn) do
		parse("strip "..id.." "..wpn)
	end
elseif (v.wpn > 0) and (checkwep(id,v.wpn)==1) then
	parse("strip "..id.." "..v.wpn)
end

Now the other parts of the script may also depend on addons.wpn being a number, so this problem may still persist.

old Re: [request]need some code for my script

Lee
Moderator Off Offline

Quote
Quote
Find
1
2
3
if (v.wpn > 0) and (checkwep(id,v.wpn)==1) then
                    	parse("strip "..id.." "..v.wpn)
               end

and Replace with
1
2
3
4
5
6
7
if type(v.wpn)=="table" then
	for _,wpn in ipairs(v.wpn) do
		parse("strip "..id.." "..wpn)
	end
elseif (v.wpn > 0) and (checkwep(id,v.wpn)==1) then
	parse("strip "..id.." "..v.wpn)
end

old Re: [request]need some code for my script

super123s
User Off Offline

Quote
congturation,your code it work and no problem
thanks

BUT
>hey guys more problem i change wpn in my addons
to
1
wpn = {47, 48, 49} ,
and ok spawn with 3 weapon too cool YAY
i use this code to wing power

BUT
>ADD ON:DRAGON/CAR/SUPER MAN can't drop weapon[i like it because add can drop weapon>> player have very much gun to sell ] but add on wing power [i use this add on to test your code] but add on wing power can drop weapon

REQUEST: can you edit code:
1
wpn = {xx, xx, xx} ,
to .........................

ok and i want my add on can't drop weapon
please help me
sory bad english
edited 2×, last 24.07.11 05:35:43 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview