Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Error in code , please help

Go to solution Solved by WiiManic,
37 minutes ago, Aleksa Djordjic said:

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

That means line 53, column 31 is where the error is.

 

If you look in your code there, you can see there is "_player.RpcTakeDamage(_damage);".

Argument 1 means the first thing you have passed to "_player.RpcTakeDamage", so "_damage" is the problem.

 

It can't convert it from a float to an int, so, "_damage" is a float, but it is supposed to be an int.

Once you change _damage to be an int, or _player.RpcTakeDamage to accept a float instead, that should work fine.

1 hour ago, Aleksa Djordjic said:

Original post is on another site but please answer here, there aren`t notifications on that site.

 

Original post:

http://forum.brackeys.com/thread/error-in-code-please-help/#reply_52869

it would have taken you seconds to copy the images over to here..

 

"cannot covert float to int" means exactly what it says somewhere your code is trying to convert a float (1.23) to an int (123).

 

without bothering to post your code then that's all the help anyone can provide 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, vorticalbox said:

it would have taken you seconds to copy the images over to here..

 

"cannot covert float to int" means exactly what it says somewhere your code is trying to convert a float (1.23) to an int (123).

 

without bothering to post your code then that's all the help anyone can provide 

Sorry

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, vorticalbox said:

it would have taken you seconds to copy the images over to here..

 

"cannot covert float to int" means exactly what it says somewhere your code is trying to convert a float (1.23) to an int (123).

 

without bothering to post your code then that's all the help anyone can provide 

I did convert it to int and now there is another error : 

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

And i dont know what it means by Argument `#1`

Screenshot (79).png

Screenshot (80).png

Link to comment
Share on other sites

Link to post
Share on other sites

37 minutes ago, Aleksa Djordjic said:

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

That means line 53, column 31 is where the error is.

 

If you look in your code there, you can see there is "_player.RpcTakeDamage(_damage);".

Argument 1 means the first thing you have passed to "_player.RpcTakeDamage", so "_damage" is the problem.

 

It can't convert it from a float to an int, so, "_damage" is a float, but it is supposed to be an int.

Once you change _damage to be an int, or _player.RpcTakeDamage to accept a float instead, that should work fine.

CPU: 6700k GPU: Zotac RTX 2070 S RAM: 16GB 3200MHz  SSD: 2x1TB M.2  Case: DAN Case A4

Link to comment
Share on other sites

Link to post
Share on other sites

33 minutes ago, WiiManic said:

That means line 53, column 31 is where the error is.

 

If you look in your code there, you can see there is "_player.RpcTakeDamage(_damage);".

Argument 1 means the first thing you have passed to "_player.RpcTakeDamage", so "_damage" is the problem.

 

It can't convert it from a float to an int, so, "_damage" is a float, but it is supposed to be an int.

Once you change _damage to be an int, or _player.RpcTakeDamage to accept a float instead, that should work fine.

Ok , tnx :) 

I will try this tomorrow (i am in Europe so time is different for me) because it is late now and i have shutdown my PC.

Also thank you for explaining to me what 53,31. I tough that it means that problem goes form 53rd line to 31st line xD

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×