Error in code , please help

Updated on October 31, 2017 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
6 on October 31, 2017

I was watching how to make FPS Shooter tutorials and i think that the code is not working for me how it should. I tried downloading it but same error appears again :/

Photos :

https://ibb.co/cmy3Cb
https://ibb.co/hMXKkw

  • Liked by
Reply
3 on October 31, 2017

Your¬†CmdPlayerShot() uses a int as second argument, the error says the weapon.damage is a float so a casting error is displayed. If you cast your float to an int it should be fixed or change the parameter input to a float ūüėČ

 

on October 31, 2017

Sorry , i am new to programming and English is not my main language , can you please do it for me if you can. I can send you script file over mediafire and if you can somehow get edited one back to me , or maybe if you have teamviewer i can give you my code and pass so you can help me please . If you cant , i will try to fix it myself 

Thank you for help 

on October 31, 2017

Well …. i tried to fix it and i did but another error appeared XD :

Assets/Scripts/PlayerShoot.cs(53,31): error CS1503: Argument `#1′ cannot convert `float’ expression to type `int’

 

on October 31, 2017

 

 

Show more replies
  • Liked by
Reply
Cancel
1 on October 31, 2017

Try this, Line 48:

void CmdPlayerShot (string _playerID, float _damage )

So instead of “int _damage” just put in “float _damage”

on October 31, 2017

Well …. i tried to fix it and i did but another error appeared XD :

Assets/Scripts/PlayerShoot.cs(53,31): error CS1503: Argument `#1′ cannot convert `float’ expression to type `int’

From AleksaDjordjic

 

Show more replies
  • Liked by
Reply
Cancel