Forum

> > CS2D > Scripts > error with collect hook
Forums overviewCS2D overview Scripts overviewLog in to reply

English error with collect hook

9 replies
To the start Previous 1 Next To the start

old error with collect hook

En-Kay
User Off Offline

Quote
Hello.I made a simple script when i collect primary ammo i get secondary also,but it seems it doesn't work.Can somebody help me please?


P.S.

Now i can play game normally,but when i collect primary ammo i don't get secondary.Please help.
edited 1×, last 16.07.12 05:55:29 pm

old Re: error with collect hook

RedizGaming
GAME BANNED Off Offline

Quote
addhook("collect","a")
function a(id,iid,type,ain,a,mode)
if type == 61 then -- Primary Ammo
parse('equip '..id..' 61')
     if type == 62 then -- Secondary Ammo
parse('equip '..id..' 62')
end
end

old Re: error with collect hook

Suprise
BANNED Off Offline

Quote
user RedizGaming has written
addhook("collect","a")
function a(id,iid,type,ain,a,mode)
if type == 61 then -- Primary Ammo
parse('equip '..id..' 61')
     if type == 62 then -- Secondary Ammo
parse('equip '..id..' 62')
end
end


I'm not 'Big' scripter but what the hell is this==> (id,iid,type,ain,a,mode)
Isn't ==> (id)?

old Re: error with collect hook

En-Kay
User Off Offline

Quote
But i made this

addhook ("collect","a")
function a(id,iid,type,ain,a,mode)

     if(iid==61) then
     parse ("equip "..id.." 62")
     end
end


with this i would get both secondary and primary hen i collect primary,but when i collect it i only get primary.

old Re: error with collect hook

EP
User Off Offline

Quote
1
2
3
4
5
6
addhook("walkover","lol")
function lol(id,iid,type)
	if type == 61 then
		parse("equip "..id.." 62")
	end
end
The type is different than the iid, the type is the itemtype, and the iid is the ID of the item on the map.
Also, the difference between the "walkover" and "collect" hook is that the walkover is called when a player walks over an item (Not collected yet) and collect is called after the item was collected.
edited 1×, last 16.07.12 09:23:19 pm

old Re: error with collect hook

En-Kay
User Off Offline

Quote
All of you guys thanks for the help i fixed it finally

Now i only need to make bots choose other classes on class script.I hate when they all play with scout classes!

old Re: error with collect hook

Avo
User Off Offline

Quote
Remember kids about code tags.
1
2
3
4
5
6
addhook ("collect","OnCollect")
function OnCollect(id,iid,type,ain,a,mode)
     if (type==61) then
     	parse ("equip "..id.." 62")
     end
end
You're genius to name function argument as function's name.
a=a - never forget about that. And also add space between "if" and "(iid==61)"
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview