AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help spawning crowbar (https://forums.alliedmods.net/showthread.php?t=11142)

joecaprini 03-10-2005 20:46

Need help spawning crowbar
 
I was trying to write a plugin that will spawn a crowbar in front of you but I can't get it to appear it just says unknown command.

Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Crowbar","0.1","JoeCaprini")     register_clcmd("amx_crowbar","createcrowbar",ADMIN_BAN,"- Creates a crowbar") } public createcrowbar() {     // Create the crowbar     new entbar = create_entity("info_target")     // Give it a new name     entity_set_string(entbar,EV_SZ_classname,"crowbar")     // Set the model     entity_set_model(entbar,"models/w_crowbar.mdl")     // Position it     new Float:PVEC[3] = {0.0,0.0,0.0}     entity_set_origin(entbar,PVEC)     // Set some properties I don't understand     entity_set_int(entbar, EV_INT_solid, 1)     entity_set_int(entbar, EV_INT_movetype, 6)     return PLUGIN_CONTINUE } // new weaponid, clip, ammo // weaponid = get_user_weapon(id, clip, ammo) // if (weaponid == CSW_C4) // { //      ammo_hud(id, 1) //      entity_set_string(id, EV_SZ_viewmodel, "models/v_crowbar.mdl") //      entity_set_string(id, EV_SZ_weaponmodel, "models/p_crowbar.mdl") // } public plugin_precache() {     precache_model("models/w_crowbar.mdl")     precache_model("models/v_crowbar.mdl")     precache_model("models/p_crowbar.mdl") }

tight2089 03-10-2005 22:03

1) Did you install all the files in the right place and add a line to plugins.ini
2) Do you have the proper metamods in order to use this plugin?
:D

Peli 03-10-2005 22:09

Quote:

Originally Posted by tight2089
1) Did you install all the files in the right place and add a line to plugins.ini
2) Do you have the proper metamods in order to use this plugin?
:D

Wow , he needs help with the SCRIPTING of the plugin , not the INSTALLING of a plugin.

XxAvalanchexX 03-10-2005 22:16

The classname should be "weapon_crowbar", not "crowbar", and you're setting its origin to 0, 0, 0, which probably isn't where the player is standing.

Twilight Suzuka 03-10-2005 23:30

You've forgotten something Avalanche.

Code:

new entbar = create_entity("info_target")
Wont do.
Code:

new entbar = create_entity("weapon_crowbar")
Is how you should do it. Just changing the classname does not change what the ent is.

joecaprini 03-11-2005 19:43

Ok that's it, I give up. I simply cannot get it to spawn :evil: Could anyone please tell me how to spawn it infront of me and when I pick it up it is a crowbar? I have no clue


All times are GMT -4. The time now is 14:10.

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