mjau Posted August 16, 2011 Posted August 16, 2011 Hi im working on my spawnmenu and now i want to make it set a player to a specific team when he spawns but i get bad arguments Heres the code wich should set the team function setTeam(player) setPlayerTeam ( player, Army_Rangers ) end addEvent( "giveTeam", true ) addEventHandler( "giveTeam", getRootElement(), setTeam ) And this is waht calls it function recruitSpawn(button,state) if button == "left" and state == "up" then triggerServerEvent("recruitMove",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) triggerServerEvent("giveweapon",getLocalPlayer()) triggerServerEvent("giveTeam",getLocalPlayer()) closeWindow() removecursor() end end
mjau Posted August 16, 2011 Author Posted August 16, 2011 What you mean it is the girst one the team is aleready created ingame by me Edit do i have to make the team in the script to ?
bandi94 Posted August 16, 2011 Posted August 16, 2011 local team =createTeam(Army_Rangers) function setTeam(player) setPlayerTeam ( player, team ) end addEvent( "giveTeam", true ) addEventHandler( "giveTeam", getRootElement(), setTeam )
mjau Posted August 16, 2011 Author Posted August 16, 2011 i aleready see some mistakes but ill fix and try
Castillo Posted August 16, 2011 Posted August 16, 2011 bandi, that makes no sense... createTeam has 4 arguments, teamName, red, green, blue.
mjau Posted August 16, 2011 Author Posted August 16, 2011 Still bad arguments ths is the code now armyteam = createTeam(Army_Rangers) function setTeam(player) setPlayerTeam ( player, armyteam ) end addEvent( "giveTeam", true ) addEventHandler( "giveTeam", getRootElement(), setTeam )
Castillo Posted August 16, 2011 Posted August 16, 2011 (edited) Of course that it makes bad arguments, you aren't creating the team at all. armyteam = createTeam("Army_Rangers", 255, 255, 255) function setTeam(player) setPlayerTeam ( player, armyteam ) end addEvent( "giveTeam", true ) addEventHandler( "giveTeam", getRootElement(), setTeam ) Oh, and, the client side is wrong, aren't passing the 'player'. function recruitSpawn(button,state) if button == "left" and state == "up" then triggerServerEvent("recruitMove",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) triggerServerEvent("giveweapon",getLocalPlayer()) triggerServerEvent("giveTeam",getLocalPlayer(),getLocalPlayer()) closeWindow() removecursor() end end Edited August 16, 2011 by Guest
mjau Posted August 16, 2011 Author Posted August 16, 2011 Tnx and just cuz i wanna learn why do i need 2 getlocalplayer on the second one ?
Castillo Posted August 16, 2011 Posted August 16, 2011 If you only put one, it'll send 'source', but not to the function (means example: function (source), that's wrong, 'source' won't appear in the function name).
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