Vice City: Multiplayer

VC:MP Discussion => Support => Bugs and Crashes => Topic started by: Nihongo^ on Jul 14, 2022, 05:02 PM

Title: arith op + between "null" and "integer"
Post by: Nihongo^ on Jul 14, 2022, 05:02 PM
Why i keep getting this error when i join server its giving me the same error OnPlayerKill function when i headshot

status[ killer.ID ].Headshots++;
(https://i.postimg.cc/zvjtq8fP/xd.png)
Title: Re: arith op + between "null" and "integer"
Post by: NicusorN5 on Jul 15, 2022, 01:02 AM
status[ killer.ID ] is null. Initialize it when joining inside the onPlayerJoin() function.
Title: Re: arith op + between "null" and "integer"
Post by: Nihongo^ on Jul 15, 2022, 10:06 AM
Quote from: Athanatos on Jul 15, 2022, 01:02 AMstatus[ killer.ID ] is null. Initialize it when joining inside the onPlayerJoin() function.
Can you give any example how ?
Because
status[ killer.ID ].Kills++;  work perfectly

but when i put
status[ killer.ID ].Headshots++; Its give error same with the Joins++;
Title: Re: arith op + between "null" and "integer"
Post by: NicusorN5 on Jul 15, 2022, 08:46 PM
Initialize the "Headshots" field in the player stats's class constructor to 0.
Title: Re: arith op + between "null" and "integer"
Post by: Nihongo^ on Jul 18, 2022, 08:56 AM
Thanks  Athanatos problem solved :)