gudenmike Posted July 6, 2010 Share Posted July 6, 2010 (edited) Hi guys i were wondering if you could help me abit i wanna create an autoteaming for mta (when you join and got a nametag in your name ([Z.A.R.S]) you will be putted on a team) well this is my code spawnTeam = createTeam ("[Z.A.R.S]", 0, 0, 255) -- Create team to spawn. function spawnOnLogin (prevA, curA, autoLogin) outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source, 255, 0, 0, false) spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 0, math.random (0,288), 0, 0, spawnTeam) -- spawns player with random skin fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerLogin", getRootElement(), spawnOnLogin) Ive tried that code it didnt work ;/ any hint about what i can do ? i SUCK at codeing but ive tried alittle EDIT: ive tried autoteam from resource site i didnt get it to work ive searched for it but nothing worked for me Edited July 6, 2010 by Guest Link to comment
DiSaMe Posted July 6, 2010 Share Posted July 6, 2010 The last line has a bracket which shouldn't be there. Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 Allright doomed when you say bracket you mean " ) " aight ? if that's it ive removed it Link to comment
DiSaMe Posted July 6, 2010 Share Posted July 6, 2010 Don't use math.random to get skin directly. It may return ID which doesn't have a skin defined in. It's better to make a table of available skins and use it. Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 well im not good at scripting but you can try this: local root = getRootElement() addEventHandler("onResourceStart", root, function() team = createTeam ("Z.A.R.S.", 0, 0, 255) end ) addEventHandler("onPlayerLogin", root, function() setPlayerTeam ( source, team) outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source) -- it will say it for the logged in player only spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5) -- spawns the player at the pos, with skin 0 fadeCamera (source, true) setCameraTarget (source, true) end ) it will just give you skin 0. im not known in the math.random's, but this is a start Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 maybe this would be better, i had a table with skins list that all works so i made math.random(0,264) that should work fine. local root = getRootElement() addEventHandler("onResourceStart", root, function() team = createTeam ("Z.A.R.S.", 0, 0, 255) end ) addEventHandler("onPlayerLogin", root, function() setPlayerTeam ( source, team) outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source) -- it will say it for the logged in player only spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, math.random(0,264), team ) -- spawns the player at the pos, with a random skin fadeCamera (source, true) setCameraTarget (source, true) end ) Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 well guys nice scripts but i were wondering how can i make it check if players have [Z.A.R.S] in their name ? and then they will be automoved if they have the tag in their name ? what commands should i use and could you maybe show me an example well the reason that ill need this is because im an admin on a zombie server and we're making it an rp so we need factions EDIT: i want people to have the SWAT or COP2 skin so ill guess i just have to add that instead of random skin ? well first of all i need to figure out how i remove the thing that auto gives an player a random skin ohh another question.. can i make [Z.A.R.S] members start on the base when they die ? sorry for aksing you for the script but ive only just began learning it Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 How exactly u want to detect? by somthing in the players account? or? Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 Well solid.. i want it to be like if people are in a group (maybe acl) they would be moved to the team but not just that people change there name and getting moved auto.. you understand what im trying to tell ? Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 ohh and if i dublicate this script for more teams will it work ? Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 wait i get his point! you can do a thing i use too, make teams! NOTE: YOU CANT SAVE TEAM DATA, so you have to work with team names i can make a small script for you that is easy to edit, you make a team, and if your an admin, it gets the admin team and you will spawn somewhere else ill get right on it matey Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 m4rsje well im trying to make a script that will start with the server and auto put people that's inside the acl into the teams you get what i mean ? and is this possible ? well i guess it is EDIT: Z.A.R.S members start at one place and survivors start another place Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 check this is like u wanted, local root = getRootElement() addEventHandler("onResourceStart", root, function() team = createTeam ("Z.A.R.S.", 0, 0, 255) end ) function login() local taccount = getPlayerAccount ( source ) if isZarAccount(taccount) then setPlayerTeam ( source, team) outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source) spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, math.random(0,264), team ) fadeCamera (source, true) setCameraTarget (source, true) else end end addEventHandler("onPlayerLogin", root,login) function isZarAccount(account) local nick = "" local group = aclGetGroup("[Z.A.R.S]") if (account and group) then nick = string.lower(getAccountName(account) or "") for _, object in ipairs(aclGroupListObjects(group) or {}) do if (gettok(object, 1, string.byte('.')) == "user") then if (nick == string.lower(gettok(object, 2, string.byte('.')))) then return true end end end end return false end actually checks if u in the acl group called "[Z.A.R.S]" if u are u will spawn etc and if u arent u wont spawn. Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 (edited) - (removed:P) Edited July 7, 2010 by Guest Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 ehm.. how do i add them to ACL ? lame question but anyways and what to add inside it ? Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 ehm.. how do i add them to ACL ?lame question but anyways and what to add inside it ? i guess you can start better with mine, its easyer to understand, and if you want to make a new acl team you have to restart the hole server (alot of work in my oppinion), you can better restart the resource, instead of the server Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 ehm.. how do i add them to ACL ?lame question but anyways and what to add inside it ? add that. "Snake" is the account name so will be like " u can add as many u want of course. and btw m4rsj, he asked for somthing that detects members not teams Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 yeah but you can detect players, in a team so you can change the teams, any time with admin pannel, instead of stopping the server, adding to acl, starting the server there is a small chance you lose ppl for that Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 yeah but you can detect players, in a team so you can change the teams, any time with admin pannel, instead of stopping the server, adding to acl, starting the server there is a small chance you lose ppl for that lol why restart? there is a way from admin panel executing a command that dont needs to restart Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 yeah thats true, what ever he wants ^^ Link to comment
gudenmike Posted July 6, 2010 Author Share Posted July 6, 2010 wow your confusing me now solid.. how can i add members without restarting server ? Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 wow your confusing me now solid.. how can i add members without restarting server ? edit the acl.xml add all what u want then DONT RESTART ANY RESOURCE/STOP then go admin panel tab "resources" and u will see there is a edit box that says "execute command" in the box u type aclReload() and click button "server" and is done Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 yes, in the normal admin pannel there is a button at server(if i remember it correctly , i made my own admin pannel), acl management. you can add groups, and members there Link to comment
Castillo Posted July 6, 2010 Share Posted July 6, 2010 yes, in the normal admin pannelthere is a button at server(if i remember it correctly , i made my own admin pannel), acl management. you can add groups, and members there Dont confuse him! he asked to refresh acls not add members . he can do much easier opening acl.xml. Link to comment
m4rsje Posted July 6, 2010 Share Posted July 6, 2010 lol he said: 'how can i add members without restarting server' ;P so we kinda got both right Link to comment
Recommended Posts