addCommandHandler("putaspiketotheground", --
function(player, source)
if (player) then
local px, py, pz = getElementPosition ( player )
local rz = getPedRotation ( player )
local distance = 5
local x = distance*math.cos((rz+90)*math.pi/180)
local y = distance*math.sin((rz+90)*math.pi/180)
local b2 = 15 / math.cos(math.pi/180)
local nx = px + x
local ny = py + y
local nz = pz - 0.8
local provz = rz + 90
local spike = createObject ( 2892, nx, ny, nz, 0.0, 0.0, provz)
local x, y, z = getElementPosition(player)
local x2, y2, z2 = getElementPosition(spike)
local blow = createColSphere(x2, y2, z2, 3)
addEventHandler("onColShapeHit",blow,function (player)
if player and getElementType(player) == "player" then
local pveh = getPedOccupiedVehicle(player)
if isPedInVehicle(player) then
if (getTeamName(getPlayerTeam(player)) ~= "robber" then return false end
setVehicleWheelStates(pveh,1,1,1,1)
setVehicleColor( pveh, 247, 39, 157 )
end
end
end)
end
end)
I made this script, but i have an error :
WARNING: mypluginsfolder/myplugin.lua:line : Bad argument @ 'getPlayerTeam' [Excepted player at argument 1, got nil]
WARNING: mypluginsfolder/myplugin.lua:line : Bad argument @ 'getTeamName' [Excepted player at argument 1, got boolean]
--I got these errors from console