bosslorenz Posted January 4, 2015 Posted January 4, 2015 Need help in creating a script to choose team command, no GUI only keys like (F1,F2,F3) to choose team and camera on sky if player not chosed a team yet. Is it possible without a GUI created ?
Dealman Posted January 4, 2015 Posted January 4, 2015 setCameraMatrix spawnPlayer createTeam setPlayerTeam bindKey
bosslorenz Posted January 4, 2015 Author Posted January 4, 2015 You need to explain yourself better. Its like press F1 to choose Team1,Spawnpoint1,Guns1 and press F2 to choose Team2,spawnpoint2,Guns2
xeon17 Posted January 4, 2015 Posted January 4, 2015 Dealman gave you the functions which you need to create that , if you get problems post what you tried and we will help you.
bosslorenz Posted January 4, 2015 Author Posted January 4, 2015 Im not asking for the script lol. the one i said was just reply
bosslorenz Posted January 5, 2015 Author Posted January 5, 2015 Dealman gave you the functions which you need to create that , if you get problems post what you tried and we will help you. team1 = createTeam ( "Team A", 0, 255, 0 )team2 = createTeam ( "Team B", 200, 0, 100 ) setTeamFriendlyFire(pTeam, false) ############################################################### function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234,99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) ############################################################### function teamA () spawnPlayer (source, 0, 0, 5, 0, 68, 0, 0, team1) giveWeapon ( source, 31, 200 ) end end addEventHandler("onPlayerJoin", getRootElement(), teamA) ############################################################### function teamB () spawnPlayer (source, 0, 0, 5, 0, 212, 0, 0, team2) giveWeapon ( source, 27, 200 ) end end addEventHandler("onPlayerJoin", getRootElement(), teamB) I dont know where to put bindkey F1 for team1 and how to remove setCameraMatrix when players has chose team.
MisterQuestions Posted January 6, 2015 Posted January 6, 2015 You will need: bindKey setPlayerTeam spawnPlayer giveWeapon setCameraTarget setCameraMatrix You can use setCameraMatrix when join, set in to a place, and draw a text, that says something like press: "F1" for team x or "F2" for team y use spawnPlayer, giveWeapon on a function for spawning the player at base of team x or y, and you will use bindKey to that function.
bosslorenz Posted January 6, 2015 Author Posted January 6, 2015 You will need: bindKey setPlayerTeam spawnPlayer giveWeapon setCameraTarget setCameraMatrix You can use setCameraMatrix when join, set in to a place, and draw a text, that says something like press: "F1" for team x or "F2" for team y use spawnPlayer, giveWeapon on a function for spawning the player at base of team x or y, and you will use bindKey to that function. function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) teamA = createTeam ( "REBEL", 255, 0, 0) setTeamFriendlyFire ( REBEL, false ) function teamChoose () spawnPlayer ( source, 214, 1857, 13.10000038147, 0, 312, 0, 0, teamA ) giveWeapon ( source, 31, 200 ) end Can you help me guys, How can I make a bindkey "F1" for func (teamChoose) and after F1, the cameraMatrix fades. And another problem is my giveWeapon seems to give infinite ammo on player but on script, its only 200 ammo.
ViRuZGamiing Posted January 6, 2015 Posted January 6, 2015 Take a look at the example on the wiki; https://wiki.multitheftauto.com/wiki/BindKey
bosslorenz Posted January 6, 2015 Author Posted January 6, 2015 Take a look at the example on the wiki; https://wiki.multitheftauto.com/wiki/BindKey teamA = createTeam ( "REBEL", 255, 0, 0)setTeamFriendlyFire ( REBEL, false ) function teamChoose () spawnPlayer ( source, 214, 1857, 13.10000038147, 0, 312, 0, 0, teamA ) giveWeapon ( source, 31, 200 ) end bindKey ( source, "F1","down",teamChoose () ) Doesnt work
LaCosTa Posted January 6, 2015 Posted January 6, 2015 try this team1 = createTeam ( "Team A", 0, 255, 0 ) team2 = createTeam ( "Team B", 200, 0, 100 ) function setCameraOnPlayerJoin(player) player = getRandomPlayer() fadeCamera(player, true, 5) setCameraMatrix(player, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234,99.881813049316) bindKey(getRandomPlayer(),"F1","down", function (player) setPlayerTeam(player,team1) spawnPlayer (player, 0, 0, 5, 0, 68, 0, 0) giveWeapon ( player, 31, 200 ) setCameraTarget(player) end ) bindKey(getRandomPlayer(),"F2","down", function (player) setPlayerTeam(player,team2) spawnPlayer (player, 0, 0, 5, 0, 212, 0, 0) giveWeapon ( player, 27, 200 ) setCameraTarget(player) end ) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin)
Moderators IIYAMA Posted January 6, 2015 Moderators Posted January 6, 2015 @LaCosTa You are creating for every player his own functions. It isn't really necessary to give the garbage collector more work.
LaCosTa Posted January 6, 2015 Posted January 6, 2015 so how it should be, I'll be grateful if you fix it for me and bosslorenz
Moderators IIYAMA Posted January 6, 2015 Moderators Posted January 6, 2015 try this: team1 = createTeam ( "Team A", 0, 255, 0 ) team2 = createTeam ( "Team B", 200, 0, 100 ) local changeTeam = function (player,key) if key == "F1" then setPlayerTeam(player,team1) spawnPlayer (player, 0, 0, 5, 0, 68, 0, 0) giveWeapon ( player, 31, 200 ) elseif key == "F2" then setPlayerTeam(player,team2) spawnPlayer (player, 0, 0, 5, 0, 212, 0, 0) giveWeapon ( player, 27, 200 ) end setCameraTarget(player) end function setCameraOnPlayerJoin() fadeCamera(source, true, 5) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234,99.881813049316) bindKey(source,"F1","down",changeTeam) bindKey(source,"F2","down",changeTeam) end addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)
LaCosTa Posted January 6, 2015 Posted January 6, 2015 i did it like that on the first time it doesn't work cuz i didn't made if Key == F1 then so i tried that way , good thanks for correcting me
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