Jump to content

Problem with spawnPlayer


papam77

Recommended Posts

Posted
function MG () 
local x = 384.7 
local y = 173.6 
local z = 1008.4 
  
  
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", getRootElement(), 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use /help for more informations.", getRootElement(), 255,255,255, true ) 
  
fadeCamera ( source, true ) 
spawnPlayer ( x, y , z , 0, 0, 3, 1) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), MG ) 

Hello i have this code but it doesn't spawn me at position defined by me, where is problem?

Server says: spawnPlayer bad Argument

Posted

Bad 'player' pointer @ 'fadeCamera'(1)

Bad 'player' pointer @ 'spawnPlayer'(1)

Current code:

function MG ( source ) 
local x = 384.7 
local y = 173.6 
local z = 1008.4 
  
  
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", getRootElement(), 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use /help for more informations.", getRootElement(), 255,255,255, true ) 
  
fadeCamera ( source, true ) 
spawnPlayer ( source, x, y , z ) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), MG ) 

Posted
function MG ( ) 
local x = 384.7 
local y = 173.6 
local z = 1008.4 
  
  
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", getRootElement(), 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use /help for more informations.", getRootElement(), 255,255,255, true ) 
  
fadeCamera ( source, true ) 
spawnPlayer ( source, x, y, z ) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), MG ) 

Posted
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", source, 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use /help for more informations.", source, 255,255,255, true ) 

Posted

And here is problem:

function MG ( ) 
local x = 384.7 
local y = 173.6 
local z = 1008.4 
   
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", source, 255,255,255, true ) 
outputChatBox ("#ffffffDon't forget to visit our website [url=http://EAG-Gaming.eu/]http://EAG-Gaming.eu/[/url]., source, 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use #ff9900/help#ffffff for more informations.", source, 255,255,255, true ) 
  
  
fadeCamera ( source, true ) 
spawnPlayer ( source, x, y, z ) 
setElementInterior ( source, 3 ) 
setElementModel ( source, 240 ) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), MG ) 

When i login it doesn't spawn me it's only fade the camera and output the text nothing more and without error and warning.

Posted

function MG ( ) 
local x,y,z = 384.7, 173.6, 1008.4 
  
outputChatBox ("#ffffffWelcome on EAG| and |TSR| Server.", source, 255,255,255, true ) 
outputChatBox ("#ffffffDon't forget to visit our website [url=http://EAG-Gaming.eu/]http://EAG-Gaming.eu/[/url] .", source, 255,255,255, true ) 
outputChatBox ("#ffffffAre you new? Use #ff9900/help#ffffff for more informations.", source, 255,255,255, true ) 
  
  
fadeCamera ( source, true ) 
spawnPlayer ( source, x,y,z ) 
setElementInterior ( source, 3 ) 
setElementModel ( source, 240 ) 
end 
addEventHandler ("onPlayerLogin", getRootElement(), MG ) 
  

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Yes

function MGPED () 
setElementDimension ( John, 0 ) 
John = createPed (359.44141, 173.59044, 1008.37262, 90) 
setPedAnimation( John, "ped", "FF_Sit_Eat1") 
end 
addEventHandler ("onResourceStart", getRootElement(), MGPED ) 

And this doesn't create a ped everything is bad argument. Why ?

Posted
function MGPED () 
local John = createPed (90, 359.44141, 173.59044, 1008.37262, -90 ) 
setElementDimension ( John, 0 ) 
setElementInterior (John, 3 ) 
setTimer ( setPedAnimation, 500, 1, John, "ped", "FF_Sit_Eat1") 
end 
addEventHandler ("onResourceStart", getRootElement(), MGPED ) 

Nothing

Posted (edited)

Use resourceRoot instead of getRootElement(), unless you want to create the ped when any resource is started.

Try:

setPedAnimation(John, "ped", "FF_Sit_Eat1", -1, true, false) 

Edit: You have set the block argument wrong.

Try this:

function MGPED () 
local John = createPed (ID, 359.14141, 173.59044, 1008.37262, -90 ) 
setElementInterior (John, 3 ) 
setTimer(setPedAnimation, 90, 1, John, "FOOD", "FF_Sit_Eat1", -1, true, false) 
end 
addEventHandler ("onResourceStart", resourceRoot, MGPED ) 

Set the model ID.

Edited by Guest

Please do not PM me with scripting related question nor support, use the forums instead.

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