Jump to content

Help me plzz :(((


Recommended Posts

Posted

hi guys, i really need help from u. im a newbie to sript writing.im learnin it aat mta wiki. i read the instructions and following them but im stuck somewhere i dont know. here it is :

https://wiki.multitheftauto.com/wiki/Sc ... e_function

heres my code for script.lua :

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10

function joinHandler()

spawnPlayer(source, spawnX, spawnY, spawnZ)

fadeCamera(source, true)

setCameraTarget(source, source)

outputChatBox("Welcome to My Server", source)

end

addEventHandler("onPlayerJoin", getRootElement(), joinHandler)

function createVehicleforPlayer(thePlayer, command, vehicleModel)

local x,y,z = getElementPosition(thePlayer) -- get the position of the player

x = x + 5 -- add 5 units to the x position

local createdVehicle = createVehicle(tonumber(vehicleModel) ,x,y,z)

-- check if the return value was ''false''

if (createdVehicle == false) then

-- if so, output a message to the chatbox, but only to this player

outputChatBox("Failed to create vehicle." ,thePlayer)

end

end

addCommandHandler("createvehicle", createVehicleForPlayer)

but when i run mta server, i types start myserver, i get this kind of eror :

Start: Requested by Console

Initiating changemode from 'play'to 'myserver'

Start: Resource 'myserver' start was requested <>

stopping play

Stopping freeroam

starting myserver

SCRIPT ERROR : myserver\script.lua:10: '=' expected near 'getElementPosition'

ERROR : @mapmanager\mapmanager_main.lua:376 loading script failed: myserver\script.lua:10: '=' expected near 'getElementPosition' :pale::pale::pale:

Gamemode 'My Server' started

Start Resource : Resource 'myserver' started

:cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry::cry:

help me plz, i really want to learn :"(((

thnks guys for your precious time

Posted

Hi, welcome to our forums.

Can you use next time the lua tags?

[ lua]

[/lua ]

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 
function joinHandler() 
spawnPlayer(source, spawnX, spawnY, spawnZ) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
outputChatBox("Welcome to My Server", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), joinHandler) 
  
function createVehicleforPlayer(thePlayer, command, vehicleModel) 
local x,y,z = getElementPosition(thePlayer) -- get the position of the player 
local x = x + 5 -- add 5 units to the x position 
local createdVehicle = createVehicle(tonumber(vehicleModel) ,x,y,z) 
-- check if the return value was ''false'' 
if (createdVehicle == false) then 
-- if so, output a message to the chatbox, but only to this player 
outputChatBox("Failed to create vehicle." ,thePlayer) 
end 
end 
addCommandHandler("createvehicle", createVehicleForPlayer) 

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