Results 1 to 7 of 7

Thread: Moving a player to spec

  1. #1
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts

    Moving a player to spec

    Hi
    I have a quick question.
    I'm trying to improve an anticamp script i use on my server. What i want to add is that if the player gets for instance 2 camping penalties then move him to spectators. But i don't know what command to use to move player to spec. If someone knows please help.
    Thanks

  2. The Following User Says Thank You to agribilos For This Useful Post:

    kung foo man (14th February 2021)

  3. #2
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Code:
    moveplayer(team)
    {
        self.pers["team"] = team;
        self.sessionteam = self.pers["team"];
        self.pers["weapon"] = undefined;
        self.pers["savedmodel"] = undefined;
        self setClientCvar("ui_allow_weaponchange", "1");
        if (self.sessionstate!="dead") 
    	{
    		self.sessionstate = team;
    		self suicide();     
    	}
        self notify("joined_team");
        self notify("end_respawn");
        maps\mp\gametypes\dm::spawnSpectator();
    }
    Ok i managed to do it modifying a code i found on this forum. It does the job but it doesn't work 100% correctly. When the player is moved to spectator and then tries to rejoin the options "autoassing" and the previous team are grayed out. So i guess it is not moved properly to spectator. Any idea how to fix this?

  4. #3
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    PHP Code:
    self [[level.spectator]](); 
    sudo apt-get rekt

  5. The Following 3 Users Say Thank You to voron00 For This Useful Post:

    agribilos (13th February 2021),kung foo man (14th February 2021),Mitch (13th February 2021)

  6. #4
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Thank you but the problem still exists. It shows me as spectator on the scoreboard but i can still see my score. So i guess it does not properly leave the team.
    Code:
    moveplayer(team)
    {
        self.pers["team"] = team;
        self.sessionteam = self.pers["team"];
        if (self.sessionstate!="dead") 
    	{
    		self.sessionstate = team;
    		self suicide();  
    		self [[level.spawnSpectator]]();	
    		self [[level.spectator]](); 
    		self notify("joined_spectators");		
    	}
    
    }
    shot0001.jpg
    shot0000.jpg

  7. The Following User Says Thank You to agribilos For This Useful Post:

    kung foo man (14th February 2021)

  8. #5
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Not like this, self [[level.spectator]](); is all you need to move player to spec.

    PHP Code:
    moveplayer()
    {
        
    self [[level.spectator]]();     

    sudo apt-get rekt

  9. The Following 2 Users Say Thank You to voron00 For This Useful Post:

    agribilos (13th February 2021),kung foo man (16th February 2021)

  10. #6
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Quote Originally Posted by voron00 View Post
    Not like this, self [[level.spectator]](); is all you need to move player to spec.

    PHP Code:
    moveplayer()
    {
        
    self [[level.spectator]]();     

    Yes i tried it also but it didn't work.. If i remember correctly what it did was to move the player in spectators at the scoreboard only but the player itself was left ingame and invulnerable. I'll have a look again tomorrow because now i'm too tired to think.

  11. #7
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Code:
    			self [[level.spawnSpectator]]();
    			self [[level.spectator]](); 
    			self notify("joined spectators");
    Ok i finally got it to work. I also had to set the function pointer "level.spawnSpectator = ::spawnSpectator;" in my gametype gsc.

  12. The Following User Says Thank You to agribilos For This Useful Post:

    kung foo man (16th February 2021)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •