Jump to content

What is so wrong in my script?


mcer

Recommended Posts

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 by Guest
Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...