Guest Posted January 3, 2008 Share Posted January 3, 2008 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
ChrML Posted January 3, 2008 Share Posted January 3, 2008 Do a fadeCamera ( passedPlayer, true ) aswell . Players have their camera faded out by default. Link to comment
Guest Posted January 3, 2008 Share Posted January 3, 2008 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
norby89 Posted January 3, 2008 Share Posted January 3, 2008 --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
ChrML Posted January 3, 2008 Share Posted January 3, 2008 Yep, didn't see that, sorry. "source" is the element that the event was triggered on. For onPlayerJoin, http://development.mtasa.com/index.php? ... PlayerJoin , the source is the player that joined. See information about the event system here: http://development.mtasa.com/index.php?title=Event Link to comment
Guest Posted January 3, 2008 Share Posted January 3, 2008 ah, thank you that worked perfectly 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 Link to comment
norby89 Posted January 3, 2008 Share Posted January 3, 2008 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
Guest Posted January 3, 2008 Share Posted January 3, 2008 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
norby89 Posted January 3, 2008 Share Posted January 3, 2008 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
ChrML Posted January 3, 2008 Share Posted January 3, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now