AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   DoD Set Model (https://forums.alliedmods.net/showthread.php?t=55272)

awpticaL 05-18-2007 04:32

DoD Set Model
 
Alright, I'm trying to determine if the user is on Axis(Bot or not) and then set their model to whatever I am using. If they aren't on Axis, it leaves their model to default.

Pretty simple, yet I'm a noob and it's 4AM

..

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <dodx> #define PLUGIN "DoD Models" #define VERSION "1.0" #define AUTHOR "awpticaL`" public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_event("ResetHUD", "setModel", "b")         }   public plugin_precache() {       precache_model("models/hat_axis.mdl")       precache_model("models/helmet_axis.mdl")     precache_model("models/player/axis-inf/axis-inf.mdl")     precache_model("models/player/axis-inf/axis-infT.mdl") }           public setModel(id) {         new dodteams:userTeam = get_user_team(id)     if userTeam == 1 {         dod_set_model(id,"axis-inf")     }     else {         dod_clear_model(id)     } }

Code:

Warning: Tag mismatch on line 26
Error: Expected token: "(", but found "-identifier-" on line 26


Any information on how to fix this would be great.
I could also use a pointer on how it happened so I can avoid it in the future.

mogel 05-18-2007 05:20

Re: DoD Set Model
 
Moin,

change

Code:

new dodteams:userTeam = get_user_team(id)
// and
if userTeam == 1 {

to

Code:

new userTeam = get_user_team(id)
// and
if (userteam == 1) {

hand, mogel

awpticaL 05-18-2007 14:49

Re: DoD Set Model
 
*hits self*

Thanks a ton!

awpticaL 05-18-2007 23:35

Re: DoD Set Model
 
For some reason, it didn't work.

I'm trying to:
  • If player joins Axis, bot or not, it sets their model to what I have set
  • otherwise it leaves the default model

This is my code so far, compiles and runs fine, but the model isn't set for some reason.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <dodx> #define PLUGIN "DoD Models" #define VERSION "1.0" #define AUTHOR "awpticaL`" public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_event("ResetHUD", "setModel", "b")         }   public plugin_precache() {       precache_model("models/hat_axis.mdl")       precache_model("models/helmet_axis.mdl")     precache_model("models/player/axis-inf/axis-inf.mdl")     precache_model("models/player/axis-inf/axis-infT.mdl") }           public setModel(id) {         new userTeam = get_user_team(id)     if (userTeam == 1) {         dod_set_model(id,"axis-inf")     }     else {         dod_clear_model(id)     } }

vtsoxluvr 06-05-2007 13:28

Re: DoD Set Model
 
any help would be appreciated i want to do the same thing

vtsoxluvr 06-13-2007 19:59

Re: DoD Set Model
 
Quote:

Originally Posted by awpticaL (Post 478133)
For some reason, it didn't work.

I'm trying to:
  • If player joins Axis, bot or not, it sets their model to what I have set
  • otherwise it leaves the default model

This is my code so far, compiles and runs fine, but the model isn't set for some reason.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <dodx> #define PLUGIN "DoD Models" #define VERSION "1.0" #define AUTHOR "awpticaL`" public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_event("ResetHUD", "setModel", "b")         }   public plugin_precache() {       precache_model("models/hat_axis.mdl")       precache_model("models/helmet_axis.mdl")     precache_model("models/player/axis-inf/axis-inf.mdl")     precache_model("models/player/axis-inf/axis-infT.mdl") }           public setModel(id) {         new userTeam = get_user_team(id)     if (userTeam == 1) {         dod_set_model(id,"axis-inf")     }     else {         dod_clear_model(id)     } }

you have to use a different model name, as axis_inf is a default model so it wont replace the default model i cant get it to work though i just get an all white model

sparky99 06-14-2007 20:31

Re: DoD Set Model
 
In dod get user team returns a string not a number.

Vet 06-15-2007 00:54

Re: DoD Set Model
 
Quote:

Originally Posted by sparky99 (Post 489858)
In dod get user team returns a string not a number.

(^^^ Not true. Returns 1 if Allies, 2 if Axis)

Try using dod_client_changeteam to set the model instead of ResetHUD event.

Code:


public dod_client_changeteam(id, team, oldteam)
{
  if (is_user_connected(id) && team == ALLIES) {
    dod_set_model(id, "axis-inf")
  }
  else {
    dod_clear_model(id)
  }
}



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

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