wait, you get the vehicle model from the vehicle name of the vehicle element?
all that can be summed up in getElementModel(getPedOccupiedVehicle(source))
To get the players vehicle model: getElementModel (vehicle)
getVehicleModelFromName takes vehicle name as argument, not the player vehicle model.
Use the function I mentioned above to retrieve model from a vehicle element, else use getVehicleModelFromName ('vehicleName') if you have the name
Aiboforcen is russian I think, you can ask in the russian section instead, currently a standard mind can barely comprehend the meaning of your request son
Nice! That was absolutely awesome!
I didn't expect MTA to reach top 5, top 10 would be a big achievement but within top 5 mods of 2010.. whoa
Keep up the legendary work!
Assuming you're logged in as admin, hit 'P', go to 'Resources', and in the field below 'Execute command:', type in setFPSLimit (yourLimit), to change it without a server restart.
As Oz said, it's 36 by default and on.
it return the count or only the players name?
it returns a table of all the alive player elements
to get the count:
alivePlayersCount = #getAlivePlayers()
to get names in a table:
function getAlivePlayerNames()
local alivePlayers = getAlivePlayers()
local playerNames = {}
for i, v in ipairs (alivePlayers) do
table.insert (playerNames, getPlayerName(v))
end
return playerNames
end
MTA doesn't have any functionality that deal with native SA objects, and neither does the game itself, it seems.
As cool as this would be as hard it would be, I think.
i dont even
you can't create a tornado in MTA that doesn't look like shit. Import a tornado-looking model and make it spin like shit, and destroy stuff around it. It's the closest you get
I bet you're right
use a dynamic array instead
local playerData = {}
function getPlayerVehicle (player)
if playerData[player] then
return playerData[player].vehicle -- maybe you can just return this, but dunno if it triggers error
else
return nil
end
end
function createPlayerData (player)
if playerData[player] then
return
end
playerData[player] = {}
end
function destroyVehicle (player)
if playerData[player] then
if playerData[player].vehicle then
destroyElement (playerData[player].vehicle)
playerData[player].vehicle = nil
else
return false
end
end
end
where player gets his vehicle, do this:
destroyVehicle (player)
playerData[player].vehicle = createVehicle (...)
and call createPlayerData when he enters shop or similar
That example deletes all cars on the server, prolly now what you want
You need to store the vehicle element
function deletePlayerCar (player)
local player = player or source
local veh = getElementData (player, 'veh') -- get the vehicle element for the player stored under 'veh'
if (getElementType (veh) == 'vehicle') then -- if it's a vehicle
destroyElement (veh) -- destroy it
end
end
addEventHandler ('onPlayerQuit', root, deletePlayerCar) -- when he leaves
-- ...
so when player buys a new car: call function deletePlayerCar before he buys new one