AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   personal plugin coding problem (https://forums.alliedmods.net/showthread.php?t=22711)

Venomxtinct 01-02-2006 11:24

personal plugin coding problem
 
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.

Brad 01-02-2006 11:32

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.

Venomxtinct 01-02-2006 11:39

ahh ok thank you

Venomxtinct 01-02-2006 11:53

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...

Brad 01-02-2006 12:05

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.

Jordan 01-02-2006 14:16

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 =)

Xanimos 01-02-2006 20:18

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.

teame06 01-02-2006 20:24

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.

Jordan 01-02-2006 21:52

Oh sweet I've been looking for one of these 8)
Thanks :D

Venomxtinct 01-12-2006 11:23

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

the link doesnt load for me...


All times are GMT -4. The time now is 15:58.

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