misterman66 Posted July 30, 2016 Posted July 30, 2016 Can someone tell me why I get the error of 'Bad argument @ getPlayerTeam line 5 & 10? Team = createTeam("Medics", 0, 255, 0) function createAmb(source) getcteam = getTeamFromName ( "Medics" ) getpteam = getPlayerTeam(source) if (getpteam == getcteam) then outputChatBox ("Sorry, but you are already employed as a medic!", source) else createVehicle (416, 1191.3876953125, -1325.90234375, 13.3984375) setPlayerTeam(source, team) outputChatBox ("You are now employed as a Medic, enter an ambulance to start your job!", source) end end addEvent("ambul", true) addEventHandler("ambul", root, createAmb) Thanks
Hale Posted July 30, 2016 Posted July 30, 2016 I believe it's because the source is the function that called the event, not the player. You must pass the correct parameters (the player) to the function and then use them.
misterman66 Posted July 30, 2016 Author Posted July 30, 2016 I believe it's because the source is the function that called the event, not the player. You must pass the correct parameters (the player) to the function and then use them. So I've tried different parameters but all with the same result!
Walid Posted July 30, 2016 Posted July 30, 2016 I believe it's because the source is the function that called the event, not the player. You must pass the correct parameters (the player) to the function and then use them. So I've tried different parameters but all with the same result! Try this local Team = createTeam("Medics", 0, 255, 0) function createAmb() local getpteam = getPlayerTeam(client) if (getpteam == Team) then outputChatBox ("Sorry, but you are already employed as a medic!", client) else createVehicle (416, 1191.3876953125, -1325.90234375, 13.3984375) setPlayerTeam(client, team) outputChatBox ("You are now employed as a Medic, enter an ambulance to start your job!", client,0,255,0) end end addEvent("ambul", true) addEventHandler("ambul", root, createAmb) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Walid Posted July 30, 2016 Posted July 30, 2016 Perfect, thank you! You are welcome. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now