Entity Use (Like a button)
I'm trying to make a plugin that spawns entities that behave like buttons, let's say it that way.
But whenever I spawn it and try to use it, nothing happens. (Simply stand close to it, press my use key "e" like to any other button/entity, and It's supposed to print out "Button Press", but nothing) PHP Code:
|
Re: Entity Use (Like a button)
Up
|
Re: Entity Use (Like a button)
I wrote this using my mobile phone.
I have not tested it, but it should work. Code:
#include < amxmodx > |
Re: Entity Use (Like a button)
Tried this:
Spoiler
I'm not even aiming at the spawned entity, the message prints anyway and the sound effect when a button is pressed doesn't play. |
Re: Entity Use (Like a button)
I am sorry, my bad.
I have put true instead of false on last line in the following stock. This should now work fine: Code:
stock bool: IsAimingAtEnt( id, const szEntityClassName[ ] ) { |
Re: Entity Use (Like a button)
Nice... are there actually more methods of doing that? Besides when the user is aiming at the entity. If you look at the code I made above, It would actually print the message when he stands near the button & when he's aiming at it. From what I can see, It's supposed to turn the entity into a button.
|
Re: Entity Use (Like a button)
I am using old phone because my new one is dead xD
So i have Android 2.3.3 and i cant scroll the code, when i can use pc i will see it. You can add boolean to player and in that way stop user spamming and clicking agin. Yes there is more efficent ways but this first fell on top of my mind, i have to study so i am bored and lazy to thing about it for longer time :P For example: Code:
... |
Re: Entity Use (Like a button)
Wel that's easy to make myself lol
This makes the entity usable only when aimed at... If I'm using a timer with that players would cheat lol.. they can press it from anywhere they can see it |
Re: Entity Use (Like a button)
You can use: entity_range( iEntityId, iPlayer )
That will solve the problem. Example: Code:
if( entity_range( iEntityId, iPlayer ) <= 30 ) { |
Re: Entity Use (Like a button)
Code:
this should do it imo and remove these lines Code:
and if you still can't get it working you can take a look at this plugin, there's a functionality that lets you create buttons in there |
| All times are GMT -4. The time now is 22:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.