Jump to content
Sign in to follow this  
1para{god-father}

Count shots in MP

Recommended Posts

I know this works but when i test on SP but if i use this in a MP with 5 players would it be OK ? or is there a better way as this looks to simple to me , Do i need any Checks or anything ? IF 5 players were all firering at the same time would it keep up with the count or bog down ?

Just need total Shoot count of Players

add to each player INI

this addEventHandler ["Fired", {_this execVM "countshots.sqf";}];

countshots.sqf

Number_shots_fired = Number_shots_fired + 1;
publicVariable "Number_shots_fired";

Share this post


Link to post
Share on other sites

When you broadcasted the PV, it may count double points. So on a dedicated, it be like 2,4,6,8 etc etc.... and not.. 1,2,3,4.... I could be wrong.host a dedicated and go try it.

Share this post


Link to post
Share on other sites

Hi,

This may not work as expected and should definitely be done in another way.

Imagine those 5 players in a MP game, where one of those is firing a heavy MG, and he fires 200 rounds in 10 seconds. This would mean 200 publicVariable calls in 10 seconds.

Probably the best would be to cache the shots locally and only publicVariable when it reaches a certain amount of shots.

Share this post


Link to post
Share on other sites

Yeah doesn't too may publicVariables in a given amount of time cause some problems?

Share this post


Link to post
Share on other sites

Happy to keep it all local until end of mission then add them up for a final total but not sure how I would do that ?

Max 6 players on a dedi server

Thanks

Share this post


Link to post
Share on other sites

OK you guys are correct , WAyyyyyyyy to slow on server !

How would I store the PV local then send to server at a certain time , even at the end of the Mission ?

Cheers guys

Share this post


Link to post
Share on other sites

if (number_shots_fired == 50) then {
publicvariable "number_shots_fired";
endmission "END1";
};

Adjust the number though.

Share this post


Link to post
Share on other sites
if (number_shots_fired == 50) then {
publicvariable "number_shots_fired";
endmission "END1";
};

Adjust the number though.

Sorry I meant how would i store the "number_shots_fired" of each player locally, then grab them all and add them up and store it in a PV on the server

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×