Forum

> > CS2D > Scripts > Sethealth doesn't seem to work after spawnplayer!
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Sethealth doesn't seem to work after spawnplayer!

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Sethealth doesn't seem to work after spawnplayer!

aleksix
User Off Offline

Zitieren
Well, I'm trying to make a fake death script.
So you will become invincible and can kill your killer(1 hit knife).
1
2
3
4
5
6
7
8
9
10
11
if (canfake[id]==true) then
	if (killer>=1) then
		parse("customkill "..killer.." \""..weaponname[w].."\" "..victim)
	end
	timer(1,"parse","spawnplayer "..victim.." "..player(victim,"x").." "..player(victim,"y")	
	parse("sethealth "..victim.." 10")
	parse("setweapon "..victim.." 50")
	parse("setarmor "..victim.." 206")
	isfake[id]=true
	canfake[id]=false
end

Everything works fine,but "sethealth" doesn't work!

alt Re: Sethealth doesn't seem to work after spawnplayer!

TimeQuesT
User Off Offline

Zitieren
the command timer, executes the given function as thread. Depending on your cpu speed the next few commands can be skipped (Actually it gets executed, but it's not going to apply on a dead player) . In your case, 'sethealth'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function xyz(...)
    if (canfake[id]==true) then
     if (killer>=1) then
          parse("customkill "..killer.." \""..weaponname[w].."\" "..victim)
     end
    timer(1,"vGhostRevive", victim, 1);
      end
end



function vGhostRevive(id)
     victim = tonumber(id);
     parse("sethealth "..victim.." 10")
     parse("setweapon "..victim.." 50")
     parse("setarmor "..victim.." 206")
     isfake[id]=true
     canfake[id]=false
end

alt Re: Sethealth doesn't seem to work after spawnplayer!

DC
Admin Off Offline

Zitieren
Yeah the timer function will execute your stuff with a delay. Even with a delay of just 1. It will - under no circumstances - be executed before the other stuff which is in the same code passage (like sethealth, setweapon and setarmor in your case) because all this stuff doesn't use timers and is therefore executed instantly!

So you are actually using sethealth BEFORE respawning the player. This is pointless. Obviously.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht