17.02.2020, 03:59
Server:
/
setPlayerHealth(pid, 0);
/
= Work
Client:
/
setPlayerHealth(heroId, 0);
/
= Dont Work
Why?
/
setPlayerHealth(pid, 0);
/
= Work
Client:
/
setPlayerHealth(heroId, 0);
/
= Dont Work

Why?
how do I Kill a player on the client side?
|
17.02.2020, 03:59
Server:
/ setPlayerHealth(pid, 0); / = Work Client: / setPlayerHealth(heroId, 0); / = Dont Work ![]() Why?
17.02.2020, 13:19
Maybe u have some script bad writen code. But anyway health change at all when u use it oj client side?
19.02.2020, 19:49
Calling a setPlayerHealth function on client-side will only kill the hero or npc for a client.
This action won't be synced, because it doesn't have any sense to synchronize things that are executed on the client-side. That's why you have the server-side, calling a setPlayerHealth on server-side will cause to set a packet to every player and sync the action. Also, consider example when calling a client-side function will automatically sync this with the server, that way server will have to TRUST the data from the client, and that's bad in most cases. Why is it bad? Because it gives the client(s) abitility to fool the server by sending the value that client wants to send, that way client could manipulate the server actions (in some way). The question is what are you trying to achieve? You want to kill a player, but why do you want to make this on client-side?
24.02.2020, 11:15
(This post was last modified: 24.02.2020, 11:43 by demor140202.)
(19.02.2020, 19:49)Patrix Wrote: Calling a setPlayerHealth function on client-side will only kill the hero or npc for a client.For example: players should be punished for not using an item. But the "onUseItem" event is on the Client side. (19.02.2020, 19:49)Patrix Wrote: Calling a setPlayerHealth function on client-side will only kill the hero or npc for a client.oh! You Patrix. It was you who had the problem with "ItemsGround.spawn" ? I have it, too, appears: Half of the players on the server do not see items. demor140202 Wrote:For example: players should be punished for not using an item. But the "onUseItem" event is on the Client side. You can always create new server-side event for using an item, it's not a problem, you have to simply create a packet inside onUseItem event on client-side, and send it to server. Then, you can simply read the packet on the server-side, and make a new event by using function: addEvent. After that, just use callEvent function to call all binded functions to your new event. The important thing to understand in this whole process is that you SHOULD only interact with synchronized values (like player(s) hp, mana, etc) on server-side. Manipulating those parameters on client-side, will result in not syncing the script, or event if it will be synced, leave some vulnerabilities. Long story short, when you want manipulate players, you have to write a server-side script (which can ofc interact with client-side script(s) by packets). demor140202 Wrote:oh! You Patrix. It was you who had the problem with "ItemsGround.spawn" ? I have it, too, appears: Half of the players on the server do not see items. In issue, there is also placed the potential fix for this bug. As far as i know, setting up the virtual world for the itemGround does do the job. |
« Next Oldest | Next Newest »
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Give random item for Player | 6 | 6,348 |
14.02.2018, 18:30 Last Post: |
||
0.0.5.1 getID client | 2 | 2,860 |
29.12.2016, 02:45 Last Post: |
||
Call client functions from server | 1 | 2,713 |
25.08.2016, 15:35 Last Post: |