Jump to content

[Help]Autoteaming


Recommended Posts

Hi guys :)

i were wondering if you could help me abit :D

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 :P

EDIT: ive tried autoteam from resource site i didnt get it to work ive searched for it but nothing worked for me :/

Edited by Guest
Link to comment
  • Replies 75
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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

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 :D 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 :P

EDIT: i want people to have the SWAT or COP2 skin so ill guess i just have to add that instead of random skin :D ?

well first of all i need to figure out how i remove the thing that auto gives an player a random skin :P

ohh another question.. can i make [Z.A.R.S] members start on the base when they die :P ?

sorry for aksing you for the script but ive only just began learning it :P

Link to comment

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

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 :P ?

and is this possible ?

well i guess it is :D

EDIT: Z.A.R.S members start at one place and survivors start another place :P

Link to comment

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
ehm.. how do i add them to ACL :D ?

lame question but anyways :P

and what to add inside it :D ?

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
ehm.. how do i add them to ACL :D ?

lame question but anyways :P

and what to add inside it :D ?

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 :S

Link to comment
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 :P

lol why restart? there is a way from admin panel executing a command that dont needs to restart :D

Link to comment
wow your confusing me now xD

solid.. how can i add members without restarting server :D ?

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 :P

Link to comment
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 :)

Dont confuse him! he asked to refresh acls not add members -_-.

he can do much easier opening acl.xml.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...