Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: D4rkR420R on Aug 18, 2018, 10:32 PM

Title: Updating a custom HUD's text somehow.
Post by: D4rkR420R on Aug 18, 2018, 10:32 PM
(https://i.imgur.com/qZS0VI6.png)

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.
Title: Re: Updating a custom HUD's text somehow.
Post by: Xmair on Aug 19, 2018, 03:08 AM
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.
Title: Re: Updating a custom HUD's text somehow.
Post by: vitogta on Aug 19, 2018, 08:14 AM
However clientside shoot event won't work with shotguns.
Title: Re: Updating a custom HUD's text somehow.
Post by: D4rkR420R on Aug 19, 2018, 02:54 PM
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
Title: Re: Updating a custom HUD's text somehow.
Post by: vitogta on Aug 19, 2018, 04:10 PM
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).
Title: Re: Updating a custom HUD's text somehow.
Post by: D4rkR420R on Aug 19, 2018, 06:20 PM
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.
Title: Re: Updating a custom HUD's text somehow.
Post by: vitogta on Aug 19, 2018, 06:49 PM
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.
Title: Re: Updating a custom HUD's text somehow.
Post by: D4rkR420R on Aug 20, 2018, 02:42 AM
Marked solved. Hoping for the new update to add more CPlayer members.