Forum

> > CS2D > Scripts > Make pet with all player
Forums overviewCS2D overview Scripts overviewLog in to reply

English Make pet with all player

4 replies
To the start Previous 1 Next To the start

old Make pet with all player

kalis
User Off Offline

Quote
hello every one
i make a pet for player with hook imagepos ,and image(path)
and i get error
i local petx[d],pety[id]
and pet only folow a player
it not folow player bought it
it folow random player !

i create hook for pet move :
1
2
3
4
5
6
hook always
for id = 1,32 do
petx[id] = ...
pety[id] = ...
bug with for id = 1,32 --
...ect
get erorr !

old Re: Make pet with all player

Kel9290
User Off Offline

Quote
1
2
3
4
5
6
7
addhook("always","epichook")
function epichook()
for id = 1,32 do
	petx[id] = ...
	pety[id] = ...
	for id = 1,32 --
...ect

old Re: Make pet with all player

Starkkz
Moderator Off Offline

Quote
At the time when buying it, save the ID of the person who bought it in a variable. After that, the pet will use that variable as a target (To follow him). So use his id to follow him

old Re: Make pet with all player

kalis
User Off Offline

Quote
Like this :
                    
1
2
3
4
5
6
7
8
9
local his = id
					if money[id] >= 180000 and pet[his] ~= 1 then
						rp_money[id]=rp_money[id]-180000
						pet[his] = 1
						msg2(id,"You had this Pet now!")
					elseif pet[his] == 1 then 
						pet[his] = 1
						msg2(id,"You had This Pet already!")
					end

               And when always hook work @ @!
               how to local variable again

               Or local variable like u r lua?
                    local pet = { total = 0 }
               your code hard to set image for pet !
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview