AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can Someone Compile this for me and fix? (https://forums.alliedmods.net/showthread.php?t=24675)

M4Maniac 02-28-2006 18:22

Can Someone Compile this for me and fix?
 
Quote:

#include <amxmodx>
#include <engine> // this plugin requires Engine
public plugin_init() {
register_plugin("oh hello" , "1.0" , "v3x");
register_event("CurWeapon" , "set_models" , "be" , "1=1"); // if we don't check for the isActive parameter then the skins will act up and change unexpectedly on you (if 0)
}
public plugin_precache() {
precache_model("models/v_deagle.mdl"); // the view model
precache_model("models/p_deagle.mdl"); // the player (view) model
public set_models(id) {
if(!is_user_alive(id)) { // if the player is dead for some reason, prevent the rest of the function from being executed
return PLUGIN_CONTINUE;
}

new weapid = read_data(2); // get the weapon ID

switch(weapid) {
case CSW_M4A1: { // check if it's the weapon ID we want (see below for weapon constants)
entity_set_string(id , EV_SZ_viewmodel , "models/v_deagle.mdl"); // set the view model
entity_set_string(id , EV_SZ_weaponmodel , "models/p_deagle.mdl"); // set the player (view) model
}
// this is where you'd add more if needed
}
return PLUGIN_CONTINUE;
}
#include <amxmodx>
#include <engine> // this plugin requires Engine

public plugin_init() {
register_plugin("oh hello" , "1.0" , "v3x");
register_event("CurWeapon" , "set_models" , "be" , "1=1"); // if we don't check for the isActive parameter then the skins will act up and change unexpectedly on you
}

public plugin_precache() {
precache_model("models/v_mymodel.mdl"); // the view model
precache_model("models/p_mymodel.mdl"); // the player (view) model
}

public set_models(id) {
if(!is_user_alive(id)) { // if the player is dead for some reason, prevent the rest of the function from being executed
return PLUGIN_CONTINUE;
}

new weapid = read_data(2); // get the weapon ID

switch(weapid) {
case CSW_M4A1: {
entity_set_string(id , EV_SZ_viewmodel , "models/v_deagle.mdl"); // set the view model
entity_set_string(id , EV_SZ_weaponmodel , "models/p_deagle.mdl"); // set the player (view) model
}
// this is where you'd add more if needed
}
return PLUGIN_CONTINUE;
}

GHW_Chronic 02-28-2006 18:53

A. use [small] not [quote].
B. u... pasted the plugin twice?
C. it says "Add more here"... so add more there, yes?
D. what do u want us to do?

M4Maniac 02-28-2006 19:00

When i tried to Compile it several errors occered:
/home/users/amxmodx/tmp3/phpq0xDoU.sma(10) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpq0xDoU.sma(10) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpq0xDoU.sma(10) : error 017: undefined symbol "set_models"
/home/users/amxmodx/tmp3/phpq0xDoU.sma(11) : error 017: undefined symbol "id"
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : error 017: undefined symbol "id"
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/phpq0xDoU.sma(19) : fatal error 107: too many error messages on one line

I was wondering if you could fix these and give me the plugin

Jordan 02-28-2006 19:04

Code:
#include <amxmodx> #include <engine> // this plugin requires Engine public plugin_init() {     register_plugin("oh hello" , "1.0" , "v3x");     register_event("CurWeapon" , "set_models" , "be" , "1=1"); // if we don't check for the isActive parameter then the skins will act up and change unexpectedly on you (if 0) } public plugin_precache() {     precache_model("models/v_deagle.mdl"); // the view model     precache_model("models/p_deagle.mdl"); // the player (view) model } public set_models(id) {     if(!is_user_alive(id)) // if the player is dead for some reason, prevent the rest of the function from being executed     {           return PLUGIN_HANDLED;     }     new weapid = read_data(2); // get the weapon ID     switch(weapid)     {         case CSW_M4A1: // check if it's the weapon ID we want (see below for weapon constants)         {               entity_set_string(id , EV_SZ_viewmodel , "models/v_deagle.mdl"); // set the view model             entity_set_string(id , EV_SZ_weaponmodel , "models/p_deagle.mdl"); // set the player (view) model         }     }     return PLUGIN_CONTINUE; }

Dunno if it works, but it compiles.

M4Maniac 02-28-2006 19:19

Any Idea how to get the Weapon id needed in this line

Code:
new weapid = read_data(2); // get the weapon ID

GHW_Chronic 02-28-2006 19:22

i posted back to ur question on the GHW boards...
http://ghw-amxx.com/viewtopic.php?p=34#34

Jordan 02-28-2006 22:36

Maybe this will make it easier:

Code:
new weapid = read_data(2); // getS the weapon ID

You just have to use what Chronic says.


All times are GMT -4. The time now is 20:28.

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