Raised This Month: $51 Target: $400
 12% 

[TF2]switch a players class


Post New Thread Reply   
 
Thread Tools Display Modes
Gachl
BANNED
Join Date: Feb 2009
Old 07-03-2009 , 08:05   Re: [TF2]switch a players class
Reply With Quote #11

I used TF2_GetClass(yourInput), I have no idea what valid input is but the list of tsunami looks quite okay ^^
edit: btw where could I look it up?

Last edited by Gachl; 07-03-2009 at 08:06. Reason: edit.
Gachl is offline
3_stooges_geo
Member
Join Date: Jul 2008
Location: Blackwood,New Jersey
Old 07-03-2009 , 08:13   Re: [TF2]switch a players class
Reply With Quote #12

Quote:
Originally Posted by Gachl View Post
sorry, I fixed that now (OP).
still not working
i am using sm 1.3
L 07/03/2009 - 08:08:45: [SM] Native "IsClientConnected" reported: Client index 0 is invalid
L 07/03/2009 - 08:08:45: [SM] Displaying call stack trace for plugin "changeclass.smx":
L 07/03/2009 - 08:08:45: [SM] [0] Line 45, /home/groups/alliedmodders/forums/files/4/8/5/3/9/44811.attach::Command_ChangeClass()
L 07/03/2009 - 08:09:59: [SM] Native "IsClientConnected" reported: Client index 0 is invalid
L 07/03/2009 - 08:09:59: [SM] Displaying call stack trace for plugin "changeclass.smx":
L 07/03/2009 - 08:09:59: [SM] [0] Line 45, /home/groups/alliedmodders/forums/files/4/8/5/3/9/44811.attach::Command_ChangeClass()

Last edited by 3_stooges_geo; 07-03-2009 at 08:28. Reason: using sm 1.3
3_stooges_geo is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-03-2009 , 09:14   Re: [TF2]switch a players class
Reply With Quote #13

stupid client handle handling
now, OP edited, new version up.
This WILL work!
If not I'll buy myself a beer.

Also you have to use the userid as parameter (sm_changeclass <userid> <classname>). the userid is the unique id of the user, that id that increases if a new player connects. You can get that by typing status in the console (it's the number in the # - row) or by using the adminmenu_custom
Code:
"Change players class"
{
  "cmd"  "sm_changeclass @1 @2"
  "admin"  "sm_kick"
  "execute" "player"
  "1"
  {
    "type"  "player"
    "title"  "Player"
    "method"  "userid2"
  }
  "2"
  {
    "type"  "list"
    "title"  "Class"
    "1"  "heavy"
    "2"  "scout"
    "3"  "medic"
    "4"  "soldier"
    "5"  "spy"
    "6"  "pyro"
    "7"  "demoman"
    "8"  "sniper"
    "9"  "engineer"
  }
}
Gachl is offline
3_stooges_geo
Member
Join Date: Jul 2008
Location: Blackwood,New Jersey
Old 07-03-2009 , 10:01   Re: [TF2]switch a players class
Reply With Quote #14

Works,thanks alot.
player changes class after death or when they go to med cabinet.
3_stooges_geo is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-03-2009 , 10:04   Re: [TF2]switch a players class
Reply With Quote #15

ahw no beer for me
Gachl is offline
3_stooges_geo
Member
Join Date: Jul 2008
Location: Blackwood,New Jersey
Old 07-03-2009 , 10:06   Re: [TF2]switch a players class
Reply With Quote #16

i'll buy you one for getting it to work.

only problem i see so far is if you switch an engineer,his buildings remain.

Last edited by 3_stooges_geo; 07-03-2009 at 10:11.
3_stooges_geo is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-03-2009 , 10:22   Re: [TF2]switch a players class
Reply With Quote #17

Okay I changed the OP once more, now if you switch a players class he will be forced to respawn so his buildings / weapons / model etc reload and stuff.
Gachl is offline
3_stooges_geo
Member
Join Date: Jul 2008
Location: Blackwood,New Jersey
Old 07-03-2009 , 10:37   Re: [TF2]switch a players class
Reply With Quote #18

buildings still remain
3_stooges_geo is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-03-2009 , 11:12   Re: [TF2]switch a players class
Reply With Quote #19


well now I have no idea what to do.
I don't know how to get all buildings by a player, also I don't know how to loop through every entity so I could find all buildings by a player, neither do I know how to destroy them if I found them, maybe someone else knows it and can adjust my code
Gachl is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-03-2009 , 11:30   Re: [TF2]switch a players class
Reply With Quote #20

Quote:
Originally Posted by Gachl View Post
I used TF2_GetClass(yourInput), I have no idea what valid input is but the list of tsunami looks quite okay ^^
edit: btw where could I look it up?
I don't think there's any documentation about it, but I copied it straight from SM's TF2 extension (which adds the TF2_* commands to SM). It's C++, so if you don't know that it might be tricky to figure it out
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:08.


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