Raised This Month: $51 Target: $400
 12% 

Flashlight Wont Spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Drak
Veteran Member
Join Date: Jul 2005
Old 07-29-2010 , 23:39   Re: Flashlight Wont Spawn
Reply With Quote #11

Can you please show the code you used really quick?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Mirun.Frontier
Member
Join Date: Aug 2008
Old 07-29-2010 , 23:41   Re: Flashlight Wont Spawn
Reply With Quote #12

In short i just changed give_item to create_entity(with engine included of course)
Wouldn't expect me to put a few more lines because well usually when I start on a plugin I end up giving up whenever I mess up, and I know there will be a bunch of mess ups.

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>

#define PLUGIN "Flashlight Spawner"
#define VERSION "1.0"
#define AUTHOR "Ghost"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_concmd("say !flashlight","flashlight",-1,"Gives yourself a Flashlight!")
}

public flashlight(id)
{
    create_entity(id,"weapon_flashlight")
    return PLUGIN_HANDLED
}
__________________
I can't believe I wasted 5 years of my life not knowing how to program correctly. Went too deep into advanced coding before even learning the basics correctly. :c

Last edited by Mirun.Frontier; 07-29-2010 at 23:43.
Mirun.Frontier is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 07-30-2010 , 00:13   Re: Flashlight Wont Spawn
Reply With Quote #13

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "Flashlight Spawner" #define VERSION "1.0" #define AUTHOR "Ghost" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("say !flashlight","flashlight",-1,"Gives yourself a Flashlight!") } public flashlight(id) {     new Ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"));     if(Ent)     {         // Test         //new Float:plOrigin[3]         //pev(id,pev_origin,plOrigin);         //engfunc(EngFunc_SetOrigin,Ent,plOrigin);                 // Too lazy         dllfunc(DLLFunc_Use,id,Ent);         dllfunc(DLLFunc_Use,Ent,id);                 client_print(id,print_chat,"* You should have a flashlight");     }     return PLUGIN_HANDLED }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-30-2010 , 01:00   Re: Flashlight Wont Spawn
Reply With Quote #14

dllfunc(DLLFunc_Use,Ent,id);

This one should be the correct one.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-30-2010 , 06:31   Re: Flashlight Wont Spawn
Reply With Quote #15

Quote:
Originally Posted by GXLZPGX View Post
Learn to read.
Do you necessary have to be such an asshole?
__________________
hleV is offline
Mirun.Frontier
Member
Join Date: Aug 2008
Old 07-30-2010 , 16:49   Re: Flashlight Wont Spawn
Reply With Quote #16

Didn't work drak.
I just want it to spawn under the player's feet.
__________________
I can't believe I wasted 5 years of my life not knowing how to program correctly. Went too deep into advanced coding before even learning the basics correctly. :c

Last edited by Mirun.Frontier; 07-30-2010 at 16:53.
Mirun.Frontier is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 07-30-2010 , 17:55   Re: Flashlight Wont Spawn
Reply With Quote #17

Try using
Code:
new Ent = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"weapon_flashlight"));
Seta00 is offline
Mirun.Frontier
Member
Join Date: Aug 2008
Old 07-31-2010 , 04:28   Re: Flashlight Wont Spawn
Reply With Quote #18

That didn't work.
__________________
I can't believe I wasted 5 years of my life not knowing how to program correctly. Went too deep into advanced coding before even learning the basics correctly. :c
Mirun.Frontier is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-31-2010 , 13:05   Re: Flashlight Wont Spawn
Reply With Quote #19

Under player's feet, just get player origin and spawn the entity.

Does that entity have a default model or something for you to see if it actually spawns the entity ?

Code:
#include <amxmodx>
#include <engine>

public plugin_init()
    register_clcmd("say !flashlight", "cmd_flashlight")

public cmd_flashlight(id)
{
    new Float:fOrigin[3]

    entity_get_vector(id, EV_VEC_origin, fOrigin)

    new ent = create_entity("weapon_flashlight")

    if(!ent) /* just to be sure it's not failing */
    {
         client_print(0, print_chat, "[debug] failed creating ^"weapon_flashlight^" entity")

         return PLUGIN_HANDLED
    }

    DispatchSpawn(ent) /* maybe this is needed */
    call_think(ent) /* or this ? */
    entity_set_origin(ent, fOrigin) /* move it to player location */

    /* or you could fake_touch() the entity instead of moving it under the player */

    return PLUGIN_HANDLED
}
__________________

Last edited by Hunter-Digital; 07-31-2010 at 13:09.
Hunter-Digital is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode