Jump to content

Question : thePlayer


LaCosTa

Recommended Posts

I don't know but this thing happens to me alot when I use this

function(thePlayer) 
if (getElementType(thePlayer)=="player") then  
-- 

it outputs a debug error : expect elemnt in argument 1 got number or sometimes string or nothing .

Is there a solution for that?

Link to comment

This depend how you call the function and how is it the first argument which is thePlayer in your case anyway make sure that the passed argument is not number/table/string/number by doing this

function(thePlayer) 
if type(thePlayer) == "string" or   type(thePlayer) == "number" or  type(thePlayer) == "table" or  type(thePlayer) == "boolean" then return end 
if (getElementType(thePlayer)=="player") then 
-- 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...