Hooks/Server/playerCanChangeTeam
How would I access the "return values" from this hook?
hook.Add("playerCanChangeTeam", "some_name", function(ply, teamnumber, forceboolean)
print(ply)
print(teamnumber)
print(forceboolean)
end)
you put in the function brackets the name that you want to refer too. like ply is the player, teamnumber is the teamnumber, the forceboolean is the boolean true or false.. AKA: return values
Yes, I understand that, but how would I access, "canChange" and "reason"?
That would be functions, wich i dont know..they should be listed in the darkrp wiki tho.
Yeah it's odd, the function is not listed in functions.
maybe be better to ask in the darkrp forum. since people there are more specialized in..darkrp
I did, however the forum is pretty inactive and nothing gets answered.
actually, you want to have a boolean if the player can change or not right? thats something the hook already returns in one of the parameters. and the reason too as a string
Oh so can you show me how to access it in a script?
actually no wait, i just realized, the boolean to say if he can change or not and the reason is something YOU return.
like
hook.Add("playerCanChangeTeam", "some_name", function(ply, teamnumber, forceboolean)
if teamnumber == 2 then
return true
end
end)
returns true if he can change, if the teamnumber is 2
Yeah I just realised this too ahahah, was about to reply.
Sorry, you need to Log In to post a reply to this thread.