Updating a custom HUD's text somehow.

Started by D4rkR420R, Aug 18, 2018, 10:32 PM

Previous topic - Next topic

D4rkR420R



You see, I want to update the ammo of the player's weapon but how could I update it from server to client-side? I tried using a loop with the condition stating if the player's action is ID 16, however, it looped forever. I've a table setup in the client side where I can store the ammo in a variable, so therefore, I can use Script::ScriptProcess to update the text from the image above.

Xmair

Sending a stream every time a player shoots is very bad. You could play around with the PlayerShoot event (client-side). Decrease one bullet each time that event is called.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

vitogta

However clientside shoot event won't work with shotguns.

D4rkR420R

Quote from: vitogta on Aug 19, 2018, 08:14 AMHowever clientside shoot event won't work with shotguns.

Yeah, I guess that looses my hope, perhaps I should think about a operation with shotguns. I'd like to know why shotguns are not calling that callback. @Stormeus

vitogta

#4
It's better to wait when all those methods of player's instance will became clientside than sending tons of data between server and client just for gui.

don't forget about lag of client->server->client will be bad with fast switch (one of basic vc-mp game mechanics).

D4rkR420R

Quote from: vitogta on Aug 19, 2018, 04:10 PMIt's better to wait when all those methods of player's instance will became clientside than sending tons of data between server and client just for gui.

don't forget about lag of client->server->client will be bad with fast switch (one of basic vc-mp game mechanics).

Well, my only option I can do is make a workaround with Player::PlayerShoot function.

vitogta

Quote from: KuRuMi^ on Aug 19, 2018, 06:20 PMWell, my only option I can do is make a workaround with Player::PlayerShoot function.
Good luck.
Getting current player's weapon.
Without data from server with a lag.
Getting ammo in magazine.
Without data from server with a lag.
Getting shoot event for shotguns.
Without data from server with a lag.

D4rkR420R

Marked solved. Hoping for the new update to add more CPlayer members.