Jump to content

Help - Script - Thank


damien111

Recommended Posts

I cant get this script to work here is the debugscript 3 error

ERROR: carjacker5\robber_client.lua:9 attempt to call global 'creatETeam' (a nil value)

heree is the code

CLIENT

  
    theMarker = createMarker(1728.0740966797, 2010.6652832031, 10, "cylinder", 4, 255, 0, 0, 255)   
    theTeam = createTeam("Car Jackers", 255, 0, 0) 
      
    local coordinates = {    
         {1509.0999755859, 2111.6999511719, 12, 0, 0, 90}, 
         {1509, 2118.1999511719, 12, 0, 0, 90}, 
         {1613.5999755859, 2217.1000976563, 12, 0, 0, 90}, 
         {2103.1999511719, 2046.1999511719, 12, 0, 0, 90}, 
         {2185.6000976563, 1996.3000488281, 12, 0, 0, 90}, 
         {2458.5, 1346.4000244141, 10.800000190735, 0, 0, 0}, 
         {2441.3999023438, 1345.8000488281, 12, 0, 0, 270}, 
         {2142.3999023438, 1015.9000244141, 12, 0, 0, 270}, 
         {1709.4000244141, 1168, 34.799999237061, 0, 0, 0}, 
         {1878.5999755859, 1815.6999511719, 13, 0, 0, 0}, 
         {2015.5999755859, 2165.6000976563, 12, 0, 0, 0}, 
         {2077.5, 2410.8000488281, 46, 0, 0, 90}, 
         {2584.1999511719, 2250.6000976563, 12, 0, 0, 0}, 
         {2631.1999511719, 1687.6999511719, 12, 0, 0, 90}, 
         
    } 
      
    local IDS = { 
         { 402 }, 
         { 542 }, 
         { 603 }, 
         { 475 }, 
         { 576 }, 
         { 575 }, 
         { 567 } 
    } 
      
    function getRandomCoordinates() 
         return unpack(coordinates[math.random(#coordinates)]) 
    end 
      
    function getRandomCoordinates1() 
         return unpack(IDS[math.random(#IDS)]) 
    end 
      
    veh = {} 
  
function resourceBootUp () 
    ourPed = createPed ( 293, 1734.7218017578, 1993.3072509766, 10 ) 
     ourBlip = createBlipAttachedTo ( ourPed, 41 ) 
      setBlipVisibleDistance ( ourBlip, 300 ) 
       setElementFrozen ( ourPed, true ) 
        setElementRotation ( ourPed, 0, 0, 0 ) 
         setElementInterior ( ourPed, 0 ) 
          setElementDimension ( ourPed, 0 ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, resourceBootUp ) 
  
  
local robberWindow = guiCreateWindow ( 0.314, 0.2513, 0.3809, 0.3893, "Car Jacker Job GUI", true ) 
local robberLabel = guiCreateLabel ( 0.0193, 0.0736, 0.9903, 0.1104, "Car  Jacker Job.", true, robberWindow ) 
guiLabelSetColor ( robberLabel, 255, 0, 0 ) 
guiLabelSetHorizontalAlign ( robberLabel, "center", false ) 
guiSetFont ( robberLabel, "default-bold-small" ) 
local robberInfoLabel = guiCreateLabel ( 0.0309, 0.2441, 0.944, 0.3077, "If you accept this job, you are able to sell certain cars that\nyou steal, the car you have to steal is\n marked  with a car blip on your map, goodluck.", true, robberWindow ) 
local robberAcceptButton = guiCreateButton ( 0.3533 ,0.7993, 0.1409, 0.1204, "Accept", true, robberWindow ) 
local robberCloseButton = guiCreateButton ( 0.5309, 0.7993, 0.1409, 0.1204, "Close", true, robberWindow ) 
guiSetVisible ( robberWindow, false ) 
  
  
function detectClickOnPed ( button, state, absX, absY, wx, wy, wz, element ) 
    if ( element and element == ourPed and not isPedInVehicle ( localPlayer ) ) then 
        local x, y, z = getElementPosition ( localPlayer ) 
         if ( getDistanceBetweenPoints3D ( x, y, z, wx, wy, wz ) <= 3 ) then 
            guiSetVisible ( robberWindow, true ) 
        end 
    end 
end 
addEventHandler ( "onClientClick", root, detectClickOnPed ) 
  
  
function buttonClick ( button ) 
    if ( button ~= "left" ) then  
        return 
    end 
    if ( source == robberCloseButton ) then 
        guiSetVisible ( robberWindow, false ) 
         showCursor ( false ) 
    elseif ( source == robberAcceptButton ) then 
             destroyElement ( robhouseMarker ) 
           destroyElement ( robhouseBlip ) 
        triggerServerEvent ( "robberJobAccepted", localPlayer ) 
         guiSetVisible ( robberWindow, false ) 
          showCursor ( false ) 
    end 
end 
addEventHandler ( "onClientGUIClick", resourceRoot, buttonClick ) 
function startBlip ( ) 
         myBlip = createBlipAttachedTo ( veh[source], 55, 65535, source ) 
end       
    addEvent("newBlip", true) 
    addEventHandler("newBlip",root,joinMedic) 
     
function killBlip ( ) 
        destroyElement ( myBlip ) 
end       
    addEvent("killBlip", true) 
    addEventHandler("killBlip",root,joinMedic) 
     
     
  

server

--[[ 
  
Developer: Sebastian 'seb' Cronberg 
Rights: All rights reserved by the developer (c) 2012 
File: ronbber_server.lua 
  
]] 
  
function createRobberTeam () 
    robberTeam = createTeam ( "Car Jackers" ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
addEvent ( "robberJobAccepted", true ) 
function givePlayerJob ( ) 
    setPlayerTeam ( source, robberTeam ) 
     setElementModel ( source, 28 ) 
             x, y, z, rx, ry, rz = getRandomCoordinates() 
         ID = getRandomCoordinates1() 
         if isElement(veh[source]) then destroyElement(veh[source]) veh[source] = nil end 
         veh[source] = createVehicle(ID, x, y, z, rx, ry, rz ) 
         triggerClientEvent ( "newBlip", localPlayer ) 
end 
addEventHandler ( "robberJobAccepted", root, givePlayerJob ) 
  
    theMarker = createMarker(1728.0740966797, 2010.6652832031, 10, "cylinder", 4, 255, 0, 0, 255)   
    theTeam = createTeam("Car Jackers", 255, 0, 0) 
      
    local coordinates = {    
         {1509.0999755859, 2111.6999511719, 12, 0, 0, 90}, 
         {1509, 2118.1999511719, 12, 0, 0, 90}, 
         {1613.5999755859, 2217.1000976563, 12, 0, 0, 90}, 
         {2103.1999511719, 2046.1999511719, 12, 0, 0, 90}, 
         {2185.6000976563, 1996.3000488281, 12, 0, 0, 90}, 
         {2458.5, 1346.4000244141, 10.800000190735, 0, 0, 0}, 
         {2441.3999023438, 1345.8000488281, 12, 0, 0, 270}, 
         {2142.3999023438, 1015.9000244141, 12, 0, 0, 270}, 
         {1709.4000244141, 1168, 34.799999237061, 0, 0, 0}, 
         {1878.5999755859, 1815.6999511719, 13, 0, 0, 0}, 
         {2015.5999755859, 2165.6000976563, 12, 0, 0, 0}, 
         {2077.5, 2410.8000488281, 46, 0, 0, 90}, 
         {2584.1999511719, 2250.6000976563, 12, 0, 0, 0}, 
         {2631.1999511719, 1687.6999511719, 12, 0, 0, 90}, 
         
    } 
      
    local IDS = { 
         { 402 }, 
         { 542 }, 
         { 603 }, 
         { 475 }, 
         { 576 }, 
         { 575 }, 
         { 567 } 
    } 
      
    function getRandomCoordinates() 
         return unpack(coordinates[math.random(#coordinates)]) 
    end 
      
    function getRandomCoordinates1() 
         return unpack(IDS[math.random(#IDS)]) 
    end 
      
    veh = {} 
      
    function spawnveh(player) 
         if (getElementType(player) == "player") then 
         theVehicle = getPedOccupiedVehicle(player) 
              if (theVehicle and theVehicle == veh[player]) then 
                   destroyElement (veh[player]) 
                   veh[player] = nil 
                   givePlayerMoney(player, 10000) 
                   outputChatBox("You have sold your stolen car",player,0,255,0) 
                    triggerClientEvent ( "killBlip", localPlayer ) 
                   else 
                   outputChatBox("You do not have the Vehicle!", player,255,0,0,true) 
              end 
         end 
    end 
    addEventHandler("onMarkerHit", theMarker, spawnveh) 
      
    function destroyCar() 
         for i, player in ipairs (getElementsByType("player")) do 
              if veh[player] == source then 
                   veh[player] = nil 
                   destroyElement ( myBlip) 
              end 
         end 
         setTimer(destroyElement,3500,1,source) 
    end 
    addEventHandler("onVehicleExplode", root, destroyCar) 
      
    addEventHandler("onPlayerQuit",root, 
    function() 
         if isElement(veh[source]) then 
              destroyElement(veh[source]) 
              veh[source] = nil 
              destroyElement( myBlip ) 
         end 
    end) 

please help

Also ever since i locked vehicles teams can get in any car unless it is scripted to there team :S

Link to comment
i still need help with why nobody can enter a car unless its scripted to thier team. Like its locked to the team. :/ Its really annoying

This should fix it

addEventHandler("onVehicleStartEnter", root, 
function(player) 
     local team = getPlayerTeam(player) and getTeamName(getPlayerTeam(player)) or "N/A" 
     local data = getElementData(source,"Team") 
     if team and data and team ~= data then 
          cancelEvent() 
     end 
end) 

if not working, post your code.

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