mcer Posted July 25, 2012 Share Posted July 25, 2012 (edited) I'm doing a script to add spawnpoints in my server, which is a special spawnpoint for each team but does not work correctly. Please help me -- Cordenadas de los supervivientes local Policial, PolicialY, PolicialZ = 2243.29296875, 2499.4787597656, 10.8203125 local MilitarX, MilitarY, MilitarZ = 223, 1878, 18 -- Armas Policiales y Militares local joinWeapon = 1 local joinAmmo = 1 local joinWeapon2 = 45 local joinAmmo2 = 1 local amount = 300 -- Apariencia de los supervivientes local SkinPolicial = {"71","163","164","165","166","265","266","267","280","281","282","283","284","285","286","288"} local SkinCivil = {"33","34","44","128","132","133","158","159","160","161","200","202","236","261","182"} local SkinMilitar = {"312","301","79","179","287","101"} -- Aparecer Configuracion del Script function spawnOnJoin(playerSource) spawnPlayer(source, PolicialX+math.random(-1,1), PolicialY+math.random(-1,1), PolicialZ, 180) setElementModel(source, SkinPolicial[math.random(1, #SkinPolicial)]) givePlayerMoney (source, amount) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox(joinMessage, source) giveWeapon(source, joinWeapon, joinAmmo) giveWeapon(source, joinWeapon2, joinAmmo2) end -- Event handlers addEventHandler ("onPlayerJoin", getRootElement(), spawnOnJoin) function whatTeamAmIOn ( source ) -- Get the player's team (source is the player who entered the command) local playerTeam = getTeamName ( source ) if ( playerTeam ) then -- if he was on a team setElementPosition ( source, getTeamName(playerTeam), 2499.4787597656, 10.8203125 ) else outputChatBox ( getPlayerName ( source ) .. " isn't on a team" ) end end -- Add console command to find your team when 'whatTeamAmIOn' is typed. addCommandHandler ( "what", whatTeamAmIOn ) Edited July 26, 2012 by Guest Link to comment
Jaysds1 Posted July 25, 2012 Share Posted July 25, 2012 you forgot the X at the end of Policial. and please change the code to lua. Link to comment
mcer Posted July 26, 2012 Author Share Posted July 26, 2012 Ok thanks, but check this out, it is assumed that this script should appear to users according to how you call your team. function whatTeamAmIOn ( source ) -- Get the player's team (source is the player who entered the command) local playerTeam = getTeamName ( source ) if ( playerTeam ) then -- if he was on a team setElementPosition ( source, getTeamName(playerTeam), 2499.4787597656, 10.8203125 ) else outputChatBox ( getPlayerName ( source ) .. " isn't on a team" ) end end -- Add console command to find your team when 'whatTeamAmIOn' is typed. addCommandHandler ( "what", whatTeamAmIOn ) Link to comment
Castillo Posted July 26, 2012 Share Posted July 26, 2012 Topic moved to: "Scripting" section. @On topic: To check if a player is on a team you must use the function: getPlayerTeam, getTeamName just obtains the name from a team element which is what getPlayerTeam returns. Link to comment
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