Forum

> > CS2D > Scripts > error with collect hook
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch error with collect hook

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt error with collect hook

En-Kay
User Off Offline

Zitieren
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.
1× editiert, zuletzt 16.07.12 17:55:29

alt Re: error with collect hook

RedizGaming
GAME BANNED Off Offline

Zitieren
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

alt Re: error with collect hook

Suprise
BANNED Off Offline

Zitieren
user RedizGaming hat geschrieben
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)?

alt Re: error with collect hook

En-Kay
User Off Offline

Zitieren
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.

alt Re: error with collect hook

EP
User Off Offline

Zitieren
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.
1× editiert, zuletzt 16.07.12 21:23:19

alt Re: error with collect hook

En-Kay
User Off Offline

Zitieren
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!

alt Re: error with collect hook

Avo
User Off Offline

Zitieren
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)"
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht