Jump to content

spawnPlayer problem


Recommended Posts

Posted

I have a spawn menu in DP2.3 that works fine. I have tried putting it onto aa test server in nightly but when I spawn as a class you just see the sky and nothing else. The code for one of the classes is below...

function spawncop ( message ) -- this one is cop 
spawnPlayer ( source, -1617.4661865234, 674.52569580078, 7.1875, -35, 280 ); 
fadeCamera ( source, true ); 
end 
addEvent( "spawncop", true ); 
addEventHandler( "spawncop", getRootElement(), spawncop ); 
  

Also the spawn GUI script is below

addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), 
    function ( ) 
        myWindow = guiCreateWindow ( 0.12, 0.1, 0.8, 0.8, "Twiva Spawn menu", true ) 
        button2 = guiCreateButton( 0.3, 0.1, 0.2, 0.1, "SFPD", true, myWindow ) 
        addEventHandler( "onClientGUIClick", button2, spawner2, false, myWindow ) 
    end 
) 
  
function spawner2 ( ) 
triggerServerEvent ( "spawncop", getLocalPlayer() ) 
end 

And the team settings are below

createTeam ( "Police", 0, 0, 255 ) 
function giveweps () 
local skin = getElementModel ( source ) 
if ( skin == 280 ) then 
local teamcop = getTeamFromName ( "Police" ) 
giveWeapon ( source, 3, 1 ) 
giveWeapon ( source, 29, 450 ) 
setPlayerTeam ( source, teamcop )    
end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), giveweps ) 

How can I make it so it actually spawns?

Posted

In nightly bulds (AKA 1.0) spawning players is more advanced than in DPs. If all you can see is the sky, it means the camera doesn't point at you, so you must change camera's target to yourself so camera can follow you.

http://development.mtasa.com/index.php? ... meraTarget

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...