Jump to content

Spawning Player help


Guest Mkc

Recommended Posts

hi, ive got:

function PlayerJoin ( passedPlayer ) 
  spawnPlayer ( passedPlayer, -2336.2847,-1614.5179,483.7172, 0.0, 0) 
  outputChatBox( "SERVER: Welcome to DFSFv3 - MTAdm Chilliad test", p, 255, 100, 100 ) 
end 

PlayerJoin IS being called as the chat message appears... but no spawning, the screen just stays black. It gives me this warning when i try and join:

Bad Argument @ 'spawnPlayer' - line 5

line 5 is the line of the spawnPlayer function. thanks :)

Link to comment

thank you ChrML, but with this

--PLAYERJOIN 
function PlayerJoin ( passedPlayer ) 
  spawnPlayer ( passedPlayer, -2336.2847,-1614.5179,483.7172, 0.0, 0) 
  fadeCamera ( passedPlayer, true ) 
  outputChatBox( "SERVER: Welcome to DFSFv3 - MTAdm Chilliad test", p, 255, 100, 100 ) 
   
end 
addEventHandler ( "onPlayerJoin", getRootElement(), PlayerJoin ) 

it still stays on the black screen and gives 2 warnings (Both Bad argument)

Thanks.

Link to comment

--PLAYERJOIN 
function PlayerJoin ( passedPlayer ) 
  spawnPlayer ( source, -2336.2847,-1614.5179,483.7172, 0.0, 0) 
  fadeCamera ( source, true ) 
  outputChatBox( "SERVER: Welcome to DFSFv3 - MTAdm Chilliad test", source, 255, 100, 100 ) 
   
end 
addEventHandler ( "onPlayerJoin", getRootElement(), PlayerJoin ) 

try this

Link to comment
example of line: spawnVehicle(539,-2247.9392,-1725.0338,479.5452,40.9806, 0.0, 0.0)

error: [17:36:47] WARNING: DFSFv3.lua: Bad 'element' pointer @ 'spawnVehicle'(1) - Line: 186

use createVehicle ( 539,-2247.9392,-1725.0338,479.5452,40.9806, 0.0, 0.0) ;)

spawnVehicle is used to respawn an already existing vehicle, for example:

monter = createVehicle ( 444, 0, 0, 4 )

spawnVehicle ( monster, 1000, 2000, 10 ) <- this function would spawn the monster to a different location

Link to comment

yes, i tried create vehicle before, but for some reason it spawns hundreds of the same vehicle. my vehicles are placed in a function that is called with the event "onResourceStart"

Link to comment
yes, i tried create vehicle before, but for some reason it spawns hundreds of the same vehicle. my vehicles are placed in a function that is called with the event "onResourceStart"

you got addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), yourFunction )? else it creates a vehicle every time a resource is loaded

Link to comment

Yeah, onResourceStart triggers every time a resource is loaded. If you attach the eventhandler to the resource root element rather than the global root element, it only triggers when the current resource is loaded, and thus only once :).

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