I need help for a copmode:
" -- Error here" is for die Errors
I have 2 Errors (saying the MTA Server Console)
-- Start of the Lua Script
function SetTheCops ( source, commandName )
setPlayerTeam ( source, copTeam )
setPedSkin ( source, 285 )
setPedArmor ( source, 100 )
setPlayerNametagColor ( source, 0, 0, 255 )
local x, y, z = getElementPosition ( source )
local angle = getPedRotation ( source )
local cop_vehicle = createVehicle ( 598, x, y, z )
setVehicleRotation ( cop_vehicle, 0, 0, angle )
warpPedIntoVehicle ( source, cop_vehicle )
setVehicleSirensOn ( cop_vehicle, true )
end
function SetTheGangster ( source_g, commandName )
if countPlayersInTeam ( gangTeam ) == 0 then
thegangster = source_g
setPlayerTeam ( source_g, gangTeam )
setPedSkin ( source_g, 107 )
setPedArmor ( source_g, 100 )
setPlayerNametagColor ( source_g, 255, 0, 0 )
local x_g, y_g, z_g = getElementPosition ( source_g )
local angle_g = getPedRotation ( source_g )
local vehicle_g = createVehicle ( 445, x_g, y_g, z_g )
setVehicleRotation ( vehicle_g, 0, 0, angle_g )
warpPedIntoVehicle ( source_g, vehicle_g )
outputChatBox ( thegangster .. " is the Gangster." ) -- Error here
else
outputChatBox ( "Don't can set the Gangster", getRootElement(), 255, 255, 255, true )
end
end
function GetTheGangster ( player_g, commandName )
if countPlayersInTeam ( gangTeam ) == 1 then
outputChatBox ( "The Gangster is " .. thegangster .. ".", getRootElement(), 255, 255, 255, true ) -- Error here
else
outputChatBox ( "We don't have a Gangster.", getRootElement(), 255, 255, 255, true )
end
end
function RemovePlayer ( player, commandName )
setPlayerTeam ( player, nil )
setPlayerNametagColor ( player, 0, 255, 0 )
outputChatBox ( "Set the Gang of none.", getRootElement(), 255, 255, 255, true )
end
function createTeamsOnStart()
copTeam = createTeam ( "Police" , 0, 0, 255 )
gangTeam = createTeam ( "Gangster", 255, 0, 0 )
setTeamColor ( copTeam, 0, 0, 255 )
setTeamColor ( gangTeam, 255, 0, 0 )
setTeamFriendlyFire ( copTeam, true )
setTeamFriendlyFire ( gangTeam, true ) -- No Colors in the Map
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart )
addCommandHandler ("police", SetTheCops)
addCommandHandler ("gangster", SetTheGangster)
addCommandHandler ("gangster_get", GetTheGangster)
addCommandHandler ("none", RemovePlayer)
-- End of the Lua Script