Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TeamData = {}--Respawns,SpawnPoint,Resources,Objectives
- PlayerData = {}--PeerID,Team,Role
- function onPlayerJoin(steam_id, name, peer_id, is_admin, is_auth)
- server.notify(peer_id,"Operation","to join a team, say '?Join (team)'",1)
- PlayerData[#PlayerData + 1] = {peer_id,0,"rct"}
- end
- function onPlayerRespawn(peer_id)
- PlayerAction(peer_id,"respawn")
- end
- function onPlayerLeave(steam_id, name, peer_id, is_admin, is_auth)
- PlayerAction(peer_id,"remove")
- end
- function PlayerAction(peer_id,action,a,b,c)
- I = FindPlayer(peer_id)
- if action == "join" then PlayerData[I] = {peer_id,a,b} elseif action == "remove" then PlayerData[I] = nil elseif action == "respawn" then if TeamData[1][PlayerData[I][2] ~= -1 then TeamData[1][PlayerData[I][2]] = TeamData[1][PlayerData[I][2]] - 1 end server.setPlayerPos(peer_id, TeamData[2][PlayerData[I][2]]) end
- end
- function FindPlayer(peer_id)
- I = 0
- for i = 1, #PlayerData do
- if PlayerData[i][1] == peer_id then I = i end
- end
- return I
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement