Author Topic: playertype change function  (Read 5219 times)


I can't help you further I'm afraid. While i can guesstimate what you might be doing wrong, i have extremely little experience with playertypes and datablocks, so i can't be a reliable source for information.


Your other team is using a different model, so create a new slightly faster playertype that uses that model. Then on your function you will need to figure out if the player is on one team or another. If you don't plan on changing your slayer/team settings, then start a server and join one team. Do echo(findClientByName("Your Name").getTeam()); and take down the first result. Then join the other team and do the same. This will give you both the team names that you will need.

Then you go back to your mount function where you set the new datablock and add an if/else block, that looks something like:
Code: [Select]
function KarambitImage::onMount(%this, %obj, %slot)
{
   if(%obj.client.team $= "First Team")
   {
      %obj.setDatablock("First Team Datablock");
   }
   else if(%obj.client.team $= "Second Team")
   {
      %obj.setDatablock("Second Team Datablock");
   }
   else
   {
      return error("Improper teams for this add-on");
   }
   %obj.hideNode("rHand");
}

I may be mistaken if the teams are set on the clients, or the players. I believe it's the clients though.

Well i did that on the console and i got a 5 digit number for each team but every time i restart the server those digits change and now the karambit isn't apearing when i'm searching for it

Well i did that on the console and i got a 5 digit number for each team but every time i restart the server those digits change and now the karambit isn't apearing when i'm searching for it
That's because %client.team is a script object or whatever for that team. So the team name would probably be %client.team.name.

So how can i check my team name ?


Yeah but what to right on console ?

i still cannot figure what's the team names every time i try i get an error on the console

Okay, let's do a rundown of this:
So your team name is:
%client.team.name

%client is your target
.team specifies the slayer team
and .name is the defined name

You would define a %client by something like findclientbyname("slimshady")
So
findclientbyname("slimshady").team.name would be the name of the team you're in
To express it visually, you should use the talk(); function
So
talk(findclientbyname("slimshady").team.name);


The talk function puts it in the chat, so if you do that you have to check the chat after the it gets put in the console. Or you can just do echo instead.
Echo(FindClientByName("Slim").getTeam().name);

In the code you should also check if the client with getTeam() exists, that way there are no errors in the console.

allright it works i got the names :)