Forum

> > CS2D > General > Classes Script
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Classes Script

7 replies
To the start Previous 1 Next To the start

old Classes Script

DeathMatch Survivor
User Off Offline

Quote
I was making a new class script i'm finished doing the classes , when i tried it when i change my class i won't respawn , like other mods/script Help me please
Your reward is a cookie

old Re: Classes Script

DeathMatch Survivor
User Off Offline

Quote
OK

Code:


----------Menu Open with F2-------
addhook("serveraction","class")
function class(id,actionbutton)
if (actionbutton==1) then
getaction1(id)
end
end
if sample==nil then sample={} end
classesopt={}

function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
scriptclassmenu=initArray(32)
function scriptclassesmenu(id)
     menu(id,"Select your Class,Killer|AK+M4+Medic Armor,Pwner|AK+M4+Medic armor+Kevlar+Helm,Destroyer|RPG+Grenade Launcher+Medic Armor,Haxer|Secret")
end

----------------------------

addhook("team","classesopt")
function classesopt(id,team)
     if (team>0) then
          scriptclassesmenu(id)
     end
end

-----------------------------------------------------------------

addhook("menu","Classes")
function classesoptsel(id,menu,sel)
     if (menu=="SMD Classes") then
          if (sel>=0 and sel<=4) then
               scriptclassmenu[id]=sel
               if (player(id,"health")>0) then
                    parse('killplayer '..id)
               end
          end
     end
end
-------------Spawn only Melee------------
addhook("spawn","nowep")
function nowep(id)
return no
end
----------------------------------------------------
---------------------------
function getaction1(id)
menu(id,"SDM Classes,Pwner,Killer,Destroyer,Haxer,")
end
---------------------------
addhook("menu","menuaction")
function menuaction(id,m,b)
if m=="SDM Classes" then

------Pwner--------
if b==1 then
---Killer---
parse('equip '..id..' 32 ')
parse('equip '..id..' 82 ')
parse('equip '..id..' 30 ')
--------------------------------------
end
------Killer--------
if b==2 then
---Add Funtion's Here---
parse('equip '..id..' 34 ')
parse('equip '..id..' 30 ')
parse('equip '..id..' 59 ')
parse('equip '..id..' 82 ')
--------------------------------------
end
------destroyer--------
if b==3 then
---Add Function's Here---
parse('equip '..id..' 49 ')
parse('equip '..id..' 47 ')
parse('equip '..id..' 82 ')
--------------------------------------
end
------Haxer--------
if b==4 then
---Add Function's Here---
parse('equip '..id..' 20 ')
parse('equip '..id..' 21 ')
parse('equip '..id..' 22 ')
parse('setmaxhealth '..id..' 250 ')
parse('equip '..id..' 47 ')
parse('equip '..id..' 81 ')
parse('equip '..id..' 41 ')
parse('equip '..id..' 40 ')
parse('equip '..id..' 82 ')
--------------------------------------
end
------Selection 5--------
if b==5 then
---Add Function's Here---

--------------------------------------
-------Every Second Script-------
addhook("second","heal")
function heal(id)
----------Functions-------
parse('setmaxhealth '..id..' 5 ')
------------------------------------
end

end
end
end

old Re: Classes Script

Bowlinghead
User Off Offline

Quote
At first:
use
1
[code][ /code]

Tags!


1. The second hook has no parameter!
1
2
addhook("second","heal")
function heal(id)

2. Missing 'end'
1
2
3
------Selection 5--------
if b==5 then
---Add Function's Here---

3. Return "no" ? Do it works (I dont know)
1
2
3
4
addhook("spawn","nowep")
function nowep(id)
return no
end

I dont checkt the whole code just parts...
I think there are more misstakes!

old Re: Classes Script

Bowlinghead
User Off Offline

Quote
Use notepad++ because you can see immediatly if you forgot an end with it.
And it mark words like "if" blue... (Like ever lua editor)

old Re: Classes Script

Kel9290
User Off Offline

Quote
More >
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview