AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   no arrays or too many subscripts (https://forums.alliedmods.net/showthread.php?t=26773)

Mini_Midget 04-09-2006 02:13

no arrays or too many subscripts
 
well...
this is my first time coding and now i need help
Code:
public  weaponChange(id) {     if (get_cvar_num("amx_claws"))         (get_user_flags(id)) {         {             new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)             if (wpnid == CSW_KNIFE) {                 entity_set_string(id, EV_SZ_viewmodel, "claws.mdl")             }         }         new CsTeams:userTeam = cs_get_user_team(id)         if (userTeam == CS_TEAM_T) {                        cs_set_user_model(id, "claws")         }                               else {                                  cs_reset_user_model(id)                 }                           }
when i try to compile it
it gives me 2 error messages
first one is on the 3rd line and it says that it has no arrays or too many subscripts
the 2nd error is on like 4 about loose indentation
thxs in advance

capndurk 04-09-2006 02:55

Re: no arrays or too many subscripts
 
Code:
public  weaponChange(id) {     if (get_cvar_num("amx_claws"))         (get_user_flags(id)) {

Your weaponChange(id) function opens with that first bracket, then you have the if statement. However, you just have (get_user_flags(id)) out there alone. Without the white space, it would look like this:

Code:
public  weaponChange(id) {     if (get_cvar_num("amx_claws"))  (get_user_flags(id)) {

So you should either put the { right after the if statement or put (get_user_flags(id)) inside the parentheses.

Mini_Midget 04-09-2006 03:09

thxs capndurk but now I have one error and its something different
Code:
 public  weaponChange(id) {     if (get_cvar_num("amx_claws"))    (get_user_flags(id)) {
something wrong with the 2nd line :?
the error says
error 001: expected token: "(", but found "{"

cheers Midget

capndurk 04-09-2006 03:21

Quote:

Originally Posted by Mini_Midget
thxs capndurk but now I have one error and its something different
Code:
 public  weaponChange(id) {     if (get_cvar_num("amx_claws"))    (get_user_flags(id)) {
something wrong with the 2nd line :?
the error says
error 001: expected token: "(", but found "{"

cheers Midget

No I just meant that get_user_flags(id) is usually used like this:

Code:
(get_user_flags(id)&ADMIN_CHAT)

This statement would return true if the player has access to admin chat. What are you intending to do with this get_user_flags(id)?

Mini_Midget 04-09-2006 04:40

i'm currently trying to make a model changer

capndurk 04-09-2006 04:48

Quote:

Originally Posted by Mini_Midget
i'm currently trying to make a model changer

So are you trying to limit a player's ability to change models through his access level, or do you want to include that in the if statement at all?

Mini_Midget 04-09-2006 04:53

i'll tell you what im' trying to do
i want a plugin where the plugin changes one side of the team's models such as the knife
i dont really want to change the whole skin
just to note this is for cs and i want to change the terroist knife

capndurk 04-09-2006 05:09

here is the code for the plugin you want, and this should do the trick.

credits: http://ghw-amxx.com/viewtopic.php?t=18
(thanks v3x!)

Code:
#include <amxmodx> #include <engine> #include <cstrike> public plugin_init() {     register_plugin("TerroristKnife" , "1.0" , "Mini Midget");     register_event("CurWeapon" , "set_models" , "be" , "1=1"); } public plugin_precache() {     precache_model("models/claws.mdl"); } public set_models(id) {     if(!is_user_alive(id))     {         return PLUGIN_CONTINUE;     }     new CsTeams:team = cs_get_user_team(id);     if(team != CS_TEAM_T)     {         return PLUGIN_CONTINUE;     }     new weapid = read_data(2);     switch(weapid)     {         case CSW_KNIFE:         {             entity_set_string(id, EV_SZ_weaponmodel, "models/claws.mdl");         }     }     return PLUGIN_CONTINUE; }

if it doesn't work, you might have to change the directory to something other than "models/claws.mdl"

Mini_Midget 04-09-2006 05:17

sweet as
thxs for your time capn
and here's a +Karma
now time to study :cry:

Mini_Midget 04-09-2006 08:31

1 Attachment(s)
hmm
your last post with the script doesn't work for some reason...
the model isn't showing up but it compiles fine...

[EDIT]
i have a screen shot of what is happening


All times are GMT -4. The time now is 16:42.

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