Grenade Name return
How can I return the grenade's name when it touch a player?
I have a method but I want to know if have any other better than mine. Thats the code that I'm using: PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
Re: Grenade Name return
This?
PHP Code:
|
Re: Grenade Name return
No, as the fwd_touch says, the CSW_ prefix is already taken, i want return a string for show on console_print().
|
Re: Grenade Name return
Are you aware that your fGetDistance() function only gets the distance of the Z axis (up and down distance)?
|
Re: Grenade Name return
No, I just copied it from my runboost. But it works.
|
Re: Grenade Name return
Well, that's what it does. Use get_distance_f() to get actual distance.
0=X 1=Y 2=Z |
Re: Grenade Name return
Yea, thats what I have:
PHP Code:
PHP Code:
|
Re: Grenade Name return
'Yes that's what I have'. No what you have is this, unless you are saying you have fixed it?
PHP Code:
Aside from your method being wrong, you also do not take into consideration the orientation of one player to the other. So if I'm standing on your head and you subtract my Z from yours, the distance will be negative (hypothetically) and it would never satisfy your distance condition. This can be fixed by getting the absolute value, abs(), of the Z1-Z2 value. I've never returned a string from a function because I remember reading somewhere that it does not work properly. This may only be in some scenarios like returning from a native or something. With that said, I always stick to not returning a string. You can easily avoid returning a string by just returning the index to the weapon name in the array. |
Re: Grenade Name return
I meant that I have fixed.
And I said "return a string" meaning "how can I return the smokegrenade/flashbang on the console_print()". |
Re: Grenade Name return
It looks messy, I'll need to see more of your plugin to fix this
PHP Code:
|
| All times are GMT -4. The time now is 21:02. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.