Jump to content

Spawning Player help


Guest Mkc

Recommended Posts

Posted

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 :)

Posted

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.

Posted

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

Posted

ah, thank you that worked perfectly :D

sorry to be a bother but im having some problems with spawnVehicle.

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

from what ive read http://development.mtasa.com/index.php? ... awnVehicle i seem to be doing it right :?

Posted
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

Posted

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"

Posted
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

Posted

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

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