Jump to content

New here :)


rocky168

Recommended Posts

Hi guys i downloaded MTA:SA yesterday and enjoyed playing alot! I am trying to setup a server, i have experience coding in sa-mp, vc-mp, lu and little apps and websites (many languages) so all i need to know is where to start and a place where i can get a good gamemode to start. thank you ;)

Link to comment

Thanks guys :), found this on wiki :-

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) 

Don't it require the vehiclemodel in addCommandHandler since createvehicleforplayer function has it?

Link to comment

no, there's only 2 addCommandHandler vars, one is for the command name and the other is for the function name,

so what ever the player types in after the command name is a var meaning it's the vehicleModel.

Example:

addCommandHandler("hey",function(source,_,sentence) 
     outputChatBox(getPlayerName(source).." said Hey, "..sentence) 
end) 

/hey wats up MTA Community?

Jaysds1 said Hey, wats up MTA Community?

Link to comment
no, there's only 2 addCommandHandler vars, one is for the command name and the other is for the function name,

so what ever the player types in after the command name is a var meaning it's the vehicleModel.

Example:

addCommandHandler("hey",function(source,_,sentence) 
     outputChatBox(getPlayerName(source).." said Hey, "..sentence) 
end) 

/hey wats up MTA Community?

Jaysds1 said Hey, wats up MTA Community?

If the player didn't input the vehiclemodel then it will return

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

right?

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