Page 1 of 1

Give certain players custom models?

Posted: October 11th, 2012, 12:17 am
by MapTheGame
I want to make it in my map, so that if this certain person joins their character is a custom model I have imported for my map. is this possible?

Re: Give certain players custom models?

Posted: October 11th, 2012, 3:16 pm
by F |Madness| U
Yes it is possible, if you just run a check on each player when they connect or spawn to see if they have a matching xuid, you can change their model with

Code: Select all

player setModel("model_name");
I think.

Re: Give certain players custom models?

Posted: October 17th, 2012, 8:29 pm
by MapTheGame
F |Madness| U wrote:Yes it is possible, if you just run a check on each player when they connect or spawn to see if they have a matching xuid, you can change their model with

Code: Select all

player setModel("model_name");
I think.
Sorry, where would I add the GUID and the code? (I'm a beginner scripter)

Re: Give certain players custom models?

Posted: October 19th, 2012, 4:58 pm
by F |Madness| U
You would add code similar to this, in the maps.gsc file.

Code: Select all

init()
{
        level thread onPlayerConnect();
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill( "connected", player );
                player thread xuid_check();
                player thread onPlayerSpawned();
        }
}
 
xuid_check()
{
        if(self getxuid() == "xuid here" || self getxuid() == "another xuid here")//<-- different people having same model
        {
                self.custommodel = "custom model 1 here";
        }
        else if(self getxuid() == "player requiring different model xuid")
        {
                self.custommodel = "custom model 2";
        }
        else
}
 
onPlayerSpawned()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("spawned_player");
                self setModel(self.custommodel);
        }
}
I am not entirely sure if self setModel() works instantly, or if it has to be done before they spawn (or spawn and then die).

Re: Give certain players custom models?

Posted: October 19th, 2012, 10:23 pm
by MapTheGame
F |Madness| U wrote:You would add code similar to this, in the maps.gsc file.

Code: Select all

init()
{
        level thread onPlayerConnect();
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill( "connected", player );
                player thread xuid_check();
                player thread onPlayerSpawned();
        }
}
 
xuid_check()
{
        if(self getxuid() == "xuid here" || self getxuid() == "another xuid here")//<-- different people having same model
        {
                self.custommodel = "custom model 1 here";
        }
        else if(self getxuid() == "player requiring different model xuid")
        {
                self.custommodel = "custom model 2";
        }
        else
}
 
onPlayerSpawned()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("spawned_player");
                self setModel(self.custommodel);
        }
}
I am not entirely sure if self setModel() works instantly, or if it has to be done before they spawn (or spawn and then die).

Can you add me on xfire? I may need a little more help my xfire is, dynamicivjoel

Re: Give certain players custom models?

Posted: October 20th, 2012, 12:34 am
by F |Madness| U
Apparently I'm already friends with you- I will be happy to help when I'm available, but atm I tend to be pretty busy with university work.