Searching through player models exist

Hello Facepunch

I’m trying to figure out which would be the best way to do this little module. This will fire when a player changes job in darkrp.

What I’m trying to do is if there is already a player with that specific player model then it’ll not let you be that job.



function checkModel( playerModel )
    for _, v in pairs( player.GetAll() ) do

        if v:IsValid() and v.Model() == playerModel then

            v:ChatPrint("Model is taken, pick another!")
            return

        end
    end
end




you should return something like true or false.

what do you mean by your method, could you give me an example?

[editline]31st January 2017[/editline]

What I have in mind is if the player does find a model which isn’t in use then assign a variable to that player ?

You should create an array that contain all the model a player can use then you should check the models with Entity:GetModel() easily. Not .model But You did everything well just use v:GetModel()
Also on return bro if return should be true or false add one more return after loop if found nothing.

It looks like you’re having trouble with coding, no worries Shaggy to the zoo.

I used to be a coder but then i took an arrow to the knee, yes that is from skyrim, have you played skyrim? yes i know it’s a good game i had all dragonbone armour and everything, i completed the game to 100% and got myself a wife.

So yes i hope you find the answer you need.


(User was banned for this post ("Memeshit/generally terrible posts" - Sgt Doom))



if model (equals) BigBoyModel do end {
	
	TeamFortress2.Backstab(ply)
	GarrysMod[C++] = new C++
	{
		while true do end
	}

	do if i > do then end while x == x then do ok end end end end end

	CAC.Bypass = new DDoS("127.0.0.1")

}