jonrainier / DayZ-Private-Server

DayZ Private Server by Pwnoz0r
98 stars 131 forks source link

pMain #17

Closed guidez closed 11 years ago

guidez commented 11 years ago

Current code:

DECLARE iSpawnNumVeh SMALLINT(3) DEFAULT 11;        

CALL pCleanup();
CALL pFixMaxNum;

SELECT SUM(MaxNum) FROM object_classes INTO @iMaxNumTotal;
IF (iSpawnNumVeh > @iMaxNumTotal) THEN
    SET iSpawnNumVeh = @iMaxNumTotal;
END IF;

WHILE (fGetVehCount() < iSpawnNumVeh) DO
    CALL pSpawn();
END WHILE;

That's some pretty funky code man. Essentially, the code will never allow for users to have MORE then 11 vehicles, and only have less then that. Should instead be:


DECLARE iSpawnNumVeh SMALLINT(3) DEFAULT 0;     

CALL pCleanup();
CALL pFixMaxNum;

SELECT SUM(MaxNum) FROM object_classes INTO @iMaxNumTotal;
IF (iSpawnNumVeh < @iMaxNumTotal) THEN
    SET iSpawnNumVeh = @iMaxNumTotal;
END IF;

WHILE (fGetVehCount() < iSpawnNumVeh) DO
    CALL pSpawn();
END WHILE;

This way, user's have the ability to set NO vehicles on the map if they want, but otherwise the code will pick up the amount of vehicles correctly.

guidez commented 11 years ago

Any thought to this? >.>

jonrainier commented 11 years ago

If you haven't already I will be doing some testing on this in the future. ATM I am getting BSOD's. I will investigate when my new rig comes in. Thanks for the contribution.