Jump to content

Time?


Bean666

Recommended Posts

7 minutes ago, Tekken said:

You set time server side? 
 

just did it, thanks, though it's not super synced, when player reconnects, his time is either 3-6 seconds late or ahead of mine, though not a big deal.

Edited by Shaman123
Link to comment
16 minutes ago, Tekken said:

You set time server side? 
 

getRealTime() — get real time of the server;

setTime() — set in game time comparing with real time of the server!

isn't getRealTime() used for getting the current time from player computer?

Link to comment

okay okay chill out guys, it's fine, its just a few seconds away anyway, i have one last question, this is out of topic but how do i cancel this event if the user has armor?

addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
setElementHealth(source, getElementHealth(source)-20)
if weapon == 34 then
setElementHealth(source, getElementHealth(source)-100)
				end
			end
end
		end
)

I tried with getPedArmor but it didn't work, guess I used it wrong. If so please tell me

Edited by Shaman123
Link to comment
  • Moderators
9 minutes ago, Shaman123 said:

I tried with getPedArmor but it didn't work


You probably did it correctly, the only problem is that this event cannot be cancelled. Since the damage has already happened on clientside a while(few milliseconds) ago. This event represents a reflection of the past, not the moment the player got damaged.

The now moment:

onClientPlayerDamage

 

Edited by IIYAMA
  • Like 2
Link to comment
2 minutes ago, IIYAMA said:


You probably did it correctly, the only problem is that this event cannot be cancelled. Since the damage has already happened on clientside a while(few milliseconds) ago. This event represents a reflection of the past, not the moment the player got damaged.

 

Oh yes forgot server side onDamage can’t be canceled!

  • Like 2
Link to comment
15 minutes ago, IIYAMA said:

Yes, @Tekken just gave you that one a few seconds ago.

yes, i didn't see his comment before I replied, thanks y'all

15 minutes ago, IIYAMA said:

Yes, @Tekken just gave you that one a few seconds ago.

@IIYAMA

error is :

line 6: = expected near getPedArmor()

it gives an error even though I put the = , and <= 0 means if less than 0 right?

addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
If getPedArmor(source) <= 0 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
setElementHealth(source, getElementHealth(source)-20)
if weapon == 34 then
setElementHealth(source, getElementHealth(source)-100)
				end
end
end
end
)

 

12 minutes ago, Shaman123 said:

yes, i didn't see his comment before I replied, thanks y'all

@IIYAMA

error is :

line 6: = expected near getPedArmor()

it gives an error even though I put the = , and <= 0 means if less than 0 right?



addEvent "onPlayerHeadshot"

addEventHandler("onPlayerDamage", getRootElement(),
	function (attacker, weapon, bodypart, loss)
		if bodypart == 9 then
If getPedArmor(source) <= 0 then
			local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss)
			if result == true then
setElementHealth(source, getElementHealth(source)-20)
if weapon == 34 then
setElementHealth(source, getElementHealth(source)-100)
				end
end
end
end
)

 

check my edit:

@IIYAMA @Tekken

Edited by Shaman123
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...