Raised This Month: $ Target: $400
 0% 

personal plugin coding problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Venomxtinct
Member
Join Date: Nov 2005
Old 01-02-2006 , 11:24   personal plugin coding problem
Reply With Quote #1

im having a little problem. Im new to the coding, and have been trying it out for myself. In this plugin that I mostly tooks from the credit mod plugin, just changes the model of the knife to the crobar. here is the code:
Quote:
#include <amxmodx>

public check_knife(id) {
if (get_cvar_num("sv_crowbar")!=1)
return PLUGIN_CONTINUE

new llama = read_data(0)
client_print(llama,print_center,"Crowbar Active")
client_cmd(llama,"wait;wait;wait;")
if(llama == CSW_KNIFE)
{
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/v_crowbar.mdl")
precache_model("models/p_crowbar.mdl")
}
the errors are:
Quote:
/home/users/amxmodx/tmp3/phpcuu41Y.sma(12) : error 017: undefined symbol "entity_set_string"
/home/users/amxmodx/tmp3/phpcuu41Y.sma(12) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpcuu41Y.sma(12) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/phpcuu41Y.sma(12) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpcuu41Y.sma(12) : fatal error 107: too many error messages on one line
Based upon the errors, I assume that I had trouble defining the string.
Please note that i have next to no expierience with plugins.
Any help would be greatly appreciated.
Venomxtinct is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-02-2006 , 11:32  
Reply With Quote #2

You need to include "engine" because that's where entity_get_string is defined.

Code:
#include <engine>

Also of note, whenever you have a series of errors as you've just shown, ignore all but the first one. The rest are usually a result of the first.
Brad is offline
Venomxtinct
Member
Join Date: Nov 2005
Old 01-02-2006 , 11:39  
Reply With Quote #3

ahh ok thank you
Venomxtinct is offline
Venomxtinct
Member
Join Date: Nov 2005
Old 01-02-2006 , 11:53  
Reply With Quote #4

hmm also i tried that and came up some new errors that I cant figure out...

Quote:
#include <amxmodx>
#include <engine> //included engine

public check_knife(id) {
if (get_cvar_num("sv_crowbar")!=1)
return PLUGIN_CONTINUE

new llama = read_data(0)
client_print(llama,print_center,"Crowbar Active")
client_cmd(llama,"wait;wait;wait;")
if(llama == CSW_KNIFE)
{
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() //line 17
{
precache_model("models/v_crowbar.mdl")
precache_model("models/p_crowbar.mdl")
}
with errors:
Quote:
/home/users/amxmodx/tmp3/phpEldqEX.sma(17) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpEldqEX.sma(17) : error 004: function "plugin_precache" is not implemented
/home/users/amxmodx/tmp3/phpEldqEX.sma(23) : error 001: expected token: "}", but found "-end of file-"
when i put a } on line 23 it still doesnt work...
Venomxtinct is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-02-2006 , 12:05  
Reply With Quote #5

You never closed the plugin_init function. Everytime you have a left brace, you need a matching right brace.

Also, whenever you post code, post it in the [small ] tags.
Brad is offline
Jordan
Veteran Member
Join Date: Aug 2005
Old 01-02-2006 , 14:16  
Reply With Quote #6

Code:
#include <amxmodx> #include <engine> //included engine public plugin_precache() {     precache_model("models/v_crowbar.mdl")     precache_model("models/p_crowbar.mdl") } public check_knife(id) {     new llama = read_data(0)         if (get_cvar_num("sv_crowbar")!=1)     return PLUGIN_CONTINUE     client_print(llama,print_center,"Crowbar Active")     client_cmd(llama,"wait;wait;wait;")     if(llama == CSW_KNIFE) {     entity_set_string(id, EV_SZ_viewmodel, "models/v_crowbar.mdl")     entity_set_string(id, EV_SZ_weaponmodel, "models/p_crowbar.mdl")     return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE }

All the errors are gone now =)
Jordan is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-02-2006 , 20:18  
Reply With Quote #7

Quote:
Originally Posted by Brad
You never closed the plugin_init function. Everytime you have a left brace, you need a matching right brace.

Also, whenever you post code, post it in the [small ] tags.
Correction....you never closed your first function. AND you do not have a plugin_init() function.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-02-2006 , 20:24  
Reply With Quote #8

Code:
new llama = read_data(0) << Wrong to new llama = read_data(2)

Argument 2 is the weaponid.

http://ghw-amxx.biz/cs_events.html << You need to look at this.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Jordan
Veteran Member
Join Date: Aug 2005
Old 01-02-2006 , 21:52  
Reply With Quote #9

Oh sweet I've been looking for one of these
Thanks
Jordan is offline
Venomxtinct
Member
Join Date: Nov 2005
Old 01-12-2006 , 11:23  
Reply With Quote #10

[quote = teame06]http://ghw-amxx.biz/cs_events.html << You need to look at this.
[/quote]

the link doesnt load for me...
__________________
LowgravCS. In development.
Venomxtinct 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 15:58.


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