AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change model but not team in The Specialists Teamplay. (https://forums.alliedmods.net/showthread.php?t=48720)

stupok 12-18-2006 20:43

Change model but not team in The Specialists Teamplay.
 
I figured I'd start a new topic for this, since I have a specific goal in mind for a specific mod. I want to change the player's model in The Specialists Teamplay without changing their team.

Quote:

Originally Posted by XxAvalanchexX (Post 416600)
Code:
 #include <amxmodx>  #include <fakemeta>  public plugin_init()  {     register_forward(FM_PlayerPostThink,"fw_think");  }  public fw_think(id)  {     new info = engfunc(EngFunc_GetInfoKeyBuffer,id);     engfunc(EngFunc_SetClientKeyValue,id,info,"model","aswat");     return FMRES_IGNORED;  }

So I tested this code on a server with The Specialists Teamplay, and its nuts. The hud doesn't display, the 3, 2, 1 numbers before spawn appear randomly after spawn, the models aren't set to the model specified in the code, and you can only kill teammates. Oh, and you can't view your own model from third-person view. It's nuts.

So XxAvalanchexX, as I hope you're reading this, could you help me out with this? I'd love to come up with a method myself, but I don't know where to begin. I'd really appreciate some advice.

There are some events that might be useful:
Code:

Game registered user msgs:    msgid  size
TeamInfo                    84    -1
TeamScore                    85    -1

I just don't have the time right now to play around with it and I'm convinced there are methods I am completely unaware of.

Thanks for your time. :wink:

XxAvalanchexX 12-18-2006 22:58

Re: Change model but not team in The Specialists Teamplay.
 
Let me know how this works out.

Code:
 #include <amxmodx>  #include <fakemeta>  public plugin_init()  {     register_plugin("Model Test","0.10","Avalanche");     register_forward(FM_ClientUserInfoChanged,"fw_info");     register_forward(FM_PlayerPostThink,"fw_think");  }  public fw_info(id,buffer)  {     return FMRES_SUPERCEDE;  }  public fw_think(id)  {     new info = engfunc(EngFunc_GetInfoKeyBuffer,id);     engfunc(EngFunc_SetClientKeyValue,id,info,"model","gordon");     return FMRES_IGNORED;  }

Obviously I can't test it fully without a real server. It should make everyone look like gordon... players might not be able to change their name, I'm not sure. I'm still not sure how to detect whether or not the info change is called on model change.

stupok 12-19-2006 00:30

Re: Change model but not team in The Specialists Teamplay.
 
I tested it, it works much better than the other one. I changed my name without a problem.

Now, as far as I know, the only problem left to solve is preventing the model change from changing the players' teams.

XxAvalanchexX 12-19-2006 02:07

Re: Change model but not team in The Specialists Teamplay.
 
Does their team change on the scoreboard? Only internally (it doesn't show up on the scoreboard but who you can kill is dictated by it)? Or both?

stupok 12-19-2006 18:55

Re: Change model but not team in The Specialists Teamplay.
 
I have mp_teamlist with two teams. Using the code above, the models are all gordons but the team names are the same as listed by mp_teamlist. It splits up the teams by number, so they have an equal number of people on each team(adding bots). I can only kill the players of the opposing team.

Ok, some further testing makes it more confusing. When I switch teams, the scoreboard looks ok, but all my opponents have the green sprite over their heads like they are my teammates, and the scoreboard shows my team's name two times, instead of showing team1 and team2. Then I kill an opponent and the scoreboard is back to normal, and the green sprites that show allies are no longer present on my allies or opponents.

It's pretty confusing. Tomorrow I could spend some time testing this with you on my server if you're up to it.

Orangutanz 12-20-2006 09:32

Re: Change model but not team in The Specialists Teamplay.
 
Code:
#include <amxmodx> new skin[33] new skinname[33][32] public plugin_init() {     register_plugin("Model Test", "0.10", "Orangutanz") } public client_infochanged(id) {     if (skin[id])     {         static model[32]         get_user_info(id, "model", model, 31)         if (equali(model, skinname[id]))             return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
You need to build a command but there we go, don't need FakeMeta to change player models :mrgreen:

XxAvalanchexX 12-20-2006 17:08

Re: Change model but not team in The Specialists Teamplay.
 
So you can restrict him from changing to anything but the specified model, but what changes him to the specified model in the first place?

stupok 12-20-2006 18:22

Re: Change model but not team in The Specialists Teamplay.
 
Orangutanz that is not relevant to my goal. I want to change the players' models to something they should not be in the first place, and be able to change them to not one, but several models. This should be done without actually changing their "model" info, so the game thinks they are one model but they are another.

Avalanche, what do you think about the situation? I'm thinking that I should intercept the TeamInfo and TeamScore messages and resend them with the teamnames I want them to have. I tried to write it for TeamInfo, but I'm not doing it correctly, here's my attempt:

Code:
register_message(84, "TeamInfo_function") } public TeamInfo_function() {     new id = read_data(1)     new zom[32], hum[32]     get_cvar_string("zombiemodelcvar", zom, 31)     get_cvar_string("humanmodelcvar", hum, 31)     if(is_user_bot(id))     {         message_begin(MSG_ALL, 84, {0.0, 0.0, 0.0}, id)         write_byte(id)         write_string(zom)         message_end()     }     else     {         message_begin(MSG_ALL, 84, {0.0, 0.0, 0.0}, id)         write_byte(id)         write_string(hum)         message_end()     } }

I don't think id should be passed in message_begin(), but I don't know what should be.

XxAvalanchexX 12-20-2006 23:41

Re: Change model but not team in The Specialists Teamplay.
 
MSG_ALL doesn't require any other info. You can just use "message_begin(MSG_ALL, 84)". I don't know the specifics on TS's TeamInfo or TeamScore, so you're sort of on your own here.

stupok 12-20-2006 23:43

Re: Change model but not team in The Specialists Teamplay.
 
Thanks for the tip, I'll see what I can do.


All times are GMT -4. The time now is 22:24.

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