Комментарии:
Do you know how to decrypt lua?
Ответитьi did the exact same code as you, but it didnt work.
Ответить+Parsa Rahimi Thanks a lot! the function varriables (also called arguments) are attached to the event handler itself there is a whole episode about functions and another one about event handlers anyway thePlayer is the player that typed the command and vehicleModel is the number followed by the command e.g: /createvehicle 455 so 455 is the vehicleModel
ОтветитьThat's great episode.. :D Thank you very much :D
ОтветитьEXCELLENT JOB, though your accent bothers me... start talking about functions because some of them are very confusing which I found on mtasa tutorial website like this one:
function createVehicleForPlayer(thePlayer, command, vehicleModel) <<<WHY WOULD YOU DEFINE 3 VARIABLES WHY ITS NO USE?
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)
keep it up
ОтветитьNice one
ОтветитьGJ
Ответитьgood job 😄
Ответить