Jump to content

[HELP]3D text


Best-Killer

Recommended Posts

When i Login and i go near job i can't see the 3D Text But When i restar the resource i can see 3D Text please help me guys

Codes :

server-side :

max_wanted = { 
    community = 2,
    law = 3,
    criminal = 7
}
 
jobRanks = {
    ['criminal'] = {
        [0] = "L.G",
        [50] = "L.Y.G",
        [75] = "Y.G",
        [120] = "OYG",
        [200] = "O.G",
        [310] = "G.C.L",
        [499] = "G.L",
    },
    ['police officer'] = {
        [0] ="Officer",
        [90]="Corporal",
        [200]="Trooper",
        [310]="Sergeant",
        [450]="Captain",
        [600]="Commander",
        [900]="Chief of Police",
    },
    ['medic'] = {
        [0] = "Assistant",
        [50] = "Training",
        [100]= "Nurse",
        [130] = "Paramedic",
        [200] = "Doctor",
        [260] = "Surgeon"
    },
    ['mechanic'] = {
        [0] = "Rookie",
        [40] = "Wheel Specialist",
        [100]= "Engine Specialist",
        [140]= "Vehicle Professional",
        [200]= "Motorcycle Specialist",
        [245]= "Vehicle Master"
    },
    ['fisherman'] = {
        [0] = "Deck Hand",
        [20]= "Net Baiter",
        [75]= "Line Thrower",
        [100]="Line Roller",
        [140]="Boat Captain",
        [200]="Experienced Fisherman",
        [270]="Underwater Trap Setter"
    },
    ['detective'] = {
        [0] = "Detective",
    },
    ['military'] = {
        [0] = "Military",
    },
    ['swat'] = {
        [0] = "Swat",
    },
    ['pilot'] = {
        [0] = "Junior flight officer",
        [25] = "Flight Officer",
        [50] = "First Officer",
        [120] = "Captain",
        [180] = "Senior Captain",
        [250] = "Commercial First Officer",
        [310] = "Commercial Captain",
        [390] = "Commercial Commander",
        [460] = "Commercial Senior Commander",
    },
    ['stunter'] = {
        [0] = "Crash Dummy",
        [50] = "Crash",
        [150] = "Experienced",
        [200] = "Professional",
        [300] = "Expert BMXer"
    }
}
 
function getJobRankTable ( )
    return jobRanks
end
 
exports['Scoreboard']:scoreboardAddColumn  ( "Job", root, 90, "Job", 4 )
exports['Scoreboard']:scoreboardAddColumn  ( "Job Rank", root, 90, "Job Rank", 5 )
 
function create3DText ( str, pos, color, parent, settings )
    if str and pos and color then
        local text = createElement ( '3DText' )
        local settings = settings or  { }
        setElementData ( text, "text", str )
        setElementData ( text, "position", pos )
        setElementData ( text, "color", color )
        if ( not parent ) then
            parent = nil
        else
            if ( isElement ( parent ) ) then
                parent = parent
            else
                parent = nil
            end
        end
        setElementData ( text, "Settings", settings )
        setElementData ( text, "parentElement", parent )
        setElementData ( text, "sourceResource", sourceResource or getThisResource ( ))
        return text
    end
    return false
end
 
addEventHandler ( "onResourceStop", root, function ( r )
    for i, v in pairs ( getElementsByType ( "3DText" ) ) do
        if ( r == getElementData ( v, "sourceResource" ) ) then
            destroyElement ( v )
        end
    end
end )
 
function createJob ( name, x, y, z, rz )
    if ( name == 'Criminal' ) then
        create3DText ( 'Criminal', { x, y, z }, { 255, 0, 0 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 109 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 59, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.criminal ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.criminal )..".", p, 255, 0, 0 )
                end
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'criminal' )
            end
        end )
       
    ----------------------------------
    -- Law Jobs                     --
    ----------------------------------    
    elseif ( name == 'Police' ) then
        create3DText ( 'Police', { x, y, z }, { 0, 100, 255 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 286 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 61, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.law ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.law )..".", p, 255, 0, 0 )
                end
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'police' )
            end
        end )
       
    elseif ( name == 'Detective' ) then
        create3DText ( 'Detective', { x, y, z }, { 0, 120, 255 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 17 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 61, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.law ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.law )..".", p, 255, 0, 0 )
                end
               
                local arrests = getJobColumnData ( getAccountName ( getPlayerAccount ( p ) ), getDatabaseColumnTypeFromJob ( "police officer" ) )
                if ( arrests < 0 ) then
                    return exports.SAEGMessages:sendClientMessage ( "This job requires at least 150 arrests", p, 255, 255, 0 )
                end
               
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'detective' )
            end
        end )
       
    elseif ( name == 'Military' ) then
        create3DText ( 'Military', { x, y, z }, { 0, 120, 255 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 287 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 61, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.law ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.law )..".", p, 255, 0, 0 )
                end
                if ( getElementData(p, "Group") ~= "Military" ) then
                    return exports['SAEGMessages']:sendClientMessage ( "This job is available only for Military members.", p, 255, 0, 0)
                end
                local arrests = getJobColumnData ( getAccountName ( getPlayerAccount ( p ) ), getDatabaseColumnTypeFromJob ( "police officer" ) )
                if ( arrests < 0 ) then
                    return exports.SAEGMessages:sendClientMessage ( "This job requires at least 150 arrests", p, 255, 255, 0 )
                end
               
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'military' )
            end
        end )      
    elseif ( name == 'SWAT' ) then
        create3DText ( 'SWAT', { x, y, z }, { 0, 120, 255 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 285 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 61, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.law ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.law )..".", p, 255, 0, 0 )
                end
                if ( getElementData(p, "Group") ~= "SWAT" ) then
                    return exports['SAEGMessages']:sendClientMessage ( "This job is available only for SWAT members.", p, 255, 0, 0)
                end
                local arrests = getJobColumnData ( getAccountName ( getPlayerAccount ( p ) ), getDatabaseColumnTypeFromJob ( "police officer" ) )
                if ( arrests < 0 ) then
                    return exports.SAEGMessages:sendClientMessage ( "This job requires at least 150 arrests", p, 255, 255, 0 )
                end
               
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'swat' )
            end
        end )      
       
    ----------------------------------
    -- Emergency Jobs               --
    ----------------------------------
    elseif ( name == 'Medic' ) then
        create3DText ( 'Medic', { x, y, z }, { 0, 255, 255 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 274 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 58, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.community ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.community )..".", p, 255, 0, 0 )
                end
                triggerClientEvent ( p, 'SAEGJobs:OpenJobMenu', p, 'medic' )
            end
        end )
       
    ----------------------------------
    -- Community Jobs               --
    ----------------------------------
    elseif ( name == 'Mechanic' ) then
        create3DText ( 'Mechanic', { x, y, z }, { 255, 255, 0 }, { nil, true } )
        local p = createElement ( "GodmodePed" )
        setElementData ( p, "Model", 30 )
        setElementData ( p, "Position", { x, y, z, rz } )
        createBlip ( x, y, z, 60, 2, 255, 255, 255, 255, 0, 450 )
        addEventHandler ( 'onMarkerHit', createMarker ( x, y, z - 1, 'cylinder', 2, 0, 0, 0, 0 ), function ( p )
            if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) and not isPedDead ( p ) ) then
                if ( getPlayerWantedLevel ( p ) > max_wanted.community ) then
                    return exports['SAEGMessages']:sendClientMessage ( "The max wanted level for this job is "..tostring ( max_wanted.community )..".", p, 255, 0, 0 )
                end
               
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...