Jump to content

Won't Spawn


Bean666

Recommended Posts

hi guys , i have a problem in my spawn script , it all works fine , when i press a button it sets my team , and puts a text in chatbox , but the problem is my player doesnt spawn , i did debugscript , no errors tho , here's my code , whats the problem plz any help appreciated.

Code:

client.lua

GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {}, 
    memo = {} 
} 
        GUIEditor.window[1] = guiCreateWindow(348, 208, 541, 448, "Spawn Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.76) 
        guiSetVisible(GUIEditor.window[1], false) 
        GUIEditor.button[1] = guiCreateButton(31, 65, 107, 45, "Military", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(215, 65, 107, 45, "Survivors", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(398, 65, 107, 45, "Rebels", false, GUIEditor.window[1]) 
        GUIEditor.button[4] = guiCreateButton(31, 170, 107, 45, "Bravo Team", false, GUIEditor.window[1]) 
        GUIEditor.button[5] = guiCreateButton(215, 170, 107, 45, "Alpha Team", false, GUIEditor.window[1]) 
        GUIEditor.button[6] = guiCreateButton(398, 175, 107, 45, "Umbrella Corp", false, GUIEditor.window[1]) 
        GUIEditor.memo[1] = guiCreateMemo(30, 249, 485, 189, "Spawn By Clicking a Button \nAllies\nMilitary\nAlpha Team\nSurvivors\nBravo Team\nHostiles\nRebels\nUmbrella Corp", false, GUIEditor.window[1]) 
        guiMemoSetReadOnly(GUIEditor.memo[1], true) 
        GUIEditor.label[1] = guiCreateLabel(398, 225, 133, 17, "Spawn Panel By Shaman ", false, GUIEditor.window[1])     
  
 addEventHandler("onClientGUIClick",GUIEditor.button[1],function() 
        if ( source == GUIEditor.button[1]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setmilitary",getLocalPlayer(),getLocalPlayer()) 
        end 
    end ) 
    
    addEventHandler("onClientGUIClick",GUIEditor.button[2],function() 
    if ( source == GUIEditor.button[2]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setSurvivor",getLocalPlayer(),getLocalPlayer()) 
        end 
    end )  
    
    addEventHandler("onClientGUIClick",GUIEditor.button[3],function() 
    if ( source == GUIEditor.button[3]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setrebels",getLocalPlayer(),getLocalPlayer()) 
        end 
    end ) 
    
    addEventHandler("onClientGUIClick",GUIEditor.button[4],function() 
    if ( source == GUIEditor.button[4]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setbravo",getLocalPlayer(),getLocalPlayer()) 
        end 
    end ) 
    
    addEventHandler("onClientGUIClick",GUIEditor.button[5],function() 
    if ( source == GUIEditor.button[5]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setalpha",getLocalPlayer(),getLocalPlayer()) 
        end 
    end )  
    
    addEventHandler("onClientGUIClick",GUIEditor.button[6],function() 
    if ( source == GUIEditor.button[6]) then 
           guiSetVisible(GUIEditor.window[1], false) 
           showCursor(false) 
           triggerServerEvent("setumbrella",getLocalPlayer(),getLocalPlayer()) 
        end 
    end )  
    
addEvent("showGUI", true) 
function guishow(player) 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
end 
addEventHandler("showGUI",getRootElement(),guishow) 

server.lua

function onlogin() 
  triggerClientEvent(source, "showGUI", source) 
end 
addEventHandler("onPlayerLogin", getRootElement(), onlogin) 
  
function createSurvivorTeam () 
    SurvivorTeam = createTeam ("Survivors", 255, 200, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSurvivorTeam) 
  
function createMilitaryTeam () 
    MilitaryTeam = createTeam ("Military", 0, 200, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createMilitaryTeam) 
  
function createRebelsTeam () 
    RebelsTeam = createTeam ("Rebels", 150, 150, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createRebelsTeam) 
  
function createAlphaTeam () 
    AlphaTeam = createTeam ("Alpha Team", 60, 50, 60) 
end 
addEventHandler ("onResourceStart", resourceRoot, createAlphaTeam) 
  
function createBravoTeam () 
    BravoTeam = createTeam ("Bravo Team", 255, 0, 170) 
end 
addEventHandler ("onResourceStart", resourceRoot, createBravoTeam) 
  
function createUmbrellaTeam () 
    UmbrellaTeam = createTeam ("Umbrella Corp", 255, 0, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createUmbrellaTeam) 
  
function joinSurvivor() 
     setPlayerTeam(source,SurvivorTeam) 
    setPlayerNametagColor ( source, 255, 200, 0 ) 
     setElementModel(source,127) 
      spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0,127, 0, 0) 
     outputChatBox("You have chosen to be a Survivor!",source,255,200,0) 
end 
addEvent("setSurvivor", true) 
addEventHandler("setSurvivor",root,joinSurvivor) 
  
function joinMilitary() 
     setPlayerTeam(source,MilitaryTeam) 
     setPlayerNametagColor ( source, 0, 200, 0 ) 
     setElementModel(source,287) 
     spawnPlayer (source, -1023.4560546875, -999.53515625, 129.21264648438, 0,287, 0, 0) 
      outputChatBox("You have chosen to be a Military!",source,0,200,0) 
end 
addEvent("setmilitary", true) 
addEventHandler("setmilitary",root,joinMilitary) 
  
function joinRebels() 
     setPlayerTeam(source,RebelsTeam) 
     setPlayerNametagColor ( source, 150, 150, 0 ) 
     setElementModel(source,127) 
      spawnPlayer (source, -1023.4560546875, -999.53515625, 129.21264648438, 0,127, 0, 0) 
      outputChatBox("You have chosen to be a Rebel!",source,150,150,0) 
end 
addEvent("setrebels", true) 
addEventHandler("setrebels",root,joinRebels) 
  
function joinAlpha() 
     setPlayerTeam(source,AlphaTeam) 
     setPlayerNametagColor ( source, 60, 50, 60 ) 
     setElementModel(source,287) 
     spawnPlayer (source, -1023.4560546875, -999.53515625, 129.21264648438, 0,287, 0, 0) 
      outputChatBox("You have chosen to be an Alpha Team Soldier!",source,60,50,60) 
end 
addEvent("setalpha", true) 
addEventHandler("setalpha",root,joinAlpha) 
  
function joinBravo() 
     setPlayerTeam(source,BravoTeam) 
     setPlayerNametagColor ( source, 255, 0, 170 ) 
     setElementModel(source,287) 
     spawnPlayer (source, -1023.4560546875, -999.53515625, 129.21264648438, 0,287, 0, 0) 
      outputChatBox("You have chosen to be an Bravo team Soldier!",source,255,0,170) 
end 
addEvent("setbravo", true) 
addEventHandler("setbravo",root,joinBravo) 
  
function joinUmbrella() 
     setPlayerTeam(source,UmbrellaTeam) 
     setPlayerNametagColor ( source, 255, 0, 0 ) 
    setElementModel(source,284) 
     spawnPlayer (source, -1023.4560546875, -999.53515625, 129.21264648438, 0,284, 0, 0) 
      outputChatBox("You have chosen to be an Umbrella Corp!",source,255,0,0) 
end 
addEvent("setumbrella", true) 
addEventHandler("setumbrella",root,joinUmbrella) 
  
function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) 
local x, y, z = 213.7412109375, 1868.505859375, 13.140625 -- Default position 
local team = getPlayerTeam ( source ) 
if ( team ) then 
    local teamName = getTeamName ( team ) 
    if ( teamName == "Military" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    elseif ( teamName == "Survivors" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    elseif ( teamName == "Rebels" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    elseif ( teamName == "Umbrella Corp" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    elseif ( teamName == "Bravo Team" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    elseif ( teamName == "Alpha Team" ) then 
        x, y, z = -1023.4560546875, -999.53515625, 129.21264648438 
    end 
end 
setTimer ( spawnPlayer, 3000, 1, source, x, y, z, 0, getElementModel ( source ), 0, 0, team ) 
setTimer ( outputChatBox, 3000, 1, "You Have Died! Do Better Next Time!",source, 0, 200, 0, false) 
end 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 

Edited by Guest
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...